fhandler_pipe is currently the only class derived from fhandler_base_overlapped. This patch series rewrites parts of fhandler_pipe so that it can be derived from fhandler_base instead. We can then simplify the code by removing fhandler_base_overlapped.
In particular, this gets rid of the peculiar situation in which a non-blocking write can return with I/O pending, leading to the ugliness in fhandler_base_overlapped::close. I've marked these patches as drafts because I've undoubtedly overlooked some things. Also, I haven't systematically done any regression tests. I have, however, run all the sample pipe programs in Kerrisk's book "The Linux Programming Interface: Linux and UNIX System Programming Handbook". I've also run emacs-X11, gdb, git, make, etc., currently without problems, except perhaps for a timerfd problem that I think is unrelated to my patches (http://www.cygwin.org/ml/cygwin/2019-06/msg00096.html). v2: Fix some errors in the handling of signals that arrive during raw_read or raw_write. Ken Brown (6): Cygwin: fhandler_pipe: derive from fhandler_base Cygwin: fhandler_pipe: add raw_read and raw_write Cygwin: fhandler_pipe: control blocking mode of the Windows pipe Cygwin: fhandler_pipe: fix permission problem Cygwin: remove the fhandler_base_overlapped class Cygwin: add fhandler_base::npfs_handle winsup/cygwin/fhandler.cc | 395 ++----------------------- winsup/cygwin/fhandler.h | 90 +----- winsup/cygwin/fhandler_fifo.cc | 30 -- winsup/cygwin/fhandler_pipe.cc | 396 +++++++++++++++++++++++++- winsup/cygwin/fhandler_socket_unix.cc | 30 -- winsup/cygwin/syscalls.cc | 1 - 6 files changed, 422 insertions(+), 520 deletions(-) -- 2.21.0