Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-06-14 09:38:55 +0400
committerChristopher Faylor <me@cgf.cx>2009-06-14 09:38:55 +0400
commit6a712635dd1de131634c5db1cd5b9221a6544ec6 (patch)
tree2b5b0975af5d2601d1d6e1ef16ff487c03b77715
parent792c564b27fc4b79f2e2936acc8e09ec3d1e7f39 (diff)
* fhandler.cc (fhandler_base::wait_overlapped): Honor nonblocking flag for
writes. Don't reset event handle when we see a ERROR_IO_PENDING. * sigproc.cc (stopped_or_terminated): Use bool constants for consistency. * wait.cc (wait4): Remove nonsensical comment.
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/fhandler.cc12
-rw-r--r--winsup/cygwin/sigproc.cc4
-rw-r--r--winsup/cygwin/wait.cc2
4 files changed, 21 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 55ecac0fc..da662b020 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+2009-06-14 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * fhandler.cc (fhandler_base::wait_overlapped): Honor nonblocking flag
+ for writes. Don't reset event handle when we see a ERROR_IO_PENDING.
+
+ * sigproc.cc (stopped_or_terminated): Use bool constants for
+ consistency.
+
+ * wait.cc (wait4): Remove nonsensical comment.
+
2009-06-13 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::recv_internal): Set namelen
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index ec0d6d021..0d499ba9c 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1684,8 +1684,13 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
int res = 0;
DWORD err;
- if (inres || ((err = GetLastError ()) == ERROR_IO_PENDING))
- {
+ if (is_nonblocking ())
+ {
+ err = GetLastError ();
+ res = inres;
+ }
+ else if (inres || ((err = GetLastError ()) == ERROR_IO_PENDING))
+ {
#ifdef DEBUGGING
if (!get_overlapped ())
system_printf ("get_overlapped is zero?");
@@ -1745,7 +1750,8 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
app. Sigh.). Must do this after WFMO and GetOverlappedResult or suffer
occasional sporadic problems:
http://cygwin.com/ml/cygwin/2008-08/msg00511.html */
- ResetEvent (get_overlapped ()->hEvent);
+ if (err != ERROR_IO_PENDING)
+ ResetEvent (get_overlapped ()->hEvent);
if (writing && (err == ERROR_NO_DATA || err == ERROR_BROKEN_PIPE))
raise (SIGPIPE);
return res;
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 34e4c53a4..e21e09feb 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1045,13 +1045,13 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child)
might_match = (w->pid == child->pid);
if (!might_match)
- return 0;
+ return false;
int terminated;
if (!((terminated = (child->process_state == PID_EXITED)) ||
((w->options & WUNTRACED) && child->stopsig)))
- return 0;
+ return false;
parent_w->next = w->next; /* successful wait. remove from wait queue */
w->pid = child->pid;
diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc
index 8fc7f981c..772b5cc88 100644
--- a/winsup/cygwin/wait.cc
+++ b/winsup/cygwin/wait.cc
@@ -100,8 +100,6 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
}
else if (res != WAIT_OBJECT_0)
{
- /* We shouldn't set errno to any random value if we can help it.
- See the Posix manual for a list of valid values for `errno'. */
set_errno (EINVAL);
res = -1;
}