version 1.319.6.1, 2015/12/27 12:10:05 |
version 1.319.6.2, 2016/04/22 15:44:16 |
Line 896 trapsignal(struct lwp *l, ksiginfo_t *ks |
|
Line 896 trapsignal(struct lwp *l, ksiginfo_t *ks |
|
l->l_ru.ru_nsignals++; |
l->l_ru.ru_nsignals++; |
kpsendsig(l, ksi, mask); |
kpsendsig(l, ksi, mask); |
mutex_exit(p->p_lock); |
mutex_exit(p->p_lock); |
ktrpsig(signo, SIGACTION_PS(ps, signo).sa_handler, mask, ksi); |
if (ktrpoint(KTR_PSIG)) { |
|
ktrpsig(signo, SIGACTION_PS(ps, signo).sa_handler, |
|
mask, ksi); |
|
} |
} else { |
} else { |
/* XXX for core dump/debugger */ |
/* XXX for core dump/debugger */ |
p->p_sigctx.ps_lwp = l->l_lid; |
p->p_sigctx.ps_lwp = l->l_lid; |
Line 916 child_psignal(struct proc *p, int mask) |
|
Line 919 child_psignal(struct proc *p, int mask) |
|
{ |
{ |
ksiginfo_t ksi; |
ksiginfo_t ksi; |
struct proc *q; |
struct proc *q; |
int xstat; |
int xsig; |
|
|
KASSERT(mutex_owned(proc_lock)); |
KASSERT(mutex_owned(proc_lock)); |
KASSERT(mutex_owned(p->p_lock)); |
KASSERT(mutex_owned(p->p_lock)); |
|
|
xstat = p->p_xstat; |
xsig = p->p_xsig; |
|
|
KSI_INIT(&ksi); |
KSI_INIT(&ksi); |
ksi.ksi_signo = SIGCHLD; |
ksi.ksi_signo = SIGCHLD; |
ksi.ksi_code = (xstat == SIGCONT ? CLD_CONTINUED : CLD_STOPPED); |
ksi.ksi_code = (xsig == SIGCONT ? CLD_CONTINUED : CLD_STOPPED); |
ksi.ksi_pid = p->p_pid; |
ksi.ksi_pid = p->p_pid; |
ksi.ksi_uid = kauth_cred_geteuid(p->p_cred); |
ksi.ksi_uid = kauth_cred_geteuid(p->p_cred); |
ksi.ksi_status = xstat; |
ksi.ksi_status = xsig; |
ksi.ksi_utime = p->p_stats->p_ru.ru_utime.tv_sec; |
ksi.ksi_utime = p->p_stats->p_ru.ru_utime.tv_sec; |
ksi.ksi_stime = p->p_stats->p_ru.ru_stime.tv_sec; |
ksi.ksi_stime = p->p_stats->p_ru.ru_stime.tv_sec; |
|
|
Line 1377 kpsignal2(struct proc *p, ksiginfo_t *ks |
|
Line 1380 kpsignal2(struct proc *p, ksiginfo_t *ks |
|
* signal itself (if waiting on event - process runs, |
* signal itself (if waiting on event - process runs, |
* otherwise continues sleeping). |
* otherwise continues sleeping). |
*/ |
*/ |
if ((prop & SA_CONT) != 0 && action == SIG_DFL) { |
if ((prop & SA_CONT) != 0) { |
KASSERT(signo != SIGKILL); |
p->p_xsig = SIGCONT; |
goto deliver; |
child_psignal(p, 0); |
|
if (action == SIG_DFL) { |
|
KASSERT(signo != SIGKILL); |
|
goto deliver; |
|
} |
} |
} |
} else if ((prop & SA_STOP) != 0) { |
} else if ((prop & SA_STOP) != 0) { |
/* |
/* |
Line 1566 sigchecktrace(void) |
|
Line 1573 sigchecktrace(void) |
|
* If we are no longer being traced, or the parent didn't |
* If we are no longer being traced, or the parent didn't |
* give us a signal, or we're stopping, look for more signals. |
* give us a signal, or we're stopping, look for more signals. |
*/ |
*/ |
if ((p->p_slflag & PSL_TRACED) == 0 || p->p_xstat == 0 || |
if ((p->p_slflag & PSL_TRACED) == 0 || p->p_xsig == 0 || |
(p->p_sflag & PS_STOPPING) != 0) |
(p->p_sflag & PS_STOPPING) != 0) |
return 0; |
return 0; |
|
|
Line 1574 sigchecktrace(void) |
|
Line 1581 sigchecktrace(void) |
|
* If the new signal is being masked, look for other signals. |
* If the new signal is being masked, look for other signals. |
* `p->p_sigctx.ps_siglist |= mask' is done in setrunnable(). |
* `p->p_sigctx.ps_siglist |= mask' is done in setrunnable(). |
*/ |
*/ |
signo = p->p_xstat; |
signo = p->p_xsig; |
p->p_xstat = 0; |
p->p_xsig = 0; |
if (sigismember(&l->l_sigmask, signo)) { |
if (sigismember(&l->l_sigmask, signo)) { |
signo = 0; |
signo = 0; |
} |
} |
Line 1685 issignal(struct lwp *l) |
|
Line 1692 issignal(struct lwp *l) |
|
*/ |
*/ |
if (sp) |
if (sp) |
sigdelset(&sp->sp_set, signo); |
sigdelset(&sp->sp_set, signo); |
p->p_xstat = signo; |
p->p_xsig = signo; |
|
|
/* Emulation-specific handling of signal trace */ |
/* Emulation-specific handling of signal trace */ |
if (p->p_emul->e_tracesig == NULL || |
if (p->p_emul->e_tracesig == NULL || |
Line 1742 issignal(struct lwp *l) |
|
Line 1749 issignal(struct lwp *l) |
|
} |
} |
/* Take the signal. */ |
/* Take the signal. */ |
(void)sigget(sp, NULL, signo, NULL); |
(void)sigget(sp, NULL, signo, NULL); |
p->p_xstat = signo; |
p->p_xsig = signo; |
signo = 0; |
signo = 0; |
sigswitch(true, PS_NOCLDSTOP, p->p_xstat); |
sigswitch(true, PS_NOCLDSTOP, p->p_xsig); |
} else if (prop & SA_IGNORE) { |
} else if (prop & SA_IGNORE) { |
/* |
/* |
* Except for SIGCONT, shouldn't get here. |
* Except for SIGCONT, shouldn't get here. |
Line 2017 sigexit(struct lwp *l, int signo) |
|
Line 2024 sigexit(struct lwp *l, int signo) |
|
|
|
if (docore) { |
if (docore) { |
mutex_exit(p->p_lock); |
mutex_exit(p->p_lock); |
if ((error = (*coredump_vec)(l, NULL)) == 0) |
error = (*coredump_vec)(l, NULL); |
exitsig |= WCOREFLAG; |
|
|
|
if (kern_logsigexit) { |
if (kern_logsigexit) { |
int uid = l->l_cred ? |
int uid = l->l_cred ? |
Line 2037 sigexit(struct lwp *l, int signo) |
|
Line 2043 sigexit(struct lwp *l, int signo) |
|
#endif /* PAX_SEGVGUARD */ |
#endif /* PAX_SEGVGUARD */ |
/* Acquire the sched state mutex. exit1() will release it. */ |
/* Acquire the sched state mutex. exit1() will release it. */ |
mutex_enter(p->p_lock); |
mutex_enter(p->p_lock); |
|
if (error == 0) |
|
p->p_sflag |= PS_COREDUMP; |
} |
} |
|
|
/* No longer dumping core. */ |
/* No longer dumping core. */ |
p->p_sflag &= ~PS_WCORE; |
p->p_sflag &= ~PS_WCORE; |
|
|
exit1(l, W_EXITCODE(0, exitsig)); |
exit1(l, 0, exitsig); |
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
|
|
Line 2183 proc_unstop(struct proc *p) |
|
Line 2191 proc_unstop(struct proc *p) |
|
|
|
p->p_stat = SACTIVE; |
p->p_stat = SACTIVE; |
p->p_sflag &= ~PS_STOPPING; |
p->p_sflag &= ~PS_STOPPING; |
sig = p->p_xstat; |
sig = p->p_xsig; |
|
|
if (!p->p_waited) |
if (!p->p_waited) |
p->p_pptr->p_nstopchild--; |
p->p_pptr->p_nstopchild--; |