* 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.
This commit is contained in:
Christopher Faylor 2006-03-15 00:29:14 +00:00
parent 67f85ee7b2
commit f02400f7c9
5 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,11 @@
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> 2006-03-14 Christopher Faylor <cgf@timesys.com>
* fork.cc (frok::parent): Improve error message. * fork.cc (frok::parent): Improve error message.

View File

@ -29,7 +29,7 @@ enum child_info_types
#define EXEC_MAGIC_SIZE sizeof(child_info) #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 /* NOTE: Do not make gratuitous changes to the names or organization of the
below class. The layout is checksummed to determine compatibility between below class. The layout is checksummed to determine compatibility between
@ -72,6 +72,7 @@ public:
child_info_fork (); child_info_fork ();
void handle_fork (); void handle_fork ();
bool handle_failure (DWORD); bool handle_failure (DWORD);
DWORD fork_retry (HANDLE);
}; };
class fhandler_base; class fhandler_base;

View File

@ -642,6 +642,26 @@ get_cygwin_startup_info ()
return res; 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 bool
child_info_fork::handle_failure (DWORD err) child_info_fork::handle_failure (DWORD err)
{ {

View File

@ -326,12 +326,9 @@ frok::parent (void *stack_here)
/* Wait for subproc to initialize itself. */ /* Wait for subproc to initialize itself. */
if (!ch.sync (pi.dwProcessId, pi.hProcess, FORK_WAIT_TIMEOUT)) if (!ch.sync (pi.dwProcessId, pi.hProcess, FORK_WAIT_TIMEOUT))
{ {
DWORD exit_code; DWORD exit_code = ch.fork_retry (pi.hProcess);
if (GetExitCodeProcess (pi.hProcess, &exit_code) && exit_code == EXITCODE_RETRY) if (!exit_code)
{ continue;
ch.retry--;
continue;
}
this_errno = EAGAIN; this_errno = EAGAIN;
/* Not thread safe, but do we care? */ /* Not thread safe, but do we care? */
static char buf[sizeof("died waiting for longjmp before " static char buf[sizeof("died waiting for longjmp before "

View File

@ -515,7 +515,7 @@ sig_send (_pinfo *p, int sig)
/* nothing */; /* nothing */;
else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST) else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
return 0; return 0;
else if (sig == __SIGNOHOLD) else if (sig == __SIGNOHOLD || sig == __SIGEXIT)
{ {
SetEvent (sigCONT); SetEvent (sigCONT);
sigheld = false; sigheld = false;