[svn] w32pth - r3 - trunk

svn author wk cvs at cvs.gnupg.org
Tue Jun 12 15:41:20 CEST 2007


Author: wk
Date: 2007-06-12 15:40:50 +0200 (Tue, 12 Jun 2007)
New Revision: 3

Modified:
   trunk/README
   trunk/libw32pth.def
   trunk/pth.h
   trunk/w32-pth.c
Log:
New functions.


Modified: trunk/README
===================================================================
--- trunk/README	2007-05-31 10:20:37 UTC (rev 2)
+++ trunk/README	2007-06-12 13:40:50 UTC (rev 3)
@@ -8,3 +8,9 @@
 the behaviour of PTH.
 
 It is currently limited to what GnuPG 2.0 requires.
+
+
+Thisng we need to implement:
+
+  pth_select_ev - EV is currently ignored.
+

Modified: trunk/libw32pth.def
===================================================================
--- trunk/libw32pth.def	2007-05-31 10:20:37 UTC (rev 2)
+++ trunk/libw32pth.def	2007-06-12 13:40:50 UTC (rev 3)
@@ -57,3 +57,8 @@
       pth_event_occurred  @30
       pth_event_concat  @31
       pth_event  @32
+
+      pth_select_ev  @33
+      pth_sigmask  @34
+        
+

Modified: trunk/pth.h
===================================================================
--- trunk/pth.h	2007-05-31 10:20:37 UTC (rev 2)
+++ trunk/pth.h	2007-06-12 13:40:50 UTC (rev 3)
@@ -38,11 +38,24 @@
                          heavyweight - may be we should factor such
                          code out to a second header and adjust all
                          user files to include it only if required. */ 
+#include <sys/types.h> /* For sigset_t. */
 
 #ifndef W32_PTH_HANDLE_INTERNAL
 #define W32_PTH_HANDLE_INTERNAL  int
 #endif
 
+/* We need to define value for the how argument of pth_sigmask.  This
+   is required because Mingw does not yet define sigprocmask.  We use
+   an enum to error out if Mingw eventually defines them.  Also define
+   the sigset_t. */
+#ifdef __MINGW32__
+enum 
+  {
+    SIG_BLOCK = 0,
+    SIG_UNBLOCK = 1,
+    SIG_SETMASK = 2
+  };
+#endif /*__MINGW32__*/
 
 /* Filedescriptor blocking modes.  */
 enum
@@ -197,6 +210,8 @@
 
 int pth_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
 		const struct timeval *timeout);
+int pth_select_ev (int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
+                   const struct timeval * timeout, pth_event_t ev_extra);
 
 int pth_accept (int fd, struct sockaddr *addr, int *addrlen);
 int pth_accept_ev (int fd, struct sockaddr *addr, int *addrlen,
@@ -236,7 +251,10 @@
 pth_event_t pth_event (unsigned long spec, ...);
 
 
+int pth_sigmask (int how, const sigset_t *set, sigset_t *old);
 
+
+
 /*-- pth_util.c --*/
 
 /* void sigemptyset (struct sigset_s * ss); */

Modified: trunk/w32-pth.c
===================================================================
--- trunk/w32-pth.c	2007-05-31 10:20:37 UTC (rev 2)
+++ trunk/w32-pth.c	2007-06-12 13:40:50 UTC (rev 3)
@@ -321,6 +321,17 @@
       else
         n = (int)nwrite;
     }
+  else if (n == -1)
+    {
+      DWORD nwrite;
+      char strerr[256];
+
+      if (DBG_ERROR)
+        fprintf (stderr, "%s: pth_write(%d) failed in send: %s\n",
+                 log_get_prefix (NULL), fd,
+                 w32_strerror (strerr, sizeof strerr));
+      n = -1;
+    }
   leave_pth (__FUNCTION__);
   return n;
 }
@@ -341,6 +352,20 @@
 
 
 int
+pth_select_ev (int nfds, fd_set * rfds, fd_set * wfds, fd_set * efds,
+               const struct timeval * timeout, pth_event_t ev_extra)
+{
+  int n;
+
+  implicit_init ();
+  enter_pth (__FUNCTION__);
+  n = select (nfds, rfds, wfds, efds, timeout);
+  leave_pth (__FUNCTION__);
+  return n;
+}
+
+
+int
 pth_fdmode (int fd, int mode)
 {
   unsigned long val;
@@ -662,7 +687,7 @@
      store the thread's handle in the context structure.  We need to
      do this to be able to close the handle from the launch helper. 
 
-     FIXME: We should no use th W32's Thread handle directly but keep
+     FIXME: We should not use W32's thread handle directly but keep
      our own thread control structure.  CTX may be used for that.  */
   if (DBG_INFO)
     fprintf (stderr, "%s: do_pth_spawn creating thread ...\n",
@@ -1380,8 +1405,15 @@
 }
 
 
+int
+pth_sigmask (int how, const sigset_t *set, sigset_t *old)
+{
 
+  return 0;
+}
 
+
+
 
 /* 
    Some simple tests.  




More information about the Gnupg-commits mailing list