diff options
author | Christopher Faylor <me@cgf.cx> | 2000-11-16 05:16:59 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-11-16 05:16:59 +0000 |
commit | 0d675c5d7f2493995ca7831c215b215d4b9bbe3a (patch) | |
tree | 5ee7cdaa6510aabfdefdbe5c17eeb40401507afd /winsup | |
parent | cb6f4dbd0c842331a3020b5af31318797cd9a65a (diff) | |
download | newlib-0d675c5d7f2493995ca7831c215b215d4b9bbe3a.zip newlib-0d675c5d7f2493995ca7831c215b215d4b9bbe3a.tar.gz newlib-0d675c5d7f2493995ca7831c215b215d4b9bbe3a.tar.bz2 |
* sigproc.cc (wait_sig): Remove unneeded for loop iteration.
* exceptions.cc (interrupt_setup): Don't set signal mask here or races occur
with main thread. Set it in sigdelayed instead.
(sigreturn): Reflect change in stack order of ebp and flags.
(sigdelayed): Set stack frame correctly. Call set_process_mask here with flags
for last trapped signal.
(signal_dispatch): Add newmask.
* sigproc.cc (wait_sig): Eliminate ill-considered attempt to halt looping
signal processors.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 15 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 33 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/perthread.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 19 |
5 files changed, 35 insertions, 35 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 911e8ae..c06d5a1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,18 @@ +Thu Nov 16 00:15:59 2000 Christopher Faylor <cgf@cygnus.com> + + * sigproc.cc (wait_sig): Remove unneeded for loop iteration. + +Wed Nov 15 21:02:56 2000 Christopher Faylor <cgf@cygnus.com> + + * exceptions.cc (interrupt_setup): Don't set signal mask here or races + occur with main thread. Set it in sigdelayed instead. + (sigreturn): Reflect change in stack order of ebp and flags. + (sigdelayed): Set stack frame correctly. Call set_process_mask here + with flags for last trapped signal. + (signal_dispatch): Add newmask. + * sigproc.cc (wait_sig): Eliminate ill-considered attempt to halt + looping signal processors. + Wed Nov 15 22:08:00 2000 Corinna Vinschen <corinna@vinschen.de> * uinfo.cc (internal_getlogin): Change parameter list to reflect diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 53b9a81..d30eb32 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -624,7 +624,7 @@ interrupt_setup (int sig, struct sigaction& siga, void *handler, sigsave.retaddr_on_stack = retaddr_on_stack; sigsave.oldmask = myself->getsigmask (); // Remember for restoration /* FIXME: Not multi-thread aware */ - set_process_mask (myself->getsigmask () | siga.sa_mask | SIGTOMASK (sig)); + sigsave.newmask = myself->getsigmask () | siga.sa_mask | SIGTOMASK (sig); sigsave.func = (void (*)(int)) handler; sigsave.sig = sig; sigsave.saved_errno = -1; // Flag: no errno to save @@ -687,6 +687,7 @@ interrupt_on_return (sigthread *th, int sig, struct sigaction& siga, void *handl return 1; } + sigproc_printf ("couldn't find a stack frame, i %d\n", i); return 0; } @@ -806,7 +807,7 @@ set_pending: LeaveCriticalSection (&th->lock); if (!hth) - sigproc_printf ("modified main-thread stack"); + sigproc_printf ("didn't suspend main thread, th %p", th); else { res = ResumeThread (hth); @@ -856,8 +857,7 @@ ctrl_c_handler (DWORD type) } /* Set the signal mask for this process. - * Note that some signals are unmaskable, as in UNIX. - */ + Note that some signals are unmaskable, as in UNIX. */ extern "C" void __stdcall set_process_mask (sigset_t newmask) { @@ -1105,43 +1105,38 @@ _sigreturn: popl %%edx popl %%edi popl %%esi - popl %%ebp popf + popl %%ebp ret __no_sig_start: _sigdelayed: - pushl %2 # original return address - pushf + pushl %2 # original return address pushl %%ebp + movl %%esp,%%ebp + pushf pushl %%esi pushl %%edi pushl %%edx pushl %%ecx pushl %%ebx pushl %%eax - pushl %7 # saved errno - pushl %3 # oldmask - pushl %4 # signal argument + pushl %7 # saved errno + pushl %3 # oldmask + pushl %4 # signal argument pushl $_sigreturn - pushl %%ebp - movl %%esp,%%esp call _reset_signal_arrived@0 movl $0,%0 - cmpl $0,_pending_signals - je 2f - pushl $0 - call _sig_dispatch_pending@4 - -2: popl %%ebp + pushl %8 + call _set_process_mask@4 jmp *%5 __no_sig_end: " : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno), "g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig), - "g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno) + "g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno), "g" (sigsave.newmask) ); } } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 433d3e9..30478f2 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -314,7 +314,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) static void slow_pid_reuse (HANDLE h) { - static NO_COPY HANDLE last_fork_procs[64] = {0}; + static NO_COPY HANDLE last_fork_procs[128] = {0}; static NO_COPY unsigned nfork_procs = 0; if (nfork_procs >= (sizeof (last_fork_procs) / sizeof (last_fork_procs [0]))) diff --git a/winsup/cygwin/perthread.h b/winsup/cygwin/perthread.h index f4c82c0..89b97d4 100644 --- a/winsup/cygwin/perthread.h +++ b/winsup/cygwin/perthread.h @@ -97,6 +97,7 @@ struct signal_dispatch int sig; int saved_errno; DWORD oldmask; + DWORD newmask; DWORD retaddr; DWORD *retaddr_on_stack; }; diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index a304940..ed778e7 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -70,8 +70,8 @@ HANDLE NO_COPY signal_arrived; // Event signaled when a signal has #define Static static NO_COPY -Static DWORD proc_loop_wait = 500; // Wait for subprocesses to exit -Static DWORD sig_loop_wait = 500; // Wait for signals to arrive +Static DWORD proc_loop_wait = 1000; // Wait for subprocesses to exit +Static DWORD sig_loop_wait = INFINITE; // Wait for signals to arrive Static HANDLE sigcatch_nonmain = NULL; // The semaphore signaled when // signals are available for @@ -1109,7 +1109,7 @@ wait_sig (VOID *) HANDLE catchem[] = {sigcatch_main, sigcatch_nonmain, sigcatch_nosync}; sigproc_printf ("Ready. dwProcessid %d", myself->dwProcessId); - for (int i = 0; ; i++) + for (;;) { DWORD rc = WaitForMultipleObjects (3, catchem, FALSE, sig_loop_wait); @@ -1196,18 +1196,7 @@ wait_sig (VOID *) /* FIXME: The dispatched stuff probably isn't needed anymore. */ if (dispatched >= 0 && pending_signals < 0 && !saw_pending_signals) - { - pending_signals = 0; - /* FIXME FIXME FIXME FIXME FIXME - This is a real kludge designed to handle runaway processes who - missed a signal and never processed a signal handler. We have - to reset signal_arrived or stuff goes crazy. */ - if (i >= 20) - { - i = 0; - ResetEvent (signal_arrived); - } - } + pending_signals = 0; if (nzombies && saw_sigchld && !dispatched_sigchld) proc_subproc (PROC_CLEARWAIT, 0); |