From 840bb397986fa6914a67e62e25df97e1dd88dc45 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 30 Jun 2009 14:36:11 +0000 Subject: [PATCH] * fhandler.cc (fhandler_base::has_ongoing_io): Accept an argument indicating whether the overlapped event should be tested. (fhandler_base::read_overlapped): Pass is_overlapped state to has_ongoing_io. (fhandler_base::write_overlapped): Ditto. * fhandler.h (fhandler_base::has_ongoing_io): Accommodate argument change. * select.cc (peek_pipe): Ditto. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/fhandler.cc | 8 ++++---- winsup/cygwin/fhandler.h | 2 +- winsup/cygwin/select.cc | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0f9faeaa3..4f2dd8072 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2009-06-30 Christopher Faylor + + * fhandler.cc (fhandler_base::has_ongoing_io): Accept an argument + indicating whether the overlapped event should be tested. + (fhandler_base::read_overlapped): Pass is_overlapped state to + has_ongoing_io. + (fhandler_base::write_overlapped): Ditto. + * fhandler.h (fhandler_base::has_ongoing_io): Accommodate argument + change. + * select.cc (peek_pipe): Ditto. + 2009-06-30 Corinna Vinschen * net.cc (fdsock): Set default socket buffer sizes to 65520. Change diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 650cca9e9..0488374c6 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1764,9 +1764,9 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes, DWORD le } bool __stdcall -fhandler_base::has_ongoing_io () +fhandler_base::has_ongoing_io (bool testit) { - if (get_overlapped () && get_overlapped ()->hEvent + if (testit && get_overlapped () && get_overlapped ()->hEvent && WaitForSingleObject (get_overlapped ()->hEvent, 0) != WAIT_OBJECT_0) { set_errno (EAGAIN); @@ -1781,7 +1781,7 @@ fhandler_base::read_overlapped (void *ptr, size_t& len) DWORD nbytes; while (1) { - if (has_ongoing_io ()) + if (has_ongoing_io (is_nonblocking ())) { nbytes = (DWORD) -1; break; @@ -1801,7 +1801,7 @@ fhandler_base::write_overlapped (const void *ptr, size_t len) DWORD nbytes; while (1) { - if (has_ongoing_io ()) + if (has_ongoing_io (is_nonblocking ())) { nbytes = (DWORD) -1; break; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index a4cc50f56..cc44655b9 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -302,7 +302,7 @@ class fhandler_base virtual char const *ttyname () { return get_name (); } virtual void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); virtual void __stdcall read_overlapped (void *ptr, size_t& len) __attribute__ ((regparm (3))); - virtual bool __stdcall has_ongoing_io () __attribute__ ((regparm (1))); + virtual bool __stdcall has_ongoing_io (bool) __attribute__ ((regparm (2))); virtual int write (const void *ptr, size_t len); virtual int __stdcall write_overlapped (const void *ptr, size_t len); virtual ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1); diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 2b1d6c438..d2fc4eb9c 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -513,7 +513,7 @@ out: else if (fh->get_device () == FH_PIPER) select_printf ("%s, select for write on read end of pipe", fh->get_name ()); - else if (fh->has_ongoing_io ()) + else if (fh->has_ongoing_io (true)) s->write_ready = false; else {