aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-03-15 00:29:14 +0000
committerChristopher Faylor <me@cgf.cx>2006-03-15 00:29:14 +0000
commitf02400f7c9db8176a7cc49eb8e4b6450ae5901c2 (patch)
tree0743a8f834f02fa2e76e6eb521894e63b23d6ce0
parent67f85ee7b2d2a7bd531cb82c84dc3eea0f397ab2 (diff)
downloadnewlib-f02400f7c9db8176a7cc49eb8e4b6450ae5901c2.zip
newlib-f02400f7c9db8176a7cc49eb8e4b6450ae5901c2.tar.gz
newlib-f02400f7c9db8176a7cc49eb8e4b6450ae5901c2.tar.bz2
* child_info.h (child_info_fork::fork_retry): Declare new function.
* dcrt0.cc (child_info_fork::fork_retry): Define new function. * fork.cc (frok::parent): Move retry decision into child_info_fork::fork_retry and honor what it tells us to do. * sigproc.cc (sig_send): Unhold signals on __SIGEXIT.
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/child_info.h3
-rw-r--r--winsup/cygwin/dcrt0.cc20
-rw-r--r--winsup/cygwin/fork.cc9
-rw-r--r--winsup/cygwin/sigproc.cc2
5 files changed, 34 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3a72e7d..480074b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,13 @@
2006-03-14 Christopher Faylor <cgf@timesys.com>
+ * child_info.h (child_info_fork::fork_retry): Declare new function.
+ * dcrt0.cc (child_info_fork::fork_retry): Define new function.
+ * fork.cc (frok::parent): Move retry decision into
+ child_info_fork::fork_retry and honor what it tells us to do.
+ * sigproc.cc (sig_send): Unhold signals on __SIGEXIT.
+
+2006-03-14 Christopher Faylor <cgf@timesys.com>
+
* fork.cc (frok::parent): Improve error message.
2006-03-14 Christopher Faylor <cgf@timesys.com>
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 03e8af5..87da6e4 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -29,7 +29,7 @@ enum child_info_types
#define EXEC_MAGIC_SIZE sizeof(child_info)
-#define CURR_CHILD_INFO_MAGIC 0x4160e87bU
+#define CURR_CHILD_INFO_MAGIC 0x88e640f7U
/* NOTE: Do not make gratuitous changes to the names or organization of the
below class. The layout is checksummed to determine compatibility between
@@ -72,6 +72,7 @@ public:
child_info_fork ();
void handle_fork ();
bool handle_failure (DWORD);
+ DWORD fork_retry (HANDLE);
};
class fhandler_base;
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 46fdf92..26a749c 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -642,6 +642,26 @@ get_cygwin_startup_info ()
return res;
}
+DWORD
+child_info_fork::fork_retry (HANDLE h)
+{
+ DWORD exit_code;
+ if (!GetExitCodeProcess (h, &exit_code))
+ return STILL_ACTIVE; /* should never happen */
+ switch (exit_code)
+ {
+ case STATUS_CONTROL_C_EXIT:
+ if (retry-- > 0)
+ return 0;
+ break;
+ case EXITCODE_RETRY:
+ if (retry-- > 0)
+ return 0;
+ break;
+ }
+ return exit_code;
+}
+
bool
child_info_fork::handle_failure (DWORD err)
{
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 7aab315..2609608 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -326,12 +326,9 @@ frok::parent (void *stack_here)
/* Wait for subproc to initialize itself. */
if (!ch.sync (pi.dwProcessId, pi.hProcess, FORK_WAIT_TIMEOUT))
{
- DWORD exit_code;
- if (GetExitCodeProcess (pi.hProcess, &exit_code) && exit_code == EXITCODE_RETRY)
- {
- ch.retry--;
- continue;
- }
+ DWORD exit_code = ch.fork_retry (pi.hProcess);
+ if (!exit_code)
+ continue;
this_errno = EAGAIN;
/* Not thread safe, but do we care? */
static char buf[sizeof("died waiting for longjmp before "
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 0b22495..4cd538c 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -515,7 +515,7 @@ sig_send (_pinfo *p, int sig)
/* nothing */;
else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
return 0;
- else if (sig == __SIGNOHOLD)
+ else if (sig == __SIGNOHOLD || sig == __SIGEXIT)
{
SetEvent (sigCONT);
sigheld = false;