This is the mail archive of the cygwin 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: Problem with named pipes


On Dec 11 14:42, Ken Brown wrote:
> On 1/8/2016 3:50 PM, Corinna Vinschen wrote:
> > On Dec 25 16:39, Ken Brown wrote:
> >> I've noticed a difference between Cygwin and Linux involving named pipes.  I
> >> don't know if this a bug or simply a difference.
> >>
> >> Consider the following two scripts:
> >> [...]
> >>
> >> The problem disappears if I remove the line "exec 7>foo" from fifo1.sh.  The
> >> problem also disappears if I leave that line in, but change the last line to
> >> "echo blah >&7".
> > 
> > Very tricky problem.  The FIFO code falls over its own feet trying to
> > handle more than one writer (exec 7> is the first, echo blah is the
> > second writer).  Sigh.  This code needs a thorough rewrite...
> 
> Hi Corinna,
> 
> I'm coming back to this thread after three years.  I'd be willing to put in some 
> time working on this, if you could point me in the right direction.  Do you have 
> ideas about what a rewrite of the FIFO code might look like?
> The one idea that I had was that a reader could open several instances of the 
> Windows named pipe, allowing several writers to connect to it simultaneously.  I 
> think that would solve the particular problem I reported (and the similar 
> problem cited by Houder up-thread).  But it would just be a band-aid, and Cygwin 

I think this is not required, as long as at least one instance of the
pipe is available at all times.  Perhaps the unfinished, new AF_UNIX
sockets code can be reused or partially duplicated to implement FIFOs.
The fhandler_socket_unix::accept4 function tries to emulate that
behaviour.  As soon as a client connects, it spawns another pipe
instance and uses that as listener handle, while the previous accepting
pipe handle is now connected with the client and is what gets used for
the new, accepted descriptor.

> FIFOs still wouldn't be POSIX compliant.

Yeah, this is really tricky to get with Windows pipe semantics.  I guess
if the most common scenarios are covered, we're good.

Thanks a lot for looking into that.  Feel free to discuss any and all
implementation details on the developers ML.  I guess it's time to pick
up the AF_UNIX pieces myself next year :}


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature


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