summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
committerRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
commit3e0bf52f358eb969d165c4b1e54942ee94cf2c8d (patch)
tree440bb9907871a5bc578d65b32f0c4aa339096175 /sys/kern/kern_exit.c
parent4b4ac714f11471e43f18410bcc86da8f9dc3b88c (diff)
parente357bdb742b2696dcb81404917b6247f9e840232 (diff)
downloadFreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.zip
FreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index d00a554..76b4427 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -660,7 +660,9 @@ exit1(struct thread *td, int rv)
/*
* Save our children's rusage information in our exit rusage.
*/
+ PROC_STATLOCK(p);
ruadd(&p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+ PROC_STATUNLOCK(p);
/*
* Make sure the scheduler takes this thread out of its tables etc.
@@ -1044,8 +1046,6 @@ proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id,
return (0);
}
- PROC_SLOCK(p);
-
if (siginfo != NULL) {
bzero(siginfo, sizeof(*siginfo));
siginfo->si_errno = 0;
@@ -1092,7 +1092,9 @@ proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id,
if (wrusage != NULL) {
rup = &wrusage->wru_self;
*rup = p->p_ru;
+ PROC_STATLOCK(p);
calcru(p, &rup->ru_utime, &rup->ru_stime);
+ PROC_STATUNLOCK(p);
rup = &wrusage->wru_children;
*rup = p->p_stats->p_cru;
@@ -1100,10 +1102,10 @@ proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id,
}
if (p->p_state == PRS_ZOMBIE && !check_only) {
+ PROC_SLOCK(p);
proc_reap(td, p, status, options);
return (-1);
}
- PROC_SUNLOCK(p);
PROC_UNLOCK(p);
return (1);
}
OpenPOWER on IntegriCloud