summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-10 14:35:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-10 14:35:07 +0000
commit0642d6c99ec292a993ae1b7d730a53f5b8f26706 (patch)
tree23094db2d92a14e6cd16d75c1d17370feb06cfb5 /sys/kern
parenteb739b33c48b5669bd86991324aa9d54853ae318 (diff)
backout; is causing some people difficulty
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c3
-rw-r--r--sys/kern/kern_exit.c4
-rw-r--r--sys/kern/kern_fork.c4
-rw-r--r--sys/kern/kern_prot.c10
4 files changed, 9 insertions, 12 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;