Index: trunk/src/emx/src/libsocket/_getsockhandle.c
===================================================================
--- trunk/src/emx/src/libsocket/_getsockhandle.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/_getsockhandle.c	(revision 1173)
@@ -33,4 +33,5 @@
 #include <sys/socket.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -45,7 +46,8 @@
 int _getsockhandle(int socket)
 {
+    LIBCLOG_ENTER("socket=%d\n", socket);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
-        return pFHSocket->iSocket;
-    return -1;
+        LIBCLOG_RETURN_INT(pFHSocket->iSocket);
+    LIBCLOG_RETURN_INT(-1);
 }
Index: trunk/src/emx/src/libsocket/_impsockhandle.c
===================================================================
--- trunk/src/emx/src/libsocket/_impsockhandle.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/_impsockhandle.c	(revision 1173)
@@ -34,4 +34,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -47,4 +48,5 @@
 int _impsockhandle(int os2socket, int flags)
 {
+    LIBCLOG_ENTER("os2socket=%d flags=%#x\n", os2socket, flags);
     PLIBCSOCKETFH   pFH;
     int             iType;
@@ -60,5 +62,5 @@
     {
         __libsocket_setErrno(EBADF);
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
 
@@ -68,7 +70,7 @@
     rc = __libc_FHAllocate(-1, O_RDWR | F_SOCKET, sizeof(LIBCSOCKETFH), &__libsocket_gSocketOps, (PLIBCFH*)&pFH, &fh);
     if (rc)
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     pFH->iSocket = os2socket;
-    return fh;
+    LIBCLOG_RETURN_INT(fh);
 }
 
Index: trunk/src/emx/src/libsocket/accept.c
===================================================================
--- trunk/src/emx/src/libsocket/accept.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/accept.c	(revision 1173)
@@ -33,8 +33,11 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int accept(int socket, struct sockaddr *addr, int *addrlen)
 {
+    LIBCLOG_ENTER("socket=%d socketaddr=%p addrlen=%p\n",
+                  socket, addr, addrlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     int             s;
@@ -51,5 +54,5 @@
             {
                 pFH->iSocket = s;
-                return fh;
+                LIBCLOG_RETURN_INT(fh);
             }
             else
@@ -61,5 +64,5 @@
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/bind.c
===================================================================
--- trunk/src/emx/src/libsocket/bind.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/bind.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int bind(int socket, const struct sockaddr *addr, int addrlen)
 {
+    LIBCLOG_ENTER("socket=%d addr=%p addrlen=%d\n", socket, addr, addrlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_bind(pFHSocket->iSocket, addr, addrlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/connect.c
===================================================================
--- trunk/src/emx/src/libsocket/connect.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/connect.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int connect(int socket, const struct sockaddr *addr, int addrlen)
 {
+    LIBCLOG_ENTER("socket=%d addr=%p addrlen=%d\n", socket, addr, addrlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_connect(pFHSocket->iSocket, addr, addrlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/getpeername.c
===================================================================
--- trunk/src/emx/src/libsocket/getpeername.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/getpeername.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int getpeername(int socket, struct sockaddr *addr, int *addrlen)
 {
+    LIBCLOG_ENTER("socket=%d addr=%p addrlen=%d\n", socket, addr, addrlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_getpeername(pFHSocket->iSocket, addr, addrlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/getsockname.c
===================================================================
--- trunk/src/emx/src/libsocket/getsockname.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/getsockname.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int getsockname(int socket, struct sockaddr *addr, int *addrlen)
 {
+    LIBCLOG_ENTER("socket=%d addr=%p addrlen=%d\n", socket, addr, addrlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_getsockname(pFHSocket->iSocket, addr, addrlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/getsockopt.c
===================================================================
--- trunk/src/emx/src/libsocket/getsockopt.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/getsockopt.c	(revision 1173)
@@ -33,8 +33,11 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int getsockopt(int socket, int level, int optname, void *optval, int *optlen)
 {
+    LIBCLOG_ENTER("socket=%d level=%#x optname=%#x optval=%p optlen=%d\n",
+                  socket, level, optname, optval, optlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +46,9 @@
         rc = __libsocket_getsockopt(pFHSocket->iSocket, level, optname, optval, optlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/herror.c
===================================================================
--- trunk/src/emx/src/libsocket/herror.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/herror.c	(revision 1173)
@@ -9,4 +9,5 @@
 #include <sys/types.h>
 #include <netdb.h>
+#include <emx/libclog.h>
 
 extern int h_errno;
@@ -14,4 +15,5 @@
 void TCPCALL herror(const char *string)
 {
+  LIBCLOG_ENTER("string=%p={%25s}\n", string, string);
   int e = h_errno;
   const char *msg;
@@ -41,7 +43,8 @@
     default:
       fprintf (stderr, "Unknown error %d\n", e);
-      return;
+      LIBCLOG_RETURN_VOID();
     }
   fputs (msg, stderr);
   fputc ('\n', stderr);
+  LIBCLOG_RETURN_VOID();
 }
Index: trunk/src/emx/src/libsocket/listen.c
===================================================================
--- trunk/src/emx/src/libsocket/listen.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/listen.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int listen(int socket, int backlog)
 {
+    LIBCLOG_ENTER("socket=%d backlog=%d\n", socket, backlog);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_listen(pFHSocket->iSocket, backlog);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/os2_ioctl.c
===================================================================
--- trunk/src/emx/src/libsocket/os2_ioctl.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/os2_ioctl.c	(revision 1173)
@@ -34,4 +34,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -42,4 +43,5 @@
 #endif
 {
+    LIBCLOG_ENTER("socket=%d request=%#x arg=%p len_arg=%d\n", socket, (int)request, arg, len_arg);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -52,8 +54,8 @@
 #endif
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/os2_select.c
===================================================================
--- trunk/src/emx/src/libsocket/os2_select.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/os2_select.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int os2_select(int *s, int nreads, int nwrites, int nexcepts, long timeout)
 {
+    LIBCLOG_ENTER("s=%p nreads=%d nwrites=%d nexcepts=%d timeout=%ld\n", s, nreads, nwrites, nexcepts, timeout);
     int     cSockets;
     int    *aSockets;
@@ -50,5 +52,5 @@
     {
         __libsocket_setErrno(ENOMEM);
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
     for (i = 0; i < cSockets; i++)
@@ -58,5 +60,5 @@
         {
             __libsocket_setErrno(EBADF);
-            return -1;
+            LIBCLOG_RETURN_INT(-1);
         }
         aSockets[i] = pFHSocket->iSocket;
@@ -68,7 +70,7 @@
     rc = __libsocket_os2_select(aSockets, nreads, nwrites, nexcepts, timeout);
     if (rc >= 0)
-        return rc;
+        LIBCLOG_RETURN_INT(rc);
     __libsocket_setLibcErrno();
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/recv.c
===================================================================
--- trunk/src/emx/src/libsocket/recv.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/recv.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int recv(int socket, void *buf, int len, int flags)
 {
+    LIBCLOG_ENTER("socket=%d buf=%p len=%d flags=%#x\n", socket, buf, len, flags);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_recv(pFHSocket->iSocket, buf, len, flags);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/recvfrom.c
===================================================================
--- trunk/src/emx/src/libsocket/recvfrom.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/recvfrom.c	(revision 1173)
@@ -33,8 +33,11 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int recvfrom(int socket, void *buf, int len, int flags, struct sockaddr *from, int *fromlen)
 {
+    LIBCLOG_ENTER("socket=%d buf=%p len=%d flags=%#x from=%p from=%d\n",
+                  socket, buf, len, flags, from, fromlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +46,9 @@
         rc = __libsocket_recvfrom(pFHSocket->iSocket, buf, len, flags, from, fromlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/recvmsg.c
===================================================================
--- trunk/src/emx/src/libsocket/recvmsg.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/recvmsg.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int recvmsg(int socket, struct msghdr *msg, int flags)
 {
+    LIBCLOG_ENTER("socket=%d msg=%p flags=%d\n", socket, msg, flags);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_recvmsg(pFHSocket->iSocket, msg, flags);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/send.c
===================================================================
--- trunk/src/emx/src/libsocket/send.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/send.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int send(int socket, const void *buf, int len, int flags)
 {
+    LIBCLOG_ENTER("socket=%d buf=%p len=%d flags=%#x\n", socket, buf, len, flags);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_send(pFHSocket->iSocket, buf, len, flags);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/sendmsg.c
===================================================================
--- trunk/src/emx/src/libsocket/sendmsg.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/sendmsg.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int sendmsg(int socket, const struct msghdr *msg, int flags)
 {
+    LIBCLOG_ENTER("socket=%d msg=%p flags=%#x\n", socket, msg, flags);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_sendmsg(pFHSocket->iSocket, msg, flags);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/sendto.c
===================================================================
--- trunk/src/emx/src/libsocket/sendto.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/sendto.c	(revision 1173)
@@ -33,8 +33,11 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int sendto(int socket, const void *buf, int len, int flags, const struct sockaddr *to, int tolen)
 {
+    LIBCLOG_ENTER("socket=%d buf=%p len=%d flags=%#x to=%p tolen=%p\n",
+                  socket, buf, len, flags, to, tolen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +46,9 @@
         rc = __libsocket_sendto(pFHSocket->iSocket, buf, len, flags, to, tolen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/setsockopt.c
===================================================================
--- trunk/src/emx/src/libsocket/setsockopt.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/setsockopt.c	(revision 1173)
@@ -33,8 +33,11 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int setsockopt(int socket, int level, int optname, const void *optval, int optlen)
 {
+    LIBCLOG_ENTER("socket=%d level=%#x optname=%#x optval=%p optlen=%p\n",
+                  socket, level, optname, optval, optlen);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +46,9 @@
         rc = __libsocket_setsockopt(pFHSocket->iSocket, level, optname, optval, optlen);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/shutdown.c
===================================================================
--- trunk/src/emx/src/libsocket/shutdown.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/shutdown.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int shutdown(int socket, int how)
 {
+    LIBCLOG_ENTER("socket=%d how=%d\n", socket, how);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_shutdown(pFHSocket->iSocket, how);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/so_cancel.c
===================================================================
--- trunk/src/emx/src/libsocket/so_cancel.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/so_cancel.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int so_cancel(int socket)
 {
+    LIBCLOG_ENTER("socket=%d\n", socket);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_so_cancel(pFHSocket->iSocket);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/so_ioctl.c
===================================================================
--- trunk/src/emx/src/libsocket/so_ioctl.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/so_ioctl.c	(revision 1173)
@@ -35,8 +35,10 @@
 #include <sys/ioccom.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int TCPCALL so_ioctl(int socket, unsigned long request, ...)
 {
+    LIBCLOG_ENTER("socket=%d request=%#lx arg=%#lx\n", socket, request, (&request)[1]);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -44,10 +46,12 @@
         va_list args;
         int     iArg;
+        int     rc;
         va_start(args, request);
         iArg = va_arg(args, int);
         va_end(args);
-        return ioctl(socket, request, iArg);
+        rc = ioctl(socket, request, iArg);
+        LIBCLOG_RETURN_INT(rc);
     }
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/so_readv.c
===================================================================
--- trunk/src/emx/src/libsocket/so_readv.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/so_readv.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 ssize_t so_readv(int socket, struct iovec *iov, int iovcnt)
 {
+    LIBCLOG_ENTER("socket=%d iov=%p iovcnt=%d\n", socket, iov, iovcnt);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_so_readv(pFHSocket->iSocket, iov, iovcnt);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/so_writev.c
===================================================================
--- trunk/src/emx/src/libsocket/so_writev.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/so_writev.c	(revision 1173)
@@ -33,8 +33,10 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 ssize_t so_writev(int socket, struct iovec *iov, int iovcnt)
 {
+    LIBCLOG_ENTER("socket=%d iov=%p iovcnt=%d\n", socket, iov, iovcnt);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -43,9 +45,9 @@
         rc = __libsocket_so_writev(pFHSocket->iSocket, iov, iovcnt);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/soabort.c
===================================================================
--- trunk/src/emx/src/libsocket/soabort.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/soabort.c	(revision 1173)
@@ -33,4 +33,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -40,4 +41,5 @@
 int soabort(int socket)
 {
+    LIBCLOG_ENTER("socket=%d\n", socket);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
@@ -46,9 +48,9 @@
         rc = __libsocket_soabort(pFHSocket->iSocket);
         if (rc >= 0)
-            return rc;
+            LIBCLOG_RETURN_INT(rc);
         __libsocket_setLibcErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/sock_errno.c
===================================================================
--- trunk/src/emx/src/libsocket/sock_errno.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/sock_errno.c	(revision 1173)
@@ -18,4 +18,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -30,9 +31,10 @@
 int _System sock_errno(void)
 {
+    LIBCLOG_ENTER("void\n");
     /* get the OS/2 error. */
     int err = os2_sock_errno();
     if (err > EOS2_TCPIP_OFFSET && err < EOS2_TCPIP_OFFSET + 1000)
         err -= EOS2_TCPIP_OFFSET;
-    return err;
+    LIBCLOG_RETURN_INT(err);
 }
 
Index: trunk/src/emx/src/libsocket/socket.c
===================================================================
--- trunk/src/emx/src/libsocket/socket.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/socket.c	(revision 1173)
@@ -33,4 +33,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -38,4 +39,5 @@
 int socket(int af, int type, int protocol)
 {
+    LIBCLOG_ENTER("af=%d type=%d protocol=%d\n", af, type, protocol);
     int s;
 
@@ -50,5 +52,5 @@
         {
             pFH->iSocket = s;
-            return fh;
+            LIBCLOG_RETURN_INT(fh);
         }
         else
@@ -59,5 +61,5 @@
         __libsocket_setLibcErrno();
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
Index: trunk/src/emx/src/libsocket/socketops.c
===================================================================
--- trunk/src/emx/src/libsocket/socketops.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/socketops.c	(revision 1173)
@@ -50,4 +50,5 @@
 #include <sys/filio.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -140,10 +141,14 @@
 static int __libsocket_ops_Close(PLIBCFH pFH, int fh)
 {
+    LIBCLOG_ENTER("pFH=%p fh=%d\n", pFH, fh);
     PLIBCSOCKETFH   pSocketFH = (PLIBCSOCKETFH)pFH;
     int             rc;
     rc = __libsocket_soclose(pSocketFH->iSocket);
     if (rc)
-        return -__libsocket_getSocketErrno();
-    return 0;
+    {
+        rc = -__libsocket_getSocketErrno();
+        LIBCLOG_RETURN_INT(rc);
+    }
+    LIBCLOG_RETURN_INT(0);
 }
 
@@ -160,4 +165,5 @@
 static int __libsocket_ops_Read(PLIBCFH pFH, int fh, void *pvBuf, size_t cbRead, size_t *pcbRead)
 {
+    LIBCLOG_ENTER("pFH=%p fh=%d pvBuf=%p cbRead=%d pcbRead=%p\n", pFH, fh, pvBuf, cbRead, pcbRead);
     PLIBCSOCKETFH   pSocketFH = (PLIBCSOCKETFH)pFH;
     int             rc;
@@ -167,9 +173,10 @@
     {
         *pcbRead = 0;
-        return -__libsocket_getSocketErrno();
+        rc = -__libsocket_getSocketErrno();
+        LIBCLOG_RETURN_INT(rc);
     }
 
     *pcbRead = rc;
-    return 0;
+    LIBCLOG_RETURN_INT(0);
 }
 
@@ -185,4 +192,5 @@
 static int __libsocket_ops_Write(PLIBCFH pFH, int fh, const void *pvBuf, size_t cbWrite, size_t *pcbWritten)
 {
+    LIBCLOG_ENTER("pFH=%p fh=%d pvBuf=%p cbWrite=%d pcbWritten=%p\n", pFH, fh, pvBuf, cbWrite, pcbWritten);
     PLIBCSOCKETFH   pSocketFH = (PLIBCSOCKETFH)pFH;
     int             rc;
@@ -192,9 +200,10 @@
     {
         *pcbWritten = 0;
-        return -__libsocket_getSocketErrno();
+        rc = -__libsocket_getSocketErrno();
+        LIBCLOG_RETURN_INT(rc);
     }
 
     *pcbWritten = rc;
-    return 0;
+    LIBCLOG_RETURN_INT(0);
 }
 
@@ -213,5 +222,6 @@
 static int __libsocket_ops_Duplicate(PLIBCFH pFH, int fh, int *pfhNew)
 {
-    return -ENOSYS;
+    LIBCLOG_ENTER("pFH=%p fh=%d pfhNew=%p\n", pFH, fh, pfhNew);
+    LIBCLOG_RETURN_INT(-ENOSYS);
 }
 
@@ -230,6 +240,7 @@
 static int __libsocket_ops_FileControl(PLIBCFH pFH, int fh, int iIOControl, int iArg, int *prc)
 {
+    LIBCLOG_ENTER("pFH=%p fh=%d iIOControl=%#x iArg=%#x prc=%p\n", pFH, fh, iIOControl, iArg, prc);
     /*PLIBCSOCKETFH   pSocketFH = (PLIBCSOCKETFH)pFH;*/
-    return -ENOSYS;
+    LIBCLOG_RETURN_INT(-ENOSYS);
 }
 
@@ -248,4 +259,5 @@
 static int __libsocket_ops_IOControl(PLIBCFH pFH, int fh, int iIOControl, int iArg, int *prc)
 {
+    LIBCLOG_ENTER("pFH=%p fh=%d iIOControl=%#x iArg=%#x prc=%p\n", pFH, fh, iIOControl, iArg, prc);
     PLIBCSOCKETFH   pSocketFH = (PLIBCSOCKETFH)pFH;
     char           *pchArg = (char *)iArg;
@@ -521,5 +533,5 @@
     {   /*  */
         *prc = -1;
-        return -ENOSYS;
+        LIBCLOG_RETURN_INT(-ENOSYS);
     }
 
@@ -528,8 +540,9 @@
     *prc = rc;
     if (rc < 0)
-        return -__libsocket_getSocketErrno();
-    return 0;
-
-    return -ENOSYS;
+    {
+        rc = -__libsocket_getSocketErrno();
+        LIBCLOG_RETURN_INT(rc);
+    }
+    LIBCLOG_RETURN_INT(0);
 }
 
@@ -551,4 +564,6 @@
 static int __libsocket_ops_Select(int cFHs, struct fd_set *pRead, struct fd_set *pWrite, struct fd_set *pExcept, struct timeval *tv, int *prc)
 {
+    LIBCLOG_ENTER("cFHs=%d pRead=%p pWrite=%p pExcept=%p tv=%p prc=%d\n",
+                  cFHs, pRead, pWrite, pExcept, tv, prc);
     int rc;
     int saved_errno = errno;
@@ -557,5 +572,5 @@
     rc = rc >= 0 ? 0 : -errno;
     errno = saved_errno;
-    return rc;
-}
-
+    LIBCLOG_RETURN_INT(rc);
+}
+
Index: trunk/src/emx/src/libsocket/socketpair.c
===================================================================
--- trunk/src/emx/src/libsocket/socketpair.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/socketpair.c	(revision 1173)
@@ -28,4 +28,5 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
@@ -44,4 +45,5 @@
 int     TCPCALL socketpair(int af, int type, int flags, int *osfd)
 {
+    LIBCLOG_ENTER("af=%d type=%p flags=%#x osfd=%p\n", af, type, flags, osfd);
 #ifdef TCPV40HDRS
     int     rc;
@@ -56,10 +58,10 @@
     {
         socket(0xfffdadb, type, 0); /*EAFNOSUPPORT;*/
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
     if (type != SOCK_STREAM)
     {
         socket(af, 0x1230fd, 0); /*EPROTOTYPE;*/
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
 
@@ -106,5 +108,5 @@
     osfd[0] = sock1accept;
     osfd[1] = sock2;
-    return 0;
+    LIBCLOG_RETURN_INT(0);
 
 failure:
@@ -115,5 +117,5 @@
     if (sock2 >= 0)
         soclose(sock2);
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 
 #else
@@ -127,5 +129,5 @@
     {
         __libsocket_setLibcErrno();
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
 
@@ -143,5 +145,5 @@
             osfd[0] = fh1;
             osfd[1] = fh2;
-            return 0;
+            LIBCLOG_RETURN_INT(0);
         }
         __libc_FHClose(fh1);
@@ -150,5 +152,5 @@
     __libsocket_soclose(osfd[0]);
     __libsocket_soclose(osfd[1]);
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 #endif
 }
Index: trunk/src/emx/src/libsocket/soclose.c
===================================================================
--- trunk/src/emx/src/libsocket/soclose.c	(revision 1172)
+++ trunk/src/emx/src/libsocket/soclose.c	(revision 1173)
@@ -33,17 +33,19 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
+#include <emx/libclog.h>
 #include "socket.h"
 
 int soclose(int socket)
 {
+    LIBCLOG_ENTER("socket=%d\n", socket);
     PLIBCSOCKETFH   pFHSocket = __libsocket_FH(socket);
     if (pFHSocket)
     {
         if (!__libc_FHClose(socket))
-            return 0;
+            LIBCLOG_RETURN_INT(0);
         __libsocket_setSocketErrno();
     }
 
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
