* exceptions.cc (handle_exceptions): Just si_code to SI_KERNEL first and let it
be overridden. * exceptions.cc (_cygtls::call_signal_handler): Call signal handler with extra siginfo_t * and void * parameters when SA_SIGINFO flag is set. * signal.cc (signal): Clear SA_SIGINFO flag. (sigqueue): Fix incorrect setting of si_code. * sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when setting handler to SIG_DFL.
This commit is contained in:
parent
683cc8189c
commit
d5f4ee62b7
|
@ -1,3 +1,18 @@
|
|||
2005-09-26 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* exceptions.cc (handle_exceptions): Just si_code to SI_KERNEL first
|
||||
and let it be overridden.
|
||||
|
||||
2005-09-26 Yitzchak Scott-Thoennes <sthoenna@efn.org>
|
||||
|
||||
* exceptions.cc (_cygtls::call_signal_handler): Call signal handler
|
||||
with extra siginfo_t * and void * parameters when SA_SIGINFO flag is
|
||||
set.
|
||||
* signal.cc (signal): Clear SA_SIGINFO flag.
|
||||
(sigqueue): Fix incorrect setting of si_code.
|
||||
* sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when
|
||||
setting handler to SIG_DFL.
|
||||
|
||||
2005-09-26 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* pinfo.cc (proc_waiter): Properly fill out si_code as according to SUSv3.
|
||||
|
|
|
@ -424,6 +424,7 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
|
|||
CONTEXT in = *in0;
|
||||
|
||||
siginfo_t si;
|
||||
si.si_code = SI_KERNEL;
|
||||
/* Coerce win32 value to posix value. */
|
||||
switch (e.ExceptionCode)
|
||||
{
|
||||
|
@ -472,7 +473,6 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
|
|||
|
||||
case STATUS_TIMEOUT:
|
||||
si.si_signo = SIGALRM;
|
||||
si.si_code = 0;
|
||||
break;
|
||||
|
||||
case STATUS_ACCESS_VIOLATION:
|
||||
|
@ -489,7 +489,6 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
|
|||
|
||||
case STATUS_CONTROL_C_EXIT:
|
||||
si.si_signo = SIGINT;
|
||||
si.si_code = 0;
|
||||
break;
|
||||
|
||||
case STATUS_INVALID_HANDLE:
|
||||
|
@ -569,8 +568,6 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
|
|||
me.return_from_fault ();
|
||||
|
||||
si.si_addr = ebp;
|
||||
if (!si_code)
|
||||
si.si_code = SI_KERNEL;
|
||||
si.si_errno = si.si_pid = si.si_uid = 0;
|
||||
me.push ((__stack_t) ebp, true);
|
||||
sig_send (NULL, si, &me); // Signal myself
|
||||
|
@ -1253,7 +1250,15 @@ _cygtls::call_signal_handler ()
|
|||
int this_errno = saved_errno;
|
||||
incyg--;
|
||||
sig = 0;
|
||||
sigfunc (thissig);
|
||||
if (this_sa_flags & SA_SIGINFO == 0)
|
||||
sigfunc (thissig);
|
||||
else
|
||||
{
|
||||
siginfo_t thissi = infodata;
|
||||
void (*sigact) (int, siginfo_t *, void *) = (void (*) (int, siginfo_t *, void *)) func;
|
||||
/* no ucontext_t information provided yet */
|
||||
sigact (thissig, &thissi, NULL);
|
||||
}
|
||||
incyg++;
|
||||
set_signal_mask (this_oldmask, myself->getsigmask ());
|
||||
if (this_errno >= 0)
|
||||
|
|
|
@ -63,6 +63,7 @@ signal (int sig, _sig_func_ptr func)
|
|||
/* SA_RESTART is set to maintain BSD compatible signal behaviour by default.
|
||||
This is also compatible with the behaviour of signal(2) in Linux. */
|
||||
global_sigs[sig].sa_flags |= SA_RESTART;
|
||||
global_sigs[sig].sa_flags &= ~ SA_SIGINFO;
|
||||
set_sigcatchers (prev, func);
|
||||
|
||||
syscall_printf ("%p = signal (%d, %p)", prev, sig, func);
|
||||
|
@ -524,6 +525,10 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info)
|
|||
return res;
|
||||
}
|
||||
|
||||
/* FIXME: SUSv3 says that this function should block until the signal has
|
||||
actually been delivered. Currently, this will only happen when sending
|
||||
signals to the current process. It will not happen when sending signals
|
||||
to other processes. */
|
||||
extern "C" int
|
||||
sigqueue (pid_t pid, int sig, const union sigval value)
|
||||
{
|
||||
|
@ -535,7 +540,7 @@ sigqueue (pid_t pid, int sig, const union sigval value)
|
|||
return -1;
|
||||
}
|
||||
si.si_signo = sig;
|
||||
si.si_code = SI_USER;
|
||||
si.si_code = SI_QUEUE;
|
||||
si.si_pid = si.si_uid = si.si_errno = 0;
|
||||
si.si_value = value;
|
||||
return sig_send (dest, si);
|
||||
|
|
|
@ -120,7 +120,10 @@ signal_fixup_after_exec ()
|
|||
{
|
||||
global_sigs[i].sa_mask = 0;
|
||||
if (global_sigs[i].sa_handler != SIG_IGN)
|
||||
global_sigs[i].sa_handler = SIG_DFL;
|
||||
{
|
||||
global_sigs[i].sa_handler = SIG_DFL;
|
||||
global_sigs[i].sa_flags &= ~ SA_SIGINFO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue