public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Problem with named pipes
Date: Tue, 11 Dec 2018 19:40:00 -0000	[thread overview]
Message-ID: <20181211194027.GG3972@calimero.vinschen.de> (raw)
In-Reply-To: <d5ff7ebb-6fc2-5ce6-e38b-6e6c9113d102@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2018-12-11 19:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-25 21:39 Ken Brown
2016-01-08 20:58 ` Corinna Vinschen
2018-12-11 14:42   ` Ken Brown
2018-12-11 14:57     ` Dan Kegel
2018-12-11 19:40     ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211194027.GG3972@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).