Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exit.c
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
SDT_PROVIDER_DECLARE(proc); | SDT_PROVIDER_DECLARE(proc); | ||||
SDT_PROBE_DEFINE1(proc, , , exit, "int"); | SDT_PROBE_DEFINE1(proc, , , exit, "int"); | ||||
static int kern_kill_on_dbg_exit = 1; | static int kern_kill_on_dbg_exit = 1; | ||||
SYSCTL_INT(_kern, OID_AUTO, kill_on_debugger_exit, CTLFLAG_RWTUN, | SYSCTL_INT(_kern, OID_AUTO, kill_on_debugger_exit, CTLFLAG_RWTUN, | ||||
&kern_kill_on_dbg_exit, 0, | &kern_kill_on_dbg_exit, 0, | ||||
"Kill ptraced processes when debugger exits"); | "Kill ptraced processes when debugger exits"); | ||||
static int kern_wait_dequeue_sigchld = 1; | |||||
SYSCTL_INT(_kern, OID_AUTO, wait_dequeue_sigchld, CTLFLAG_RWTUN, | |||||
markj: bool as well? | |||||
&kern_wait_dequeue_sigchld, 0, | |||||
"Dequeue SIGCHLD on wait(2) for live process"); | |||||
struct proc * | struct proc * | ||||
proc_realparent(struct proc *child) | proc_realparent(struct proc *child) | ||||
{ | { | ||||
struct proc *p, *parent; | struct proc *p, *parent; | ||||
sx_assert(&proctree_lock, SX_LOCKED); | sx_assert(&proctree_lock, SX_LOCKED); | ||||
if ((child->p_treeflag & P_TREE_ORPHANED) == 0) | if ((child->p_treeflag & P_TREE_ORPHANED) == 0) | ||||
return (child->p_pptr->p_pid == child->p_oppid ? | return (child->p_pptr->p_pid == child->p_oppid ? | ||||
▲ Show 20 Lines • Show All 1,086 Lines • ▼ Show 20 Lines | MPASS(si_code == CLD_TRAPPED || si_code == CLD_STOPPED || | ||||
si_code == CLD_CONTINUED); | si_code == CLD_CONTINUED); | ||||
cont = si_code == CLD_CONTINUED; | cont = si_code == CLD_CONTINUED; | ||||
if ((options & WNOWAIT) == 0) { | if ((options & WNOWAIT) == 0) { | ||||
if (cont) | if (cont) | ||||
p->p_flag &= ~P_CONTINUED; | p->p_flag &= ~P_CONTINUED; | ||||
else | else | ||||
p->p_flag |= P_WAITED; | p->p_flag |= P_WAITED; | ||||
if (kern_wait_dequeue_sigchld && | |||||
(td->td_proc->p_sysent->sv_flags & SV_SIG_WAITNDQ) == 0) { | |||||
PROC_LOCK(td->td_proc); | PROC_LOCK(td->td_proc); | ||||
sigqueue_take(p->p_ksi); | sigqueue_take(p->p_ksi); | ||||
PROC_UNLOCK(td->td_proc); | PROC_UNLOCK(td->td_proc); | ||||
} | |||||
} | } | ||||
sx_xunlock(&proctree_lock); | sx_xunlock(&proctree_lock); | ||||
if (siginfo != NULL) { | if (siginfo != NULL) { | ||||
siginfo->si_code = si_code; | siginfo->si_code = si_code; | ||||
siginfo->si_status = cont ? SIGCONT : p->p_xsig; | siginfo->si_status = cont ? SIGCONT : p->p_xsig; | ||||
} | } | ||||
if (status != NULL) | if (status != NULL) | ||||
*status = cont ? SIGCONT : W_STOPCODE(p->p_xsig); | *status = cont ? SIGCONT : W_STOPCODE(p->p_xsig); | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |
bool as well?