Hangs on connect to UNIX socket being listened on in the same process (was: Cygwin hanging in pselect)

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Jan 13 08:42:00 GMT 2017

On Jan 12 16:54, Michael Enright wrote:
> On Thu, Jan 12, 2017 at 2:13 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > Step 3:
> >
> >   If we did it really intelligent, maybe we finally also have a method
> >   to implement descriptor passing.  Finally.  After all these years.
> >
> > And maybe, we should not actually use the socket itself to exchange
> > the information but rather create some kind of side-channle for that.
> >
> > Especially in terms of step 3, I'm mulling over this for years now
> > and always something else got in the way and had to be done first.
> >
> >
> I made a program that needed to pass windows HANDLEs between processes
> and so that receiving process could access the shared memory
> represented by the HANDLEs. I was emulating facilities many programs
> implement using send_msg, but I was using Windows (named?) pipes. It
> felt a lot like what you need for send_msg, and it required newer
> Windows APIs. So by doing the crazy thing of completely rewriting your
> AF_UNIX sockets you could "easily" add descriptor passing.

/me spilled her coffee reading the word "easily".

I'm aware that named pipes have a facility to switch the user context,
which helps to handle the descriptor duplication.  I thought about this,
too, but it's really a lot of work since it doesn't fit well into the
current fhandler layout.

I'm not generally opposed to split off AF_LOCAL sockets from the generic
socket fhandler and rewrite it completely, but it took a long time
getting sockets to behave mostly POSIXy and I fear we introduce a
completely new set of POSIX incompatibilies which take another long time
to iron out.  That's why I suggested to use an additional named pipe
per AF_LOCAL socket as a side-channel.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170113/8cf1b587/attachment.sig>

More information about the Cygwin mailing list