On Tue, Sep 20, 2022 at 06:18:54PM -0700, Ken Brown wrote: > > On 9/20/2022 2:54 AM, Enrico Forestieri wrote: > > > > 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? I simply introduced a timeout for select() such that it returns on any platform. On cygwin, when using "O_RDONLY | O_NONBLOCK" for the input pipe, select() always returns 1, while on all other platforms it returns 0 unless a client actually opens it for writing. As the "if (FD_ISSET(infd, &readfds))" block would not be entered on the other platforms, I replaced it with "if (TRUE)" so that the read() is always executed. In this conditions, the output is the same on all platforms, meaning that the issue is the select() and not the read() call. This is the attached fifocomm-test.c file. -- Enrico