X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/24fd64abccba45cfed51041350325e0a2a23fec7..82b95dadf0c41114ff61f957305f0a6a7201f335:/sys/kern/kern_exit.c diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 34a8eb26e1..61093105ed 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)kern_exit.c 7.35 (Berkeley) 6/27/91 - * $Id: kern_exit.c,v 1.11 1993/12/19 00:51:24 wollman Exp $ + * $Id: kern_exit.c,v 1.14 1994/01/29 04:04:23 davidg Exp $ */ #include "param.h" @@ -158,7 +158,7 @@ kexit(p, rv) (void) ttywait(sp->s_ttyp); vgoneall(sp->s_ttyvp); } - vrele(sp->s_ttyvp); + vn_close(sp->s_ttyvp, FREAD, p->p_ucred, p); sp->s_ttyvp = NULL; /* * s_ttyp is not zero'd; we use this to indicate @@ -175,19 +175,9 @@ kexit(p, rv) * release trace file */ if (p->p_tracep) - vrele(p->p_tracep); + vn_close(p->p_tracep, FREAD|FWRITE, p->p_ucred, p); #endif - /* current process does not exist, as far as other parts of the - * system (clock) is concerned, since parts of it might not be - * there anymore */ - curproc = NULL; - - if (--p->p_limit->p_refcnt == 0) { - FREE(p->p_limit, M_SUBPROC); - p->p_limit = (struct plimit *) -1; - } - /* * Remove proc from allproc queue and pidhash chain. * Place onto zombproc. Unlink from parent's child list. @@ -250,6 +240,18 @@ done: /* move this to cpu_exit */ p->p_addr->u_pcb.pcb_savacc.faddr = (float *)NULL; #endif + /* + * current process does not exist, as far as other parts of the + * system (clock) is concerned, since parts of it might not be + * there anymore + */ + curproc = NULL; + + if (--p->p_limit->p_refcnt == 0) { + FREE(p->p_limit, M_SUBPROC); + p->p_limit = (struct plimit *) -1; + } + /* * Finally, call machine-dependent code to release the remaining * resources including address space, the kernel stack and pcb. @@ -351,6 +353,9 @@ loop: continue; nfound++; if (p->p_stat == SZOMB) { + /* charge childs cpu usage to parent */ + if( curproc->p_pid != 1) + curproc->p_cpu += p->p_cpu; retval[0] = p->p_pid; #ifdef COMPAT_43 if (uap->compat)