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: Workaround patch for MS CLOSE_WAIT bug


Corinna Vinschen wrote:

> Sorry if I'm dense but... shouldn't the new FD_SETCF functionality
> allow to do the "right thing" without adding the oldsocks variable
> at all?!?  You wrote about the disadvantage that the child inherits
> that array...

The oldsocks array is needed in the parent because the MS bug
precisely requires the last close() on a socket to be done by 
the parent, after all other processes referencing the socket 
are gone (*). 

It's true that the oldsocks array is not needed in the child.
Is there a way  to declare a variable "NO_COPY" in an application?
However the oldsocks array is just a an array of integers. The child
can't (and won't try anyway) make use of them because the underlying 
handles have not been duplicated. 

(*) My example code assumes that the child has not created detached 
processes that keep accessing the socket after the child has
exited (but exec() chains are OK). 
Is that the case for applications created by inetd & sshd? 
If this assumption is not true, then shutdown() can't be called 
in the parent and CLOSE_WAIT may still occur, albeit at a reduced 
frequency [probably]. 
 
Pierre


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