Current-Users archive

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

Re: pipe read returning EAGAIN



On Mon, Feb 08, 2016 at 11:47:44AM +0100, Manuel Bouyer wrote:
> 
> Now the question is why is the POLLIN flag set when there's no data to read ?
> zeroing out revents before callin poll(2) doens't help.
> 
> The man page says:
>      This implementation differs from the historical one in that a given file
>      descriptor may not cause poll() to return with an error.  In cases where
>      this would have happened in the historical implementation (e.g. trying to
>      poll a revoke(2)d descriptor), this implementation instead copies the
>      events bitmask to the revents bitmask.  Attempting to perform I/O on this
>      descriptor will then return an error.  This behaviour is believed to be
>      more useful.

That sounds broken.
I think POLLERR should be set after revoke().
However, nothing in the pollfd[] array should cause the poll()
call itself to fail.

> Does it do so if the file descriptor's error is EAGAIN ?
> If so that's no very usefull ...

You are confused, that'll be for errors looking up the relevant driver.
Any error from a previous system call is not remembered.
(or better not be).

It look as though the poll support for pipes is somehow returning
'readable' when no data is available.

Of course there might be some uninitialised memory lurking.

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index