delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/04/13:49:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 4 Jun 2002 12:44:58 -0400 (EDT)
From: David E Euresti <davie AT MIT DOT EDU>
To: <cygwin AT cygwin DOT com>
Subject: Re: Socket Handles duplicated twice after fork
Message-ID: <Pine.GSO.4.30L.0206041234020.20970-100000@scrubbing-bubbles.mit.edu>
MIME-Version: 1.0

Hello,

Corinna says:

>The handles are only inherited if they are explicitly marked as
>inheritable.  The Cygwin code lives for a long time now under the
>assumption that sockets aren't inheritable if they aren't
>explicitely set to be inheritable (see net.cc, fdsock()).

Hmmm.  I think there's a wrong assumption here as you mentioned.
MSDN says,
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q150523

Under Windows NT and Windows 2000, socket handles are inheritable by
default. This feature is often used by a process that wants to spawn a
child process and have the child process interact with the remote
application on the other end of the connection.

Windows 9x differs from Windows NT/Windows 2000 in the following manner:
Socket handles are not inheritable when created. To ensure that a child
process can obtain and use a socket handle created in the parent, the
handle must be explicitly duplicated using the Win32 API DuplicateHandle.
Set the bInheritHandle parameter of the API to TRUE.
...

Therefore, on Win2k, you are letting them be inherited.  So the probably
the right solution is to always inherit, or to always duplicate, but never
do both.  Although I don't know maybe we want to inherit in Win2k and
Duplicate in Win9x.  (I hate this whole windows versions things)



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019