summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.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_resource.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_resource.c')
-rw-r--r--sys/kern/kern_resource.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index ef26fa57864..bec11baaf07 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_resource.c,v 1.48 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.49 2014/01/24 04:26:51 guenther Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
@@ -53,7 +53,6 @@
#include <uvm/uvm_extern.h>
void tuagg_sub(struct tusage *, struct proc *);
-void tuagg(struct process *, struct proc *);
/*
* Patchable maximum data and stack limits.
@@ -428,8 +427,13 @@ sys_getrusage(struct proc *p, void *v, register_t *retval)
int error;
error = dogetrusage(p, SCARG(uap, who), &ru);
- if (error == 0)
+ if (error == 0) {
error = copyout(&ru, SCARG(uap, rusage), sizeof(ru));
+#ifdef KTRACE
+ if (error == 0 && KTRPOINT(p, KTR_STRUCT))
+ ktrrusage(p, &ru);
+#endif
+ }
return (error);
}