+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
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
return 1;
}
+ sigproc_printf ("couldn't find a stack frame, i %d\n", i);
return 0;
}
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);
}
/* 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)
{
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)
);
}
}
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])))
int sig;
int saved_errno;
DWORD oldmask;
+ DWORD newmask;
DWORD retaddr;
DWORD *retaddr_on_stack;
};
#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
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);
/* 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);