bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: poll() emulation in git


From: Joachim Schmitz
Subject: RE: poll() emulation in git
Date: Wed, 5 Sep 2012 15:36:54 +0200

> From: Joachim Schmitz [mailto:address@hidden
> Sent: Wednesday, September 05, 2012 2:58 PM
> To: 'Paolo Bonzini'
> Cc: 'Junio C Hamano'; 'address@hidden'; 'Erik Faye-Lund'; 'address@hidden'
> Subject: RE: poll() emulation in git
> 
> > From: Paolo Bonzini [mailto:address@hidden On Behalf Of Paolo Bonzini
> > Sent: Wednesday, September 05, 2012 2:05 PM
> > To: Joachim Schmitz
> > Cc: 'Junio C Hamano'; address@hidden; 'Erik Faye-Lund'; address@hidden
> > Subject: Re: poll() emulation in git
> >
> > Il 05/09/2012 13:24, Joachim Schmitz ha scritto:
> > > However: this poll implementation, while compiling OK, doesn't work 
> > > properly.
> > > Because it uses recv(...,MSG_PEEK), it works on sockets only (returns 
> > > ENOTSOCK on anything else), while the real poll() works
on all
> > > kind if file descriptors, at least that is my understanding.
> >
> > Actually recv(...,MSG_PEEK) on most Unix variants works on non-sockets
> > too.  The trick is taken from GNU Pth in turn.
> >
> > > Here on HP NonStop, when being connected via an non-interactive SSH, we 
> > > get a set of pipes (stdin, stdout, stderr) instead of
a
> > > socket to talk to, so the poll() just hangs/loops.
> >
> > Does your system have a working FIONREAD ioctl for pipes?
> 
> It does have FIONREAD ioctl. Whether it works properly is to be determined...
> I'll test if you could show me how?

Oh, now I see what you aimed at, but no, that Mac OS X method doesn't work for 
me, I tried (at least I think I did).

And <sys/ioctl.h> has
/*
 * Normal IOCTL's supported by the socket interface
 */
#define FIONREAD        _IOR(0, 8, _ioctl_int)       /* Num of bytes to read */
#define FIONBIO         _IOW(0, 9, _ioctl_int)       /* Non-blocking I/O     */

So these seem to be supported on sockets only, I guess.
And indeed the man pages for ioctl confirms:

          Valid values for the request parameter for AF_INET or
          AF_INET6 sockets are:


          FIONREAD  Gets the number of bytes available for reading and
                    stores it at the int pointed at by arg.


So not even AF_UNIX sockets, not to mention pipes...

Bye, Jojo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]