From 84d38174056e438860213eb0cda919df89c06bd2 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 13 Mar 2006 21:10:14 +0000 Subject: * child_info.h (child_info_fork::handle_failure): Declare new function. (child_info_fork::retry): New field. * dcrt0.cc (__api_fatal_exit_val): Define. (child_info_fork::handle_failure): Define new function. (__api_fatal): Exit using __api_fatal_exit_val value. * environ.cc (set_fork_retry): Set fork_retry based on CYGWIN environment variable. (parse_thing): Add "fork_retry" setting. * fork.cc (fork_retry): Define. (frok::parent): Reorganize to allow retry of failed child creation if child signalled that it was ok to do so. * heap.cc (heap_init): Signal parent via handle_failure when VirtualAlloc fails. * pinfo.h (EXITCODE_RETRY): Declare. * sigproc.cc (child_info::sync): Properly exit with failure condition if called for fork and didn't see subproc_ready. * spawn.cc (spawn_guts): Use windows pid as first argument. * winsup.h: Remove obsolete NEW_MACRO_VARARGS define. (__api_fatal_exit_val): Declare. (set_api_fatal_return): Define. (in_dllentry): Declare. * exceptions.cc (inside_kernel): Remove unneeded in_dllentry declaration. --- winsup/cygwin/sigproc.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index c8f11324a..8f49320fa 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -39,7 +39,7 @@ details. */ #define WSSC 60000 // Wait for signal completion #define WPSP 40000 // Wait for proc_subproc mutex -#define no_signals_available(x) (!hwait_sig || ((x) && myself->exitcode & EXITCODE_SET) || &_my_tls == _sig_tls) +#define no_signals_available(x) (!hwait_sig || ((x) && myself->exitcode & EXITCODE_SET) || &_my_tls == _sig_tls || in_dllentry) #define NPROCS 256 @@ -856,18 +856,23 @@ child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong) x -= WAIT_OBJECT_0; if (x >= n) { - system_printf ("wait failed, pid %d, %E", pid); + system_printf ("wait failed, pid %u, %E", pid); res = false; } else { - if (type == _PROC_EXEC && x == nsubproc_ready && myself->wr_proc_pipe) + if (x != nsubproc_ready) + res = type != _PROC_FORK; + else { - ForceCloseHandle1 (hProcess, childhProc); - hProcess = NULL; + if (type == _PROC_EXEC && myself->wr_proc_pipe) + { + ForceCloseHandle1 (hProcess, childhProc); + hProcess = NULL; + } + res = true; } - sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x); - res = true; + sigproc_printf ("pid %u, WFMO returned %d, res %d", pid, x, res); } return res; } -- cgit v1.2.3