OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa.c versions 1.12 and 1.13
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa.c 1.12 -> 1.13

--- sa.c 2001/10/08 10:03:54     1.12
+++ sa.c 2001/10/08 13:37:08     1.13
@@ -118,6 +118,13 @@
         (sa)->scSysCall.sc_##fn.fctx = (ctx); \
     } while(0)
 
+/* system call structure assignment macro */
+#define SA_SC_COPY(sa1, sa2, fn) \
+    do { \
+        (sa1)->scSysCall.sc_##fn.fptr.any = (sa2)->scSysCall.sc_##fn.fptr.any; \
+        (sa1)->scSysCall.sc_##fn.fctx     = (sa2)->scSysCall.sc_##fn.fctx; \
+    } while(0)
+
 /* system call function call macros */
 #define SA_SC_CALL_0(sa, fn) \
     (   (sa)->scSysCall.sc_##fn.fctx != NULL \
@@ -1105,6 +1112,7 @@
     } sa_buf;
     socklen_t sa_len;
     int s;
+    int i;
 
     /* argument sanity check(s) */
     if (sa == NULL || caddr == NULL || csa == NULL)
@@ -1150,8 +1158,25 @@
         sa_addr_destroy(*caddr);
         return rv;
     }
+
+    /* fill-in child socket */
     (*csa)->fdSocket = s;
 
+    /* copy-over original system calls */
+    SA_SC_COPY((*csa), sa, connect);
+    SA_SC_COPY((*csa), sa, accept);
+    SA_SC_COPY((*csa), sa, select);
+    SA_SC_COPY((*csa), sa, read);
+    SA_SC_COPY((*csa), sa, write);
+    SA_SC_COPY((*csa), sa, recvfrom);
+    SA_SC_COPY((*csa), sa, sendto);
+
+    /* copy-over original timeout values */
+    for (i = 0; i < (sizeof(sa->tvTimeout)/sizeof(sa->tvTimeout[0])); i++) {
+        (*csa)->tvTimeout[i].tv_sec  = sa->tvTimeout[i].tv_sec;
+        (*csa)->tvTimeout[i].tv_usec = sa->tvTimeout[i].tv_usec;
+    }
+
     return SA_OK;
 }
 

CVSTrac 2.0.1