summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-03-31 19:22:11 +0000
committertrasz <trasz@FreeBSD.org>2011-03-31 19:22:11 +0000
commit4c83b1bba4b449bdd0b62585ba1ebe3163ef107c (patch)
tree4d811cbdd5ef5640877c96685d01fe33cad06e1e /sys/kern/kern_exit.c
parent596c078ed8b0a61497f5b46a4d05593182e0f69d (diff)
downloadFreeBSD-src-4c83b1bba4b449bdd0b62585ba1ebe3163ef107c.zip
FreeBSD-src-4c83b1bba4b449bdd0b62585ba1ebe3163ef107c.tar.gz
Enable accounting for RACCT_NPROC and RACCT_NTHR.
Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version)
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 01d6b75..5fec31b 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -177,6 +177,7 @@ exit1(struct thread *td, int rv)
}
KASSERT(p->p_numthreads == 1,
("exit1: proc %p exiting with %d threads", p, p->p_numthreads));
+ racct_sub(p, RACCT_NTHR, 1);
/*
* Wakeup anyone in procfs' PIOCWAIT. They should have a hold
* on our vmspace, so we should block below until they have
@@ -745,6 +746,9 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options,
* Destroy resource accounting information associated with the process.
*/
racct_proc_exit(p);
+ PROC_LOCK(p->p_pptr);
+ racct_sub(p->p_pptr, RACCT_NPROC, 1);
+ PROC_UNLOCK(p->p_pptr);
/*
* Free credentials, arguments, and sigacts.
@@ -905,7 +909,11 @@ proc_reparent(struct proc *child, struct proc *parent)
if (child->p_pptr == parent)
return;
+ PROC_LOCK(parent);
+ racct_add_force(parent, RACCT_NPROC, 1);
+ PROC_UNLOCK(parent);
PROC_LOCK(child->p_pptr);
+ racct_sub(child->p_pptr, RACCT_NPROC, 1);
sigqueue_take(child->p_ksi);
PROC_UNLOCK(child->p_pptr);
LIST_REMOVE(child, p_sibling);
OpenPOWER on IntegriCloud