]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
Refresh of dbg-out
authorSean Hefty <sean.hefty@intel.com>
Wed, 8 Aug 2012 05:09:47 +0000 (22:09 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 8 Aug 2012 05:09:47 +0000 (22:09 -0700)
src/preload.c

index 83cf471e595db0d188acb685e0c25325c8e7c1ed..fdb25acc5dacc31eb1b605d49d21bdfa2f2473a0 100644 (file)
@@ -396,7 +396,7 @@ int socket(int domain, int type, int protocol)
        if (index < 0)
                return index;
 
-       fprintf(fout, "%d socket %d\n", syscall(SYS_gettid), index);
+       fprintf(fout, "%d socket %d\n", syscall(SYS_gettid), index);
        fflush(fout);
        recursive = 1;
        ret = rsocket(domain, type, protocol);
@@ -412,7 +412,7 @@ int socket(int domain, int type, int protocol)
                        fd_store(index, ret, fd_rsocket);
                        set_rsocket_options(ret);
                }
-               fprintf(fout, "%d socket - %d fd %d type %d\n",
+               fprintf(fout, "%d socket %d real fd %d type %d\n",
                                syscall(SYS_gettid), index, ret, fd_gett(index));
                fflush(fout);
                return index;
@@ -425,6 +425,8 @@ real:
 int bind(int socket, const struct sockaddr *addr, socklen_t addrlen)
 {
        int fd;
+       fprintf(fout, "%d bind %d\n", syscall(SYS_gettid), socket);
+       fflush(fout);
        return (fd_get(socket, &fd) == fd_rsocket) ?
                rbind(fd, addr, addrlen) : real.bind(fd, addr, addrlen);
 }
@@ -432,6 +434,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", syscall(SYS_gettid), socket);
+       fflush(fout);
        return (fd_get(socket, &fd) == fd_rsocket) ?
                rlisten(fd, backlog) : real.listen(fd, backlog);
 }
@@ -442,7 +446,7 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
        enum fd_type type;
 
        type = fd_get(socket, &fd);
-       fprintf(fout, "%d accept fd %d\n", syscall(SYS_gettid), socket);
+       fprintf(fout, "%d accept %d\n", syscall(SYS_gettid), socket);
        fflush(fout);
        if (type == fd_rsocket || type == fd_fork) {
                index = fd_open();
@@ -456,7 +460,8 @@ int accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
                        return ret;
                }
 
-               fprintf(fout, "%d accept fd %d new fd %d\n", syscall(SYS_gettid), socket, index);
+               fprintf(fout, "%d accept %d new fd %d new real fd %d\n",
+                       syscall(SYS_gettid), socket, index, ret);
                fflush(fout);
                fd_store(index, ret, type);
                return index;
@@ -511,7 +516,7 @@ static void fork_passive(int socket)
        uint32_t msg;
 
        fd_get(socket, &sfd);
-       fprintf(fout, "%d fork_passive - %d fd %d\n", syscall(SYS_gettid), socket, sfd);
+       fprintf(fout, "%d fork_passive %d real fd %d\n", syscall(SYS_gettid), socket, sfd);
        fflush(fout);
 
        len = sizeof sin6;
@@ -545,7 +550,7 @@ static void fork_passive(int socket)
        ret = rlisten(lfd, 1);
        if (ret)
                goto lclose;
-       fprintf(fout, "%d fork_passive - %d listening for fork\n", syscall(SYS_gettid), socket);
+       fprintf(fout, "%d fork_passive %d, listening for fork\n", syscall(SYS_gettid), socket);
        fflush(fout);
 
        msg = 0;
@@ -571,7 +576,8 @@ 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\n", syscall(SYS_gettid), socket, dfd);
+       fprintf(fout, "%d fork_passive success %d new fd %d old fd %d\n",
+               syscall(SYS_gettid), socket, dfd, sfd);
        fflush(fout);
 
 lclose:
@@ -654,6 +660,8 @@ ssize_t read(int socket, void *buf, size_t count)
 {
        int fd;
        init_preload();
+       fprintf(fout, "%d read %d read fd %d\n", syscall(SYS_gettid), socket, fd_getd(socket));
+       fflush(fout);
        return (fd_fork_get(socket, &fd) == fd_rsocket) ?
                rread(fd, buf, count) : real.read(fd, buf, count);
 }
@@ -846,6 +854,8 @@ int close(int socket)
        int ret;
 
        init_preload();
+       fprintf(fout, "%d close %d real fd %d\n", syscall(SYS_gettid), socket, fd_getd(socket));
+       fflush(fout);
        fdi = idm_lookup(&idm, socket);
        if (!fdi)
                return real.close(socket);
@@ -951,6 +961,7 @@ int dup2(int oldfd, int newfd)
 
        init_preload();
        fprintf(fout, "%d dup2 %d -> %d\n", syscall(SYS_gettid), oldfd, newfd);
+       fflush(fout);
        oldfdi = idm_lookup(&idm, oldfd);
        if (oldfdi && oldfdi->type == fd_fork)
                fork_passive(oldfd);
@@ -988,6 +999,9 @@ 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",
+               syscall(SYS_gettid), oldfd, newfd, newfdi->fd, newfdi->type);
+       fflush(fout);
        return newfd;
 }