4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 12:59:21 +08:00
Ken Brown 5781871775 Cygwin: select: don't report read ready on a FIFO never opened for writing
According to POSIX and the Linux man page, select(2) is supposed to
report read ready if a file is at EOF.  In the case of a FIFO, this
means that the pipe is empty and there are no writers.  But there
seems to be an undocumented exception, observed on Linux and other
platforms:  If no writer has ever been opened, then select(2) does not
report read ready.  This can happen if a reader is opened with
O_NONBLOCK before any writers have opened.

This commit makes Cygwin consistent with those other platforms by
introducing a special EOF test, fhandler_fifo::select_hit_eof, which
returns false if there's never been a writer opened.

To implement this we use a new variable '_writer_opened' in the FIFO's
shared memory, which is set to 1 the first time a writer opens.  New
methods writer_opened() and set_writer_opened() are used to test and
set this variable.

Addresses: https://cygwin.com/pipermail/cygwin/2022-September/252223.html
2022-10-19 08:17:50 -04:00
..
2022-08-08 18:16:09 +02:00
2022-08-04 20:54:09 +02:00
2022-08-05 12:02:11 +02:00
2021-11-10 20:16:15 -05:00
2022-08-04 22:13:59 +02:00
2022-08-04 22:13:59 +02:00
2022-08-04 20:54:09 +02:00
2021-04-27 16:49:56 +01:00
2022-08-04 22:13:59 +02:00
2022-08-08 18:16:09 +02:00
2021-11-15 19:32:23 -05:00
2022-08-04 15:16:48 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2021-06-26 15:24:27 +01:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00
2022-08-04 22:13:59 +02:00
2022-05-29 17:45:52 -04:00
2022-08-04 22:13:59 +02:00