Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exit.c
Show First 20 Lines • Show All 925 Lines • ▼ Show 20 Lines | if (options & WNOWAIT) { | ||||
* Only poll, returning the status. Caller does not wish to | * Only poll, returning the status. Caller does not wish to | ||||
* release the proc struct just yet. | * release the proc struct just yet. | ||||
*/ | */ | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
sx_xunlock(&proctree_lock); | sx_xunlock(&proctree_lock); | ||||
return; | return; | ||||
} | } | ||||
/* | |||||
* Wait for any processes that have a hold on our vmspace to | |||||
* release their reference. | |||||
*/ | |||||
while (p->p_lockreap > 0) | |||||
msleep(&p->p_lockreap, &p->p_mtx, PWAIT, "reaphold", 0); | |||||
PROC_LOCK(q); | PROC_LOCK(q); | ||||
sigqueue_take(p->p_ksi); | sigqueue_take(p->p_ksi); | ||||
PROC_UNLOCK(q); | PROC_UNLOCK(q); | ||||
/* | /* | ||||
* If we got the child via a ptrace 'attach', we need to give it back | * If we got the child via a ptrace 'attach', we need to give it back | ||||
* to the old parent. | * to the old parent. | ||||
*/ | */ | ||||
Show All 30 Lines | proc_reap(struct thread *td, struct proc *p, int *status, int options) | ||||
proc_clear_orphan(p); | proc_clear_orphan(p); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
leavepgrp(p); | leavepgrp(p); | ||||
if (p->p_procdesc != NULL) | if (p->p_procdesc != NULL) | ||||
procdesc_reap(p); | procdesc_reap(p); | ||||
sx_xunlock(&proctree_lock); | sx_xunlock(&proctree_lock); | ||||
proc_id_clear(PROC_ID_PID, p->p_pid); | proc_id_clear(PROC_ID_PID, p->p_pid); | ||||
kib: Ok, so this 'lockreap' does not have anything to do with vmspace at all, it is just a hold on… | |||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
knlist_detach(p->p_klist); | knlist_detach(p->p_klist); | ||||
p->p_klist = NULL; | p->p_klist = NULL; | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
/* | /* | ||||
* Removal from allproc list and process group list paired with | * Removal from allproc list and process group list paired with | ||||
* PROC_LOCK which was executed during that time should guarantee | * PROC_LOCK which was executed during that time should guarantee | ||||
▲ Show 20 Lines • Show All 477 Lines • Show Last 20 Lines |
Ok, so this 'lockreap' does not have anything to do with vmspace at all, it is just a hold on reuse of the struct proc/p_pid while linprocfs might expose the pid?
If I am right, shouldn't this check/wait appear at the start of the function, while all linkage is still valid?