diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/init_main.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 19 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 3 | ||||
-rw-r--r-- | sys/sys/proc.h | 3 |
4 files changed, 13 insertions, 15 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 9d7601dbcae..4d90750370d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.167 2010/05/14 18:47:56 kettenis Exp $ */ +/* $OpenBSD: init_main.c,v 1.168 2010/06/29 20:25:57 guenther Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -290,7 +290,6 @@ main(void *framep) timeout_set(&p->p_realit_to, realitexpire, p); /* Create credentials. */ - cred0.p_refcnt = 1; p->p_cred = &cred0; p->p_ucred = crget(); p->p_ucred->cr_ngroups = 1; /* group 0 */ diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 7cd416720b4..d8fc8a2e97e 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.93 2010/06/29 00:28:14 tedu Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.94 2010/06/29 20:25:57 guenther Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -557,6 +557,8 @@ proc_reparent(struct proc *child, struct proc *parent) void proc_zap(struct proc *p) { + struct process *pr; + pool_put(&rusage_pool, p->p_ru); if (p->p_ptstat) free(p->p_ptstat, M_SUBPROC); @@ -586,14 +588,13 @@ proc_zap(struct proc *p) * Remove us from our process list, possibly killing the process * in the process (pun intended). */ - if (--p->p_p->ps_refcnt == 0) { - KASSERT(TAILQ_EMPTY(&p->p_p->ps_threads)); - limfree(p->p_p->ps_limit); - if (--p->p_p->ps_cred->p_refcnt == 0) { - crfree(p->p_p->ps_cred->pc_ucred); - pool_put(&pcred_pool, p->p_p->ps_cred); - } - pool_put(&process_pool, p->p_p); + pr = p->p_p; + if (--pr->ps_refcnt == 0) { + KASSERT(TAILQ_EMPTY(&pr->ps_threads)); + limfree(pr->ps_limit); + crfree(pr->ps_cred->pc_ucred); + pool_put(&pcred_pool, pr->ps_cred); + pool_put(&process_pool, pr); } pool_put(&proc_pool, p); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 4a1c23ba336..1e31a449f8a 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.115 2010/06/29 20:14:46 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.116 2010/06/29 20:25:57 guenther Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -284,7 +284,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, if ((flags & FORK_THREAD) == 0) { p2->p_p->ps_cred = pool_get(&pcred_pool, PR_WAITOK); bcopy(p1->p_p->ps_cred, p2->p_p->ps_cred, sizeof(*p2->p_p->ps_cred)); - p2->p_p->ps_cred->p_refcnt = 1; crhold(p1->p_ucred); } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 924e96e047d..e80e98536d4 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.127 2010/05/18 22:26:10 tedu Exp $ */ +/* $OpenBSD: proc.h,v 1.128 2010/06/29 20:25:57 guenther Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -331,7 +331,6 @@ struct pcred { uid_t p_svuid; /* Saved effective user id. */ gid_t p_rgid; /* Real group id. */ gid_t p_svgid; /* Saved effective group id. */ - int p_refcnt; /* Number of references. */ }; #ifdef _KERNEL |