FIFO issues

Ken Brown kbrown@cornell.edu
Tue Sep 20 13:18:01 GMT 2022


On 9/20/2022 2:54 AM, Enrico Forestieri wrote:
> On Mon, Sep 19, 2022 at 07:54:11PM -0400, Ken Brown wrote:
>> Then I guess I'm wrong.  I'm really puzzled, because it seems that none of these
>> platforms agree with POSIX, which says the following in its 'read' documentation:
>>
>>       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.
>>
>> It seems that there's an exception: If no process has ever had the FIFO open for
>> writing since it was opened for reading, then the FIFO is not considered to be
>> at end-of-file.
>>
>> I'll look into fixing this.  But I'd be more confident about it if I could find
>> some documentation of the existing behavior.
> 
> I compared the behavior of read() and select() on 3 different platforms.
> My conclusion is that, actually, read() behaves the same on all of them,
> whereas cygwin differs in the way select() works.

Then I'm even more confused than I was before.  Are you saying that there are 
situations in which read() reports EOF but select() does not report read ready? 
Could you post the code you used for testing?

Thanks.

Ken


More information about the Cygwin mailing list