int (*fcntl)(int socket, int cmd, ... /* arg */);
int (*dup2)(int oldfd, int newfd);
ssize_t (*sendfile)(int out_fd, int in_fd, off_t *offset, size_t count);
+ int (*fxstat)(int ver, int fd, struct stat *buf);
};
static struct socket_calls real;
real.fcntl = dlsym(RTLD_NEXT, "fcntl");
real.dup2 = dlsym(RTLD_NEXT, "dup2");
real.sendfile = dlsym(RTLD_NEXT, "sendfile");
+ real.fxstat = dlsym(RTLD_NEXT, "__fxstat");
rs.socket = dlsym(RTLD_DEFAULT, "rsocket");
rs.bind = dlsym(RTLD_DEFAULT, "rbind");
munmap(file_addr, count);
return ret;
}
+
+int __fxstat(int ver, int socket, struct stat *buf)
+{
+ int fd, ret;
+
+ init_preload();
+ if (fd_get(socket, &fd) == fd_rsocket) {
+ ret = real.fxstat(ver, socket, buf);
+ if (!ret)
+ buf->st_mode = (buf->st_mode & ~S_IFMT) | __S_IFSOCK;
+ } else {
+ ret = real.fxstat(ver, fd, buf);
+ }
+ return ret;
+}