From acced2cea2e52c17dbf57efd9b7d1b53e73aedcf Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 18 Jul 2009 20:25:07 +0000 Subject: * exceptions.cc (sig_handle_tty_stop): Set stopsig to SIGCONT when continuing. (stopped_or_terminated): Honor WCONTINUED. * wait.cc (wait4): Ditto. * include/cygwin/wait.h (WCONTINUED): Define. (__W_CONTINUED): Ditto. (WIFCONTINUED): Ditto. --- winsup/cygwin/ChangeLog | 10 ++++++++++ winsup/cygwin/exceptions.cc | 1 + winsup/cygwin/include/cygwin/wait.h | 5 ++++- winsup/cygwin/sigproc.cc | 7 +++++-- winsup/cygwin/wait.cc | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index efa6a08d3..54e65d1b0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2009-07-18 Christopher Faylor + + * exceptions.cc (sig_handle_tty_stop): Set stopsig to SIGCONT when + continuing. + (stopped_or_terminated): Honor WCONTINUED. + * wait.cc (wait4): Ditto. + * include/cygwin/wait.h (WCONTINUED): Define. + (__W_CONTINUED): Ditto. + (WIFCONTINUED): Ditto. + 2009-07-18 Dave Korn * libstdcxx_wrapper.cc (operator delete): Remove stray space in diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index eeed74930..76632854b 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -760,6 +760,7 @@ sig_handle_tty_stop (int sig) case WAIT_OBJECT_0: case WAIT_OBJECT_0 + 1: reset_signal_arrived (); + myself->stopsig = SIGCONT; myself->alert_parent (SIGCONT); break; default: diff --git a/winsup/cygwin/include/cygwin/wait.h b/winsup/cygwin/include/cygwin/wait.h index 12a351326..bed81b779 100644 --- a/winsup/cygwin/include/cygwin/wait.h +++ b/winsup/cygwin/include/cygwin/wait.h @@ -1,6 +1,6 @@ /* cygwin/wait.h - Copyright 2006 Red Hat, Inc. + Copyright 2006, 2009 Red Hat, Inc. This file is part of Cygwin. @@ -13,6 +13,8 @@ details. */ #define WNOHANG 1 #define WUNTRACED 2 +#define WCONTINUED 8 +#define __W_CONTINUED 0xffff /* A status looks like: <2 bytes info> <2 bytes code> @@ -26,6 +28,7 @@ details. */ #define WIFEXITED(w) (((w) & 0xff) == 0) #define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WIFCONTINUED(w) (((w) & 0xffff) == __W_CONTINUED) #define WEXITSTATUS(w) (((w) >> 8) & 0xff) #define WTERMSIG(w) ((w) & 0x7f) #define WSTOPSIG WEXITSTATUS diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 91109977b..29bb00101 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1050,7 +1050,7 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child) int terminated; if (!((terminated = (child->process_state == PID_EXITED)) || - ((w->options & WUNTRACED) && child->stopsig))) + ((w->options & (WUNTRACED | WCONTINUED)) && child->stopsig))) return false; parent_w->next = w->next; /* successful wait. remove from wait queue */ @@ -1059,7 +1059,10 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child) if (!terminated) { sigproc_printf ("stopped child"); - w->status = (child->stopsig << 8) | 0x7f; + if (child->stopsig == SIGCONT) + w->status = __W_CONTINUED; + else + w->status = (child->stopsig << 8) | 0x7f; child->stopsig = 0; } else diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc index 772b5cc88..3286434ba 100644 --- a/winsup/cygwin/wait.cc +++ b/winsup/cygwin/wait.cc @@ -52,7 +52,7 @@ wait4 (int intpid, int *status, int options, struct rusage *r) while (1) { sig_dispatch_pending (); - if (options & ~(WNOHANG | WUNTRACED)) + if (options & ~(WNOHANG | WUNTRACED | WCONTINUED)) { set_errno (EINVAL); res = -1; -- cgit v1.2.3