* fhandler.cc (fhandler_base::dup): Call setup_overlapped unconditionally.

(fhandler_base::fork_fixup): Ditto.
(fhandler_base::fixup_after_fork): Ditto.
(fhandler_base::fixup_after_exec): Ditto.
(fhandler_base_overlapped::setup_overlapped): Move to this class from
fhandler_base.
(handler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::wait_overlapped): Ditto.  Track when we expect
pending I/O.
(fhandler_base_overlapped::read_overlapped): Move to this class from
fhandler_base.  Return error if ongoing I/O.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Semi-reinstate previous function.
* fhandler.h (fhandler_base::wait_overlapped): Move to fhandler_base_overlapped
class.
(fhandler_base::write_overlapped): Ditto.
(fhandler_base::get_overlapped): Ditto.
(fhandler_base::get_overlapped_buffer): Ditto.
(fhandler_base_overlapped): New class.
(fhandler_pipe): Inherit from fhandler_base_overlapped.  Remove overlapped
stuff as a result.
(fhandler_fifo): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Initialize fhandler_base_overlapped.
(pipe): Put a descriptive name in the fhandler.
This commit is contained in:
Christopher Faylor
2010-03-31 04:26:11 +00:00
parent d8b4cbe896
commit 2aeef06579
4 changed files with 103 additions and 47 deletions

View File

@@ -24,7 +24,7 @@ details. */
#include "shared_info.h"
fhandler_pipe::fhandler_pipe ()
: fhandler_base (), popen_pid (0), overlapped (NULL)
: fhandler_base_overlapped (), popen_pid (0)
{
need_fork_fixup (true);
uninterruptible_io (true);
@@ -378,6 +378,11 @@ pipe (int filedes[2])
{
cygheap_fdnew fdin;
cygheap_fdnew fdout (fdin, false);
char buf[sizeof ("/dev/fd/pipe:[2147483647]")];
__small_sprintf (buf, "/dev/fd/pipe:[%d]", (int) fdin);
fhs[0]->pc.set_normalized_path (buf);
__small_sprintf (buf, "pipe:[%d]", (int) fdout);
fhs[1]->pc.set_normalized_path (buf);
fdin = fhs[0];
fdout = fhs[1];
filedes[0] = fdin;