tech-kern archive

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

Re: read side of pipe and poll() events



Fri, Feb 19, 2010 at 05:54:30PM +0000, Iain Hibbert:
> On Fri, 19 Feb 2010, john heasley wrote:
> 
> > poll(2) reads:
> >
> >      POLLHUP        The device or socket has been disconnected.  This flag 
> > is
> >                     always checked, even if not present in the events 
> > bitmask.
> >                     Note that POLLHUP and POLLOUT should never be present in
> >                     the revents bitmask at the same time.  If the remote end
> >                     of a socket is closed, poll() returns a POLLIN event,
> >                     rather than a POLLHUP.
> >
> > I believe, and the pipe_poll() seems to confirm, that POLLIN and POLLHUP
> > are NOT mutually exclusive in the case of the read side of a pipe reaching
> > EOF.  That both, and POLLRDNORM if requested, are set.  Which is correct?
> 
> I'm not sure what you are asking. The above paragraph doesn't mention
> POLLIN wrt pipes. It does say that when a *socket* is closed from the
> remote end, you will get a POLLIN rather than POLLHUP.
> 
> pipe != socket && in != out ?

good point; i didn't think of the two (nor device) differently.  but, why
should they be different?  SuSv3 doesn't mention socket either.  Its just
a file descriptor though; shouldn't it be consistent?


Home | Main Index | Thread Index | Old Index