diff options
-rw-r--r-- | sys/kern/init_main.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_prot.c | 10 | ||||
-rw-r--r-- | sys/sys/proc.h | 3 |
5 files changed, 10 insertions, 14 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 6c119c427c6..c9b542c33bf 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.151 2008/10/09 06:31:53 guenther Exp $ */ +/* $OpenBSD: init_main.c,v 1.152 2008/10/10 14:35:06 deraadt Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -256,7 +256,6 @@ main(void *framep) process0.ps_mainproc = p; TAILQ_INIT(&process0.ps_threads); TAILQ_INSERT_TAIL(&process0.ps_threads, p, p_thr_link); - process0.ps_refcnt = 1; p->p_p = &process0; LIST_INSERT_HEAD(&allproc, p, p_list); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 8fc0cecb17b..2c81bc73348 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.74 2008/10/09 06:31:53 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.75 2008/10/10 14:35:06 deraadt Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -590,7 +590,7 @@ 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) { + if ((p->p_flag & P_THREAD) == 0) { KASSERT(TAILQ_EMPTY(&p->p_p->ps_threads)); limfree(p->p_p->ps_limit); if (--p->p_p->ps_cred->p_refcnt == 0) { diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 42a57f07ee0..83ad6805002 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.96 2008/10/09 06:31:53 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.97 2008/10/10 14:35:06 deraadt Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -161,7 +161,6 @@ process_new(struct proc *newproc, struct proc *parent) pr->ps_mainproc = newproc; TAILQ_INIT(&pr->ps_threads); TAILQ_INSERT_TAIL(&pr->ps_threads, newproc, p_thr_link); - pr->ps_refcnt = 1; newproc->p_p = pr; } @@ -232,7 +231,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, atomic_setbits_int(&p2->p_flag, P_THREAD); p2->p_p = p1->p_p; TAILQ_INSERT_TAIL(&p2->p_p->ps_threads, p2, p_thr_link); - p2->p_p->ps_refcnt++; } else { process_new(p2, p1); } diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 08cbc54dcaa..039b0cbad36 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.32 2008/10/09 06:34:10 guenther Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.33 2008/10/10 14:35:06 deraadt Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -377,8 +377,8 @@ sys_setresuid(struct proc *p, void *v, register_t *retval) /* * Transfer proc count to new user. */ - (void)chgproccnt(pc->p_ruid, -p->p_p->ps_refcnt); - (void)chgproccnt(ruid, p->p_p->ps_refcnt); + (void)chgproccnt(pc->p_ruid, -1); + (void)chgproccnt(ruid, 1); pc->p_ruid = ruid; } if (euid != (uid_t)-1 && euid != pc->pc_ucred->cr_uid) { @@ -582,8 +582,8 @@ sys_setuid(struct proc *p, void *v, register_t *retval) * Transfer proc count to new user. */ if (uid != pc->p_ruid) { - (void)chgproccnt(pc->p_ruid, -p->p_p->ps_refcnt); - (void)chgproccnt(uid, p->p_p->ps_refcnt); + (void)chgproccnt(pc->p_ruid, -1); + (void)chgproccnt(uid, 1); } pc->p_ruid = uid; pc->p_svuid = uid; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index c1547b6b7c0..241c3dde75e 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.106 2008/10/09 06:31:53 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.107 2008/10/10 14:35:06 deraadt Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -143,7 +143,6 @@ struct process { struct plimit *ps_limit; /* Process limits. */ TAILQ_HEAD(,proc) ps_threads; /* Threads in this process. */ - int ps_refcnt; /* Number of references. */ }; #else struct process; |