From 4ce15a498010f678c71cefdf2a2ac0db58f4fa93 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 6 Sep 2001 03:39:18 +0000 Subject: * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc. * cygheap.cc: Throughout use bucket array from cygheap. * sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save DLL space. (sigproc_fixup_after_fork): Free zombie array after a fork. * sigproc.h (sigproc_fixup_after_fork): Declare. * dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid stack corruption. * fhandler.cc (fhandler_base::open): Ditto. * path.cc (symlink): Ditto. --- winsup/cygwin/sigproc.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') 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 */ -- cgit v1.2.3