Version: 1
-Previous: e762cbf1b3edcf8b092e01a604710bee594c00f7
-Head: 18aecded2c9d7fdc921279d7a608dcd39567def3
+Previous: 0ae3f1c2acddeb70bac09bd1421ccc80b1d8e410
+Head: 04273ee712db4d53efb390462c1b738bb54a57df
Applied:
real-close: 3409f8d6af187d25c63a5d1f8ee8bff5f14555e2
dup2: ca5813e7cf95dee5933fc417e4a34d26f2b01824
oobinline: ac51c1095f505373a6ec54b8f1d990259fb34d97
- dbg-out: 497abea25fda7228dfe6993d17514b45330706bc
- refresh-temp: 18aecded2c9d7fdc921279d7a608dcd39567def3
+ dbg-out: 04273ee712db4d53efb390462c1b738bb54a57df
Unapplied:
fstat: a62c653906870422edef5f6388dac9f76c953e35
dbg: 0c269855776d3001e37da8c8afe283c20e1d6cd6
Bottom: 3ea2748a5c41b11a2e7033c56bddd938d2770b6c
-Top: 3ea2748a5c41b11a2e7033c56bddd938d2770b6c
+Top: 5b0c956c81c8c8130866d7f75a310c32250e2012
Author: Sean Hefty <sean.hefty@intel.com>
Date: 2012-08-07 21:30:48 -0700
---
-
+diff --git a/src/preload.c b/src/preload.c
+index b18d310..b648622 100644
+--- a/src/preload.c
++++ b/src/preload.c
+@@ -48,6 +48,8 @@
+ #include <netinet/tcp.h>
+ #include <unistd.h>
+ #include <semaphore.h>
++#include <stdio.h>
++#include <sys/syscall.h>
+
+ #include <rdma/rdma_cma.h>
+ #include <rdma/rdma_verbs.h>
+@@ -97,6 +99,8 @@ static int rq_size;
+ static int sq_inline;
+ static int fork_support;
+
++static FILE *fout;
++
+ enum fd_type {
+ fd_normal,
+ fd_rsocket,
+@@ -284,6 +288,7 @@ static void init_preload(void)
+ rs.getsockopt = dlsym(RTLD_DEFAULT, "rgetsockopt");
+ rs.fcntl = dlsym(RTLD_DEFAULT, "rfcntl");
+
++ fout = fopen("rs-out.txt", "w+");
+ getenv_options();
+ init = 1;
+ out:
+@@ -381,6 +386,7 @@ int socket(int domain, int type, int protocol)
+ static __thread int recursive;
+ int index, ret;
+
++ fprintf(fout, "%d socket\n", (int)syscall(SYS_gettid));
+ if (recursive)
+ goto real;
+
+@@ -389,6 +395,8 @@ int socket(int domain, int type, int protocol)
+ if (index < 0)
+ return index;
+
++ fprintf(fout, "%d socket %d\n", (int)syscall(SYS_gettid), index);
++ fflush(fout);
+ recursive = 1;
+ ret = rsocket(domain, type, protocol);
+ recursive = 0;
+@@ -403,6 +411,9 @@ int socket(int domain, int type, int protocol)
+ fd_store(index, ret, fd_rsocket);
+ set_rsocket_options(ret);
+ }
++ fprintf(fout, "%d socket %d real fd %d type %d\n",
++ (int)syscall(SYS_gettid), index, ret, fd_gett(index));
++ fflush(fout);
+ return index;
+ }
+ fd_close(index, &ret);
+@@ -413,6 +424,8 @@ real:
+ int bind(int socket, const struct sockaddr *addr, socklen_t addrlen)
+ {
+ int fd;
++ fprintf(fout, "%d bind %d\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+ return (fd_get(socket, &fd) == fd_rsocket) ?
+ rbind(fd, addr, addrlen) : real.bind(fd, addr, addrlen);
+ }
+@@ -420,6 +433,8 @@ int bind(int socket, const struct sockaddr *addr, socklen_t addrlen)
+ int listen(int socket, int backlog)
+ {
+ int fd;
++ fprintf(fout, "%d listen %d\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+ return (fd_get(socket, &fd) == fd_rsocket) ?
+ rlisten(fd, backlog) : real.listen(fd, backlog);
+ }
+@@ -430,6 +445,8 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
+ enum fd_type type;
+
+ type = fd_get(socket, &fd);
++ fprintf(fout, "%d accept %d\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+ if (type == fd_rsocket || type == fd_fork) {
+ index = fd_open();
+ if (index < 0)
+@@ -442,6 +459,9 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
+ return ret;
+ }
+
++ fprintf(fout, "%d accept %d new fd %d new real fd %d\n",
++ (int)syscall(SYS_gettid), socket, index, ret);
++ fflush(fout);
+ fd_store(index, ret, type);
+ return index;
+ } else {
+@@ -463,6 +483,8 @@ static int fork_active(int socket, const struct sockaddr *addr, socklen_t addrle
+ long flags;
+
+ fd = fd_getd(socket);
++ fprintf(fout, "%d fork_active - %d fd %d\n", (int)syscall(SYS_gettid), socket, fd);
++ fflush(fout);
+ flags = real.fcntl(fd, F_GETFL);
+ real.fcntl(fd, F_SETFL, 0);
+ ret = real.connect(fd, addr, addrlen);
+@@ -493,6 +515,8 @@ static void fork_passive(int socket)
+ uint32_t msg;
+
+ fd_get(socket, &sfd);
++ fprintf(fout, "%d fork_passive %d real fd %d\n", (int)syscall(SYS_gettid), socket, sfd);
++ fflush(fout);
+
+ len = sizeof sin6;
+ ret = real.getsockname(sfd, (struct sockaddr *) &sin6, &len);
+@@ -525,11 +549,17 @@ static void fork_passive(int socket)
+ ret = rlisten(lfd, 1);
+ if (ret)
+ goto lclose;
++ fprintf(fout, "%d fork_passive %d, listening for fork\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+
+ msg = 0;
+ len = real.write(sfd, &msg, sizeof msg);
+ if (len != sizeof msg)
++ {
++ fprintf(fout, "%d fork_passive - %d write failed\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+ goto lclose;
++ }
+
+ dfd = raccept(lfd, NULL, NULL);
+ if (dfd < 0) {
+@@ -545,6 +575,9 @@ static void fork_passive(int socket)
+ real.shutdown(sfd, SHUT_RDWR);
+ real.close(sfd);
+ fd_store(socket, dfd, fd_rsocket);
++ fprintf(fout, "%d fork_passive success %d new fd %d old fd %d\n",
++ (int)syscall(SYS_gettid), socket, dfd, sfd);
++ fflush(fout);
+
+ lclose:
+ rclose(lfd);
+@@ -577,6 +610,8 @@ int connect(int socket, const struct sockaddr *addr, socklen_t addrlen)
+ {
+ int fd, ret;
+
++ fprintf(fout, "%d connect %d\n", (int)syscall(SYS_gettid), socket);
++ fflush(fout);
+ switch (fd_get(socket, &fd)) {
+ case fd_fork:
+ return fork_active(socket, addr, addrlen);
+@@ -818,18 +853,29 @@ int close(int socket)
+ int ret;
+
+ init_preload();
++ fprintf(fout, "%d close %d real fd %d type %d\n",
++ (int)syscall(SYS_gettid), socket, fd_getd(socket), fd_gett(socket));
++ fflush(fout);
+ fdi = idm_lookup(&idm, socket);
+ if (!fdi)
+ return real.close(socket);
+
+ if (fdi->dupfd != -1) {
++ fprintf(fout, "%d closing dupfd %d\n",
++ (int)syscall(SYS_gettid), fdi->dupfd);
++ fflush(fout);
+ ret = close(fdi->dupfd);
+ if (ret)
+ return ret;
+ }
+
+ if (atomic_dec(&fdi->refcnt))
++ {
++ fprintf(fout, "%d close - still have ref %d\n",
++ (int)syscall(SYS_gettid), atomic_get(&fdi->refcnt));
++ fflush(fout);
+ return 0;
++ }
+
+ idm_clear(&idm, socket);
+ real.close(socket);
+@@ -922,6 +968,8 @@ int dup2(int oldfd, int newfd)
+ int ret;
+
+ init_preload();
++ fprintf(fout, "%d dup2 %d -> %d\n", (int)syscall(SYS_gettid), oldfd, newfd);
++ fflush(fout);
+ oldfdi = idm_lookup(&idm, oldfd);
+ if (oldfdi && oldfdi->type == fd_fork)
+ fork_passive(oldfd);
+@@ -959,5 +1007,8 @@ int dup2(int oldfd, int newfd)
+ atomic_init(&newfdi->refcnt);
+ atomic_set(&newfdi->refcnt, 1);
+ atomic_inc(&oldfdi->refcnt);
++ fprintf(fout, "%d dup2 %d -> %d, real fd %d type %d\n",
++ (int)syscall(SYS_gettid), oldfd, newfd, newfdi->fd, newfdi->type);
++ fflush(fout);
+ return newfd;
+ }
+++ /dev/null
-Bottom: 3ea2748a5c41b11a2e7033c56bddd938d2770b6c
-Top: 5b0c956c81c8c8130866d7f75a310c32250e2012
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2012-08-10 16:24:35 -0700
-
-Refresh of dbg-out
-
----
-
-diff --git a/src/preload.c b/src/preload.c
-index b18d310..b648622 100644
---- a/src/preload.c
-+++ b/src/preload.c
-@@ -48,6 +48,8 @@
- #include <netinet/tcp.h>
- #include <unistd.h>
- #include <semaphore.h>
-+#include <stdio.h>
-+#include <sys/syscall.h>
-
- #include <rdma/rdma_cma.h>
- #include <rdma/rdma_verbs.h>
-@@ -97,6 +99,8 @@ static int rq_size;
- static int sq_inline;
- static int fork_support;
-
-+static FILE *fout;
-+
- enum fd_type {
- fd_normal,
- fd_rsocket,
-@@ -284,6 +288,7 @@ static void init_preload(void)
- rs.getsockopt = dlsym(RTLD_DEFAULT, "rgetsockopt");
- rs.fcntl = dlsym(RTLD_DEFAULT, "rfcntl");
-
-+ fout = fopen("rs-out.txt", "w+");
- getenv_options();
- init = 1;
- out:
-@@ -381,6 +386,7 @@ int socket(int domain, int type, int protocol)
- static __thread int recursive;
- int index, ret;
-
-+ fprintf(fout, "%d socket\n", (int)syscall(SYS_gettid));
- if (recursive)
- goto real;
-
-@@ -389,6 +395,8 @@ int socket(int domain, int type, int protocol)
- if (index < 0)
- return index;
-
-+ fprintf(fout, "%d socket %d\n", (int)syscall(SYS_gettid), index);
-+ fflush(fout);
- recursive = 1;
- ret = rsocket(domain, type, protocol);
- recursive = 0;
-@@ -403,6 +411,9 @@ int socket(int domain, int type, int protocol)
- fd_store(index, ret, fd_rsocket);
- set_rsocket_options(ret);
- }
-+ fprintf(fout, "%d socket %d real fd %d type %d\n",
-+ (int)syscall(SYS_gettid), index, ret, fd_gett(index));
-+ fflush(fout);
- return index;
- }
- fd_close(index, &ret);
-@@ -413,6 +424,8 @@ real:
- int bind(int socket, const struct sockaddr *addr, socklen_t addrlen)
- {
- int fd;
-+ fprintf(fout, "%d bind %d\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
- return (fd_get(socket, &fd) == fd_rsocket) ?
- rbind(fd, addr, addrlen) : real.bind(fd, addr, addrlen);
- }
-@@ -420,6 +433,8 @@ int bind(int socket, const struct sockaddr *addr, socklen_t addrlen)
- int listen(int socket, int backlog)
- {
- int fd;
-+ fprintf(fout, "%d listen %d\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
- return (fd_get(socket, &fd) == fd_rsocket) ?
- rlisten(fd, backlog) : real.listen(fd, backlog);
- }
-@@ -430,6 +445,8 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
- enum fd_type type;
-
- type = fd_get(socket, &fd);
-+ fprintf(fout, "%d accept %d\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
- if (type == fd_rsocket || type == fd_fork) {
- index = fd_open();
- if (index < 0)
-@@ -442,6 +459,9 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
- return ret;
- }
-
-+ fprintf(fout, "%d accept %d new fd %d new real fd %d\n",
-+ (int)syscall(SYS_gettid), socket, index, ret);
-+ fflush(fout);
- fd_store(index, ret, type);
- return index;
- } else {
-@@ -463,6 +483,8 @@ static int fork_active(int socket, const struct sockaddr *addr, socklen_t addrle
- long flags;
-
- fd = fd_getd(socket);
-+ fprintf(fout, "%d fork_active - %d fd %d\n", (int)syscall(SYS_gettid), socket, fd);
-+ fflush(fout);
- flags = real.fcntl(fd, F_GETFL);
- real.fcntl(fd, F_SETFL, 0);
- ret = real.connect(fd, addr, addrlen);
-@@ -493,6 +515,8 @@ static void fork_passive(int socket)
- uint32_t msg;
-
- fd_get(socket, &sfd);
-+ fprintf(fout, "%d fork_passive %d real fd %d\n", (int)syscall(SYS_gettid), socket, sfd);
-+ fflush(fout);
-
- len = sizeof sin6;
- ret = real.getsockname(sfd, (struct sockaddr *) &sin6, &len);
-@@ -525,11 +549,17 @@ static void fork_passive(int socket)
- ret = rlisten(lfd, 1);
- if (ret)
- goto lclose;
-+ fprintf(fout, "%d fork_passive %d, listening for fork\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
-
- msg = 0;
- len = real.write(sfd, &msg, sizeof msg);
- if (len != sizeof msg)
-+ {
-+ fprintf(fout, "%d fork_passive - %d write failed\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
- goto lclose;
-+ }
-
- dfd = raccept(lfd, NULL, NULL);
- if (dfd < 0) {
-@@ -545,6 +575,9 @@ static void fork_passive(int socket)
- real.shutdown(sfd, SHUT_RDWR);
- real.close(sfd);
- fd_store(socket, dfd, fd_rsocket);
-+ fprintf(fout, "%d fork_passive success %d new fd %d old fd %d\n",
-+ (int)syscall(SYS_gettid), socket, dfd, sfd);
-+ fflush(fout);
-
- lclose:
- rclose(lfd);
-@@ -577,6 +610,8 @@ int connect(int socket, const struct sockaddr *addr, socklen_t addrlen)
- {
- int fd, ret;
-
-+ fprintf(fout, "%d connect %d\n", (int)syscall(SYS_gettid), socket);
-+ fflush(fout);
- switch (fd_get(socket, &fd)) {
- case fd_fork:
- return fork_active(socket, addr, addrlen);
-@@ -818,18 +853,29 @@ int close(int socket)
- int ret;
-
- init_preload();
-+ fprintf(fout, "%d close %d real fd %d type %d\n",
-+ (int)syscall(SYS_gettid), socket, fd_getd(socket), fd_gett(socket));
-+ fflush(fout);
- fdi = idm_lookup(&idm, socket);
- if (!fdi)
- return real.close(socket);
-
- if (fdi->dupfd != -1) {
-+ fprintf(fout, "%d closing dupfd %d\n",
-+ (int)syscall(SYS_gettid), fdi->dupfd);
-+ fflush(fout);
- ret = close(fdi->dupfd);
- if (ret)
- return ret;
- }
-
- if (atomic_dec(&fdi->refcnt))
-+ {
-+ fprintf(fout, "%d close - still have ref %d\n",
-+ (int)syscall(SYS_gettid), atomic_get(&fdi->refcnt));
-+ fflush(fout);
- return 0;
-+ }
-
- idm_clear(&idm, socket);
- real.close(socket);
-@@ -922,6 +968,8 @@ int dup2(int oldfd, int newfd)
- int ret;
-
- init_preload();
-+ fprintf(fout, "%d dup2 %d -> %d\n", (int)syscall(SYS_gettid), oldfd, newfd);
-+ fflush(fout);
- oldfdi = idm_lookup(&idm, oldfd);
- if (oldfdi && oldfdi->type == fd_fork)
- fork_passive(oldfd);
-@@ -959,5 +1007,8 @@ int dup2(int oldfd, int newfd)
- atomic_init(&newfdi->refcnt);
- atomic_set(&newfdi->refcnt, 1);
- atomic_inc(&oldfdi->refcnt);
-+ fprintf(fout, "%d dup2 %d -> %d, real fd %d type %d\n",
-+ (int)syscall(SYS_gettid), oldfd, newfd, newfdi->fd, newfdi->type);
-+ fflush(fout);
- return newfd;
- }