Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exit.c
Show First 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | if (!(q->p_flag & P_TRACED)) { | ||||
ksiginfo_copy(q->p_ksi, ksi); | ksiginfo_copy(q->p_ksi, ksi); | ||||
ksi->ksi_flags |= KSI_INS; | ksi->ksi_flags |= KSI_INS; | ||||
ksi1 = ksi; | ksi1 = ksi; | ||||
ksi = NULL; | ksi = NULL; | ||||
} | } | ||||
PROC_LOCK(q->p_reaper); | PROC_LOCK(q->p_reaper); | ||||
pksignal(q->p_reaper, SIGCHLD, ksi1); | pksignal(q->p_reaper, SIGCHLD, ksi1); | ||||
PROC_UNLOCK(q->p_reaper); | PROC_UNLOCK(q->p_reaper); | ||||
} else if (q->p_pdeathsig > 0) { | |||||
/* | |||||
* The child asked to received a signal | |||||
* when we exit. | |||||
*/ | |||||
kern_psignal(q, q->p_pdeathsig); | |||||
} | } | ||||
} else { | } else { | ||||
/* | /* | ||||
* Traced processes are killed since their existence | * Traced processes are killed since their existence | ||||
* means someone is screwing up. | * means someone is screwing up. | ||||
*/ | */ | ||||
t = proc_realparent(q); | t = proc_realparent(q); | ||||
if (t == p) { | if (t == p) { | ||||
Show All 24 Lines | if (ksi != NULL) | ||||
ksiginfo_free(ksi); | ksiginfo_free(ksi); | ||||
} | } | ||||
/* | /* | ||||
* Also get rid of our orphans. | * Also get rid of our orphans. | ||||
*/ | */ | ||||
while ((q = LIST_FIRST(&p->p_orphans)) != NULL) { | while ((q = LIST_FIRST(&p->p_orphans)) != NULL) { | ||||
PROC_LOCK(q); | PROC_LOCK(q); | ||||
/* | |||||
* If we are the real parent of this process | |||||
* but it has been reparented to a debugger, then | |||||
* check if it asked for a signal when we exit. | |||||
*/ | |||||
if (q->p_pdeathsig > 0) | |||||
kern_psignal(q, q->p_pdeathsig); | |||||
CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid, | CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid, | ||||
q->p_pid); | q->p_pid); | ||||
clear_orphan(q); | clear_orphan(q); | ||||
PROC_UNLOCK(q); | PROC_UNLOCK(q); | ||||
} | } | ||||
/* Save exit status. */ | /* Save exit status. */ | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
▲ Show 20 Lines • Show All 821 Lines • Show Last 20 Lines |