From 12d804e413f2c44d9e10f25ee1b546f2b48c598b Mon Sep 17 00:00:00 2001 From: attilio Date: Sat, 9 Jun 2007 21:48:44 +0000 Subject: rufetch and calcru sometimes should be called atomically together. This patch fixes places where they should be called atomically changing their locking requirements (both assume per-proc spinlock held) and introducing rufetchcalc which wrappers both calls to be performed in atomic way. Reviewed by: jeff Approved by: jeff (mentor) --- sys/kern/kern_exit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sys/kern/kern_exit.c') diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 58abd2e..7700a8f 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -705,16 +705,14 @@ loop: nfound++; PROC_SLOCK(p); if (p->p_state == PRS_ZOMBIE) { - PROC_SUNLOCK(p); - - td->td_retval[0] = p->p_pid; - if (status) - *status = p->p_xstat; /* convert to int */ if (rusage) { *rusage = p->p_ru; calcru(p, &rusage->ru_utime, &rusage->ru_stime); } - + PROC_SUNLOCK(p); + td->td_retval[0] = p->p_pid; + if (status) + *status = p->p_xstat; /* convert to int */ PROC_LOCK(q); sigqueue_take(p->p_ksi); PROC_UNLOCK(q); -- cgit v1.1