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:
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 768d6f1fd..b3c69ffd5 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -46,7 +46,7 @@ details. */
#define no_signals_available() (!hwait_sig || !sig_loop_wait)
-#define ZOMBIEMAX ((int) (sizeof (zombies) / sizeof (zombies[0])) - 1)
+#define ZOMBIEMAX 4096
/*
* Global variables
@@ -102,9 +102,9 @@ Static HANDLE wait_sig_inited = NULL; // Control synchronization of
Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++
#define hchildren (events + 1) // Where the children handles begin
Static pinfo pchildren[PSIZE]; // All my children info
-Static pinfo zombies[16384]; // All my deceased children info
Static int nchildren = 0; // Number of active children
-Static int nzombies = 0; // Number of deceased children
+static pinfo *zombies; // All my deceased children info
+static int nzombies; // Number of deceased children
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
Static waitq waitq_main; // Storage for main thread
@@ -303,6 +303,8 @@ proc_subproc (DWORD what, DWORD val)
int thiszombie;
thiszombie = nzombies;
+ if (!zombies)
+ zombies = (pinfo *) malloc (sizeof (pinfo) * ZOMBIEMAX);
zombies[nzombies] = pchildren[val]; // Add to zombie array
zombies[nzombies++]->process_state = PID_ZOMBIE;// Walking dead
@@ -1302,6 +1304,17 @@ wait_subproc (VOID *)
return 0;
}
+void __stdcall
+sigproc_fixup_after_fork ()
+{
+ if (zombies)
+ {
+ free (zombies);
+ nzombies = 0;
+ zombies = NULL;
+ }
+}
+
extern "C" {
/* Provide a stack frame when calling WaitFor* functions */