]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
Refresh of dbg
authorSean Hefty <sean.hefty@intel.com>
Wed, 18 Jul 2012 18:30:58 +0000 (11:30 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 18 Jul 2012 18:30:58 +0000 (11:30 -0700)
src/preload.c

index 56c6c7d0710483599e4ba1b42d29a5aaed7e0935..8f2d67b643daa8414310c7550e1e0a0b0d20863c 100644 (file)
@@ -48,6 +48,7 @@
 #include <netinet/tcp.h>
 #include <unistd.h>
 #include <semaphore.h>
+#include <stdio.h>
 
 #include <rdma/rdma_cma.h>
 #include <rdma/rdma_verbs.h>
@@ -467,15 +468,17 @@ static int connect_fork(int socket, const struct sockaddr *addr, socklen_t addrl
        uint32_t msg;
        long flags;
 
+       printf("connect_fork\n");
        fd = fd_getd(socket);
        flags = real.fcntl(fd, F_GETFD);
        real.fcntl(fd, F_SETFD, 0);
        ret = real.connect(fd, addr, addrlen);
-       if (ret) {
+       printf("connect_fork - real connect %d %s\n", ret, strerror(errno));
+       if (ret)
                return ret;
-       }
 
        ret = real.recv(fd, &msg, sizeof msg, MSG_PEEK);
+       printf("connect_fork - real recv %d msg %d\n", ret, msg);
        if ((ret != sizeof msg) || msg) {
                fd_store(socket, fd, fd_normal);
                return 0;
@@ -483,6 +486,7 @@ static int connect_fork(int socket, const struct sockaddr *addr, socklen_t addrl
 
        real.fcntl(fd, F_SETFD, flags);
        ret = transpose_socket(socket, fd_rsocket);
+       printf("connect_fork - transpose socket %d\n", ret);
        if (ret < 0)
                return ret;
 
@@ -835,11 +839,15 @@ pid_t fork(void)
        uint32_t msg;
 
        init_preload();
+       printf("fork\n");
        pid = real.fork();
+       printf("fork - pid %d fork_support %d last_accept %d \n",
+               pid, fork_support, last_accept);
        if (pid || !fork_support || (last_accept < 0) ||
            (fd_get(last_accept, &sfd) != fd_fork))
                goto out;
 
+       printf("fork - switching to rsocket\n");
        len = sizeof sin6;
        ret = real.getsockname(sfd, (struct sockaddr *) &sin6, &len);
        if (ret)
@@ -848,10 +856,12 @@ pid_t fork(void)
        memset(&sin6.sin6_addr, 0, sizeof sin6.sin6_addr);
 
        sem = sem_open("/rsocket_fork", O_CREAT, 0644, 1);
+       printf("fork - sem_open\n");
        if (sem == SEM_FAILED)
                goto out;
 
        lfd = rsocket(sin6.sin6_family, SOCK_STREAM, 0);
+       printf("fork - rsocket %d\n", lfd);
        if (lfd < 0)
                goto sclose;
 
@@ -860,14 +870,17 @@ pid_t fork(void)
 
        sem_wait(sem);
        ret = rbind(lfd, (struct sockaddr *) &sin6, sizeof sin6);
+       printf("fork - rbind %d\n", ret);
        if (ret)
                goto lclose;
 
        ret = rlisten(lfd, 1);
+       printf("fork - rlisten %d\n", ret);
        if (ret)
                goto lclose;
 
        dfd = raccept(lfd, NULL, NULL);
+       printf("fork - raccept %d\n", dfd);
        if (dfd < 0)
                goto lclose;
 
@@ -877,6 +890,7 @@ pid_t fork(void)
 
        msg = 0;
        ret = real.write(sfd, &msg, sizeof msg);
+       printf("fork - real write %d\n", ret);
        if (ret != sizeof msg) {
                rclose(dfd);
                goto lclose;