summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-04-10 15:50:52 +0000
committerguenther <guenther@openbsd.org>2012-04-10 15:50:52 +0000
commite6fd2ff84860d099ea5ae17d34f29629f598ebc7 (patch)
tree583b593e87386d627543d084f7eab708e15180d9 /sys/kern/kern_exit.c
parentBuild with -O1 on vax for now, pcre_exec can not build with -O2. (diff)
downloadwireguard-openbsd-e6fd2ff84860d099ea5ae17d34f29629f598ebc7.tar.xz
wireguard-openbsd-e6fd2ff84860d099ea5ae17d34f29629f598ebc7.zip
Make the KERN_NPROCS and KERN_MAXPROC sysctl()s and the RLIMIT_NPROC rlimit
count processes instead of threads. New sysctl()s KERN_NTHREADS and KERN_MAXTHREAD count and limit threads. The nprocs and maxproc kernel variables are replaced by nprocess, maxprocess, nthreads, and maxthread. ok tedu@ mikeb@
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index a715cd1f1b0..8b5fe9d463a 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.110 2012/04/06 02:18:49 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.111 2012/04/10 15:50:52 guenther Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -584,13 +584,14 @@ proc_zap(struct proc *p)
if ((p->p_flag & P_THREAD) == 0)
leavepgrp(pr);
LIST_REMOVE(p, p_list); /* off zombproc */
- if ((p->p_flag & P_THREAD) == 0)
+ if ((p->p_flag & P_THREAD) == 0) {
LIST_REMOVE(pr, ps_sibling);
- /*
- * Decrement the count of procs running with this uid.
- */
- (void)chgproccnt(p->p_cred->p_ruid, -1);
+ /*
+ * Decrement the count of procs running with this uid.
+ */
+ (void)chgproccnt(p->p_cred->p_ruid, -1);
+ }
/*
* Release reference to text vnode
@@ -611,8 +612,9 @@ proc_zap(struct proc *p)
crfree(pr->ps_cred->pc_ucred);
pool_put(&pcred_pool, pr->ps_cred);
pool_put(&process_pool, pr);
+ nprocesses--;
}
pool_put(&proc_pool, p);
- nprocs--;
+ nthreads--;
}