On Mon, Oct 6, 2014 at 5:08 AM, Dimitris Papastamos <s...@2f30.org> wrote:
> I am using select(2) on a FIFO fd and monitoring
> for readability.  select(2) doesn't return after the writer
> exits.
>
> The same piece of code marks the fd as readable on Linux.
> Not sure which behaviour is correct though.

The Linux behavior is correct:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html:
"A descriptor shall be considered ready for reading when a call to an
input function with O_NONBLOCK clear would not block, whether or not
the function would transfer data successfully. (The function might
return data, an end-of-file indication, or an error other than one
indicating that it is blocked, and in each of these cases the
descriptor shall be considered ready for reading.)"

http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html:
"When attempting to read from an empty pipe or FIFO: [...] If no
process has the pipe open for writing, read() shall return 0 to
indicate end-of-file."

Reply via email to