Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exit.c
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | if ((p->p_treeflag & P_TREE_FIRST_ORPHAN) != 0) { | ||||
if (p1 != NULL) | if (p1 != NULL) | ||||
p1->p_treeflag |= P_TREE_FIRST_ORPHAN; | p1->p_treeflag |= P_TREE_FIRST_ORPHAN; | ||||
p->p_treeflag &= ~P_TREE_FIRST_ORPHAN; | p->p_treeflag &= ~P_TREE_FIRST_ORPHAN; | ||||
} | } | ||||
LIST_REMOVE(p, p_orphan); | LIST_REMOVE(p, p_orphan); | ||||
p->p_treeflag &= ~P_TREE_ORPHANED; | p->p_treeflag &= ~P_TREE_ORPHANED; | ||||
} | } | ||||
void | |||||
exit_onexit(struct proc *p) | |||||
{ | |||||
MPASS(p->p_numthreads == 1); | |||||
umtx_thread_exit(FIRST_THREAD_IN_PROC(p)); | |||||
} | |||||
/* | /* | ||||
* exit -- death of process. | * exit -- death of process. | ||||
*/ | */ | ||||
void | void | ||||
sys_sys_exit(struct thread *td, struct sys_exit_args *uap) | sys_sys_exit(struct thread *td, struct sys_exit_args *uap) | ||||
{ | { | ||||
exit1(td, uap->rval, 0); | exit1(td, uap->rval, 0); | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if (p->p_peers != NULL && p == p->p_leader) { | ||||
} | } | ||||
while (p->p_peers != NULL) | while (p->p_peers != NULL) | ||||
msleep(p, &ppeers_lock, PWAIT, "exit1", 0); | msleep(p, &ppeers_lock, PWAIT, "exit1", 0); | ||||
mtx_unlock(&ppeers_lock); | mtx_unlock(&ppeers_lock); | ||||
} | } | ||||
itimers_exit(p); | itimers_exit(p); | ||||
if (p->p_sysent->sv_onexit != NULL) | |||||
p->p_sysent->sv_onexit(p); | |||||
/* | /* | ||||
* Check if any loadable modules need anything done at process exit. | * Check if any loadable modules need anything done at process exit. | ||||
* E.g. SYSV IPC stuff. | * E.g. SYSV IPC stuff. | ||||
* Event handler could change exit status. | * Event handler could change exit status. | ||||
* XXX what if one of these generates an error? | * XXX what if one of these generates an error? | ||||
*/ | */ | ||||
EVENTHANDLER_DIRECT_INVOKE(process_exit, p); | EVENTHANDLER_DIRECT_INVOKE(process_exit, p); | ||||
Show All 14 Lines | if (timevalisset(&p->p_realtimer.it_value) && | ||||
timevalclear(&p->p_realtimer.it_interval); | timevalclear(&p->p_realtimer.it_interval); | ||||
msleep(&p->p_itcallout, &p->p_mtx, PWAIT, "ritwait", 0); | msleep(&p->p_itcallout, &p->p_mtx, PWAIT, "ritwait", 0); | ||||
KASSERT(!timevalisset(&p->p_realtimer.it_value), | KASSERT(!timevalisset(&p->p_realtimer.it_value), | ||||
("realtime timer is still armed")); | ("realtime timer is still armed")); | ||||
} | } | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
umtx_thread_exit(td); | if (p->p_sysent->sv_onexit != NULL) | ||||
p->p_sysent->sv_onexit(p); | |||||
seltdfini(td); | seltdfini(td); | ||||
/* | /* | ||||
* Reset any sigio structures pointing to us as a result of | * Reset any sigio structures pointing to us as a result of | ||||
* F_SETOWN with our pid. The P_WEXIT flag interlocks with fsetown(). | * F_SETOWN with our pid. The P_WEXIT flag interlocks with fsetown(). | ||||
*/ | */ | ||||
funsetownlst(&p->p_sigiolst); | funsetownlst(&p->p_sigiolst); | ||||
▲ Show 20 Lines • Show All 1,041 Lines • Show Last 20 Lines |