Do not leave a process with no credential in zombproc.

Reviewed by:	jhb
This commit is contained in:
Seigo Tanimura 2001-04-25 10:22:35 +00:00
parent 112f737245
commit ebdc3f1d2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75950

View File

@ -522,6 +522,20 @@ wait1(q, uap, compat)
if (p->p_textvp)
vrele(p->p_textvp);
/*
* Finally finished with old proc entry.
* Unlink it from its process group and free it.
*/
leavepgrp(p);
sx_xlock(&allproc_lock);
LIST_REMOVE(p, p_list); /* off zombproc */
sx_xunlock(&allproc_lock);
sx_xlock(&proctree_lock);
LIST_REMOVE(p, p_sibling);
sx_xunlock(&proctree_lock);
/*
* Free up credentials.
*/
@ -538,30 +552,13 @@ wait1(q, uap, compat)
*/
if (p->p_args && --p->p_args->ar_ref == 0)
FREE(p->p_args, M_PARGS);
PROC_UNLOCK(p);
/*
* Finally finished with old proc entry.
* Unlink it from its process group and free it.
*/
leavepgrp(p);
sx_xlock(&allproc_lock);
LIST_REMOVE(p, p_list); /* off zombproc */
sx_xunlock(&allproc_lock);
sx_xlock(&proctree_lock);
LIST_REMOVE(p, p_sibling);
sx_xunlock(&proctree_lock);
PROC_LOCK(p);
if (--p->p_procsig->ps_refcnt == 0) {
if (p->p_sigacts != &p->p_addr->u_sigacts)
FREE(p->p_sigacts, M_SUBPROC);
FREE(p->p_procsig, M_SUBPROC);
p->p_procsig = NULL;
}
PROC_UNLOCK(p);
/*
* Give machine-dependent layer a chance