summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-01-24 04:26:51 +0000
committerguenther <guenther@openbsd.org>2014-01-24 04:26:51 +0000
commit7f86807e649df931dbf7fc268f5714a0227072a5 (patch)
treeb84b7388581f30ac3fb4cd7ef642ae08cd096eff /sys/kern/kern_exit.c
parentdrm/i915: Move num_pipes to intel info (diff)
downloadwireguard-openbsd-7f86807e649df931dbf7fc268f5714a0227072a5.tar.xz
wireguard-openbsd-7f86807e649df931dbf7fc268f5714a0227072a5.zip
exit1() needs to do a final aggregation of the thread's [us]ticks
and runtime to the process totals. Also, add ktracing of struct rusage in wait4() and getrusage(). problem pointed out by tedu@ ok deraadt@
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 8898850f9aa..113561cc64d 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.132 2014/01/21 06:22:37 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.133 2014/01/24 04:26:51 guenther Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -318,6 +318,7 @@ exit1(struct proc *p, int rv, int flags)
/* add thread's accumulated rusage into the process's total */
ruadd(rup, &p->p_ru);
+ tuagg(pr, p);
/*
* clear %cpu usage during swap
@@ -493,6 +494,10 @@ sys_wait4(struct proc *q, void *v, register_t *retval)
}
if (error == 0 && SCARG(uap, rusage)) {
error = copyout(&ru, SCARG(uap, rusage), sizeof(ru));
+#ifdef KTRACE
+ if (error == 0 && KTRPOINT(q, KTR_STRUCT))
+ ktrrusage(q, &ru);
+#endif
}
return (error);
}