* 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.
This commit is contained in:
Christopher Faylor 2000-11-16 05:16:59 +00:00
parent cb6f4dbd0c
commit 0d675c5d7f
5 changed files with 35 additions and 35 deletions

View File

@ -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

View File

@ -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)
);
}
}

View File

@ -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])))

View File

@ -97,6 +97,7 @@ struct signal_dispatch
int sig;
int saved_errno;
DWORD oldmask;
DWORD newmask;
DWORD retaddr;
DWORD *retaddr_on_stack;
};

View File

@ -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);