]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
Refresh of fstat
authorSean Hefty <sean.hefty@intel.com>
Tue, 14 Aug 2012 22:54:19 +0000 (15:54 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 14 Aug 2012 22:54:19 +0000 (15:54 -0700)
src/preload.c

index c6cf1761d6efb8233b3ac14f043aa337bda36c0d..f0c4174100f1bcc333bb87bdaef2c32adc76c987 100644 (file)
@@ -86,7 +86,11 @@ struct socket_calls {
                          void *optval, socklen_t *optlen);
        int (*fcntl)(int socket, int cmd, ... /* arg */);
        int (*dup2)(int oldfd, int newfd);
+<<<<<<< current
        ssize_t (*sendfile)(int out_fd, int in_fd, off_t *offset, size_t count);
+=======
+       int (*fxstat64)(int ver, int fd, struct stat64 *buf);
+>>>>>>> patched
 };
 
 static struct socket_calls real;
@@ -279,7 +283,11 @@ static void init_preload(void)
        real.getsockopt = dlsym(RTLD_NEXT, "getsockopt");
        real.fcntl = dlsym(RTLD_NEXT, "fcntl");
        real.dup2 = dlsym(RTLD_NEXT, "dup2");
+<<<<<<< current
        real.sendfile = dlsym(RTLD_NEXT, "sendfile");
+=======
+       real.fxstat64 = dlsym(RTLD_NEXT, "__fxstat64");
+>>>>>>> patched
 
        rs.socket = dlsym(RTLD_DEFAULT, "rsocket");
        rs.bind = dlsym(RTLD_DEFAULT, "rbind");
@@ -1033,3 +1041,17 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
        munmap(file_addr, count);
        return ret;
 }
+
+int __fxstat64(int ver, int socket, struct stat64 *buf)
+{
+       int fd, ret;
+
+       if (fd_get(socket, &fd) == fd_rsocket) {
+               ret = real.fxstat64(ver, socket, buf);
+               if (!ret)
+                       buf->st_mode = (buf->st_mode & ~S_IFMT) | __S_IFSOCK;
+       } else {
+               ret = real.fxstat64(ver, fd, buf);
+       }
+       return ret;
+}