This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fhandler_socket::dup


At 04:20 PM 3/11/2003 +0100, Corinna Vinschen wrote:

>> > I'm seriously concidering to remove all the fixup_before/fixup_after
>> > from fhandler_socket::dup() and just call fhandler_base::dup() on
>> > NT systems.

Corinna,

I like that and I have pushed the logic to also do it on Win9X, without
apparent bad effects. I just delivered 140 e-mails from a WinME to an exim 
server on Win98, ran inetd, ssh, etc... I also tried duping a socket after a 
fork, it worked fine.

The change to the fixup_before/after approach was in Oct 2000. I didn't find
any explanation of the reason for the change in the mail archives around that 
date.

There is no need to include this patch in 1.3.21. I'd like to test it for
a longer period. I hope there are others out there still running the cvs
version and the snapshots on Win9X.

Pierre


2003-03-12  Pierre Humblet  <pierre dot humblet at ieee dot org>

	* fhandler_socket.cc (fhandler_socket::dup): Always use DuplicateHandle.


Index: fhandler_socket.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_socket.cc,v
retrieving revision 1.88
diff -u -p -r1.88 fhandler_socket.cc
--- fhandler_socket.cc  11 Mar 2003 16:49:58 -0000      1.88
+++ fhandler_socket.cc  12 Mar 2003 04:10:22 -0000
@@ -381,25 +381,10 @@ fhandler_socket::dup (fhandler_base *chi
   debug_printf ("here");
   fhandler_socket *fhs = (fhandler_socket *) child;
   fhs->addr_family = addr_family;
-  fhs->set_io_handle (get_io_handle ());
   if (get_addr_family () == AF_LOCAL)
     fhs->set_sun_path (get_sun_path ());
   fhs->set_socket_type (get_socket_type ());
 
-  /* Using WinSock2 methods for dup'ing sockets seem to collide
-     with user context switches under... some... conditions.  So we
-     drop this for NT systems at all and return to the good ol'
-     DuplicateHandle way of life.  This worked fine all the time on
-     NT anyway and it's even a bit faster. */
-  if (!wincap.has_security ())
-    {
-      fhs->fixup_before_fork_exec (GetCurrentProcessId ());
-      if (winsock2_active)
-       {
-         fhs->fixup_after_fork (hMainProc);
-         return get_io_handle () == (HANDLE) INVALID_SOCKET;
-       }
-    }
   /* We don't call fhandler_base::dup here since that requires to
      have winsock called from fhandler_base and it creates only
      inheritable sockets which is wrong for winsock2. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]