diff options
Diffstat (limited to 'sys/kern/kern_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 6a742b0e160c..e1deb4d855fe 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.9 1993/10/19 01:01:20 nate Exp $ + * $Id: kern_exit.c,v 1.14 1994/01/29 04:04:23 davidg Exp $ */ #include "param.h" @@ -48,6 +48,7 @@ #include "vnode.h" #include "syslog.h" #include "malloc.h" +#include "signalvar.h" #include "resourcevar.h" #include "machine/cpu.h" @@ -117,6 +118,10 @@ kexit(p, rv) */ fdfree(p); +#ifdef SYSVSEM + semexit(p); +#endif + /* The next two chunks should probably be moved to vmspace_exit. */ #ifdef SYSVSHM if (p->p_vmspace->vm_shm) @@ -153,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 @@ -170,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. @@ -246,6 +241,18 @@ done: 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. * The address space is released by "vmspace_free(p->p_vmspace)"; @@ -258,7 +265,24 @@ done: /* NOTREACHED */ } +/* + * Wait: check child processes to see if any have exited, + * stopped under trace, or (optionally) stopped by a signal. + * Pass back status and deallocate exited child's proc structure. + */ + +struct wait1_args { + int pid; + int *status; + int options; + struct rusage *rusage; #ifdef COMPAT_43 + int compat; +#endif +}; + +#ifdef COMPAT_43 +static int wait1(struct proc *, struct wait1_args *, int *); struct owait_args { int pid; @@ -268,6 +292,7 @@ struct owait_args { int compat; }; +int owait(p, uap, retval) struct proc *p; register struct owait_args *uap; @@ -279,7 +304,7 @@ owait(p, uap, retval) uap->pid = WAIT_ANY; uap->status = 0; uap->compat = 1; - return (wait1(p, uap, retval)); + return (wait1(p, (struct wait1_args *)uap, retval)); } struct wait4_args { @@ -290,6 +315,7 @@ struct wait4_args { int compat; }; +int wait4(p, uap, retval) struct proc *p; struct wait4_args *uap; @@ -297,28 +323,13 @@ wait4(p, uap, retval) { uap->compat = 0; - return (wait1(p, uap, retval)); + return (wait1(p, (struct wait1_args *)uap, retval)); } #else #define wait1 wait4 #endif -/* - * Wait: check child processes to see if any have exited, - * stopped under trace, or (optionally) stopped by a signal. - * Pass back status and deallocate exited child's proc structure. - */ - -struct wait1_args { - int pid; - int *status; - int options; - struct rusage *rusage; -#ifdef COMPAT_43 - int compat; -#endif -}; - +static int wait1(q, uap, retval) register struct proc *q; register struct wait1_args *uap; |
