summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-05-01 16:59:23 +0000
committerdes <des@FreeBSD.org>2003-05-01 16:59:23 +0000
commit8ed712ead15fc26b5070dcac9458f31fc6ecf0fa (patch)
treed8221c44ce99320f82809d2b7504a757957a47c4 /sys/kern/kern_proc.c
parenteaf3fff90a28f606675fd3c1610d0def28d6be67 (diff)
downloadFreeBSD-src-8ed712ead15fc26b5070dcac9458f31fc6ecf0fa.zip
FreeBSD-src-8ed712ead15fc26b5070dcac9458f31fc6ecf0fa.tar.gz
Instead of recording the Unix time in a process when it starts, record the
uptime. Where necessary, convert it back to Unix time by adding boottime to it. This fixes a potential problem in the accounting code, which would compute the elapsed time incorrectly if the Unix time was stepped during the lifetime of the process.
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 111c0f2..5ad7882 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -677,8 +677,7 @@ fill_kinfo_proc(p, kp)
}
if ((p->p_sflag & PS_INMEM) && p->p_stats) {
kp->ki_start = p->p_stats->p_start;
- if (kp->ki_start.tv_sec < 3600)
- kp->ki_start.tv_sec += boottime.tv_sec;
+ timevaladd(&kp->ki_start, &boottime);
kp->ki_rusage = p->p_stats->p_ru;
kp->ki_childtime.tv_sec = p->p_stats->p_cru.ru_utime.tv_sec +
p->p_stats->p_cru.ru_stime.tv_sec;
OpenPOWER on IntegriCloud