OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_syscall.c versions 1.31 and 1.32
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_syscall.c 1.31 -> 1.32

--- pth_syscall.c        2004/09/12 12:02:50     1.31
+++ pth_syscall.c        2004/09/12 12:33:03     1.32
@@ -629,6 +629,54 @@
 /* NOTICE: internally fully emulated, so still no
    internal exit point pth_sc_pwrite necessary! */
 
+/* ==== Pth hard syscall wrapper for recv(2) ==== */
+ssize_t recv(int, void *, size_t, int);
+ssize_t recv(int fd, void *buf, size_t nbytes, int flags)
+{
+    /* external entry point for application */
+    pth_implicit_init();
+    return pth_recv(fd, buf, nbytes, flags);
+}
+intern ssize_t pth_sc_recv(int fd, void *buf, size_t nbytes, int flags)
+{
+    /* internal exit point for Pth */
+    if (pth_syscall_fct_tab[PTH_SCF_recv].addr != NULL)
+        return ((ssize_t (*)(int, void *, size_t, int))
+               pth_syscall_fct_tab[PTH_SCF_recv].addr)
+               (fd, buf, nbytes, flags);
+#if defined(HAVE_SYSCALL) && defined(SYS_recv)
+    else return (ssize_t)syscall(SYS_recv, fd, buf, nbytes, flags);
+#elif defined(HAVE_SYSCALL) && defined(SYS_recvfrom)
+    else return (ssize_t)syscall(SYS_recvfrom, fd, buf, nbytes, flags, (struct sockaddr *)NULL, (socklen_t *)NULL);
+#else
+    else PTH_SYSCALL_ERROR(-1, ENOSYS, "recv");
+#endif
+}
+
+/* ==== Pth hard syscall wrapper for send(2) ==== */
+ssize_t send(int, void *, size_t, int);
+ssize_t send(int fd, void *buf, size_t nbytes, int flags)
+{
+    /* external entry point for application */
+    pth_implicit_init();
+    return pth_send(fd, buf, nbytes, flags);
+}
+intern ssize_t pth_sc_send(int fd, void *buf, size_t nbytes, int flags)
+{
+    /* internal exit point for Pth */
+    if (pth_syscall_fct_tab[PTH_SCF_send].addr != NULL)
+        return ((ssize_t (*)(int, void *, size_t, int))
+               pth_syscall_fct_tab[PTH_SCF_send].addr)
+               (fd, buf, nbytes, flags);
+#if defined(HAVE_SYSCALL) && defined(SYS_send)
+    else return (ssize_t)syscall(SYS_send, fd, buf, nbytes, flags);
+#elif defined(HAVE_SYSCALL) && defined(SYS_sendto)
+    else return (ssize_t)syscall(SYS_sendto, fd, buf, nbytes, flags, (struct sockaddr *)NULL, 0);
+#else
+    else PTH_SYSCALL_ERROR(-1, ENOSYS, "send");
+#endif
+}
+
 /* ==== Pth hard syscall wrapper for recvfrom(2) ==== */
 ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
 ssize_t recvfrom(int fd, void *buf, size_t nbytes, int flags, struct sockaddr *from, socklen_t *fromlen)

CVSTrac 2.0.1