diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-06 03:39:18 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-06 03:39:18 +0000 |
commit | 4ce15a498010f678c71cefdf2a2ac0db58f4fa93 (patch) | |
tree | 67498c2416dddf7295358edc848708c05ac3d047 /winsup/cygwin/sigproc.cc | |
parent | 0fb61528c94f959e5c1bfc9aeab7e09d0dcbf54b (diff) | |
download | newlib-4ce15a498010f678c71cefdf2a2ac0db58f4fa93.zip newlib-4ce15a498010f678c71cefdf2a2ac0db58f4fa93.tar.gz newlib-4ce15a498010f678c71cefdf2a2ac0db58f4fa93.tar.bz2 |
* 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.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 768d6f1..b3c69ff 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 */ |