Cygwin: pipe: improve writing when pipe buffer is almost full
commit170e6badb621fc07d236e540c693ea5deb53fc27
authorCorinna Vinschen <corinna@vinschen.de>
Sun, 18 Aug 2024 20:07:16 +0000 (18 22:07 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Sun, 18 Aug 2024 20:07:16 +0000 (18 22:07 +0200)
tree3278c4bdcd11c4f317e4035c2a9aece5df12f431
parent1c5f4dcdc5ec3344e3fd741c43fa359d0e1323c0
Cygwin: pipe: improve writing when pipe buffer is almost full

So far fhandler_pipe_fifo::raw_write always returns -1/EINTR
if a signal arrived.  Linux does not do that if there's still
space left in the pipe buffer.

The Linux buffer handling can't be emulated by Cygwin, but we
can do something similar which makes it much more likely to still
write successfully even if the buffer is almost full.

Utilize pipe_data_available to return valid pipe buffer usage
to raw_write, allowing a more sophisticated way to fill the
buffer while maintaining comaptibility with non-Cygwin pipes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/fhandler/pipe.cc
winsup/cygwin/local_includes/select.h
winsup/cygwin/select.cc