summaryrefslogtreecommitdiffstats
path: root/sys/fs
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/fs
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/fs')
-rw-r--r--sys/fs/procfs/procfs_status.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c
index d9aeecf..feb830a 100644
--- a/sys/fs/procfs/procfs_status.c
+++ b/sys/fs/procfs/procfs_status.c
@@ -42,6 +42,7 @@
*/
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/lock.h>
@@ -129,13 +130,14 @@ procfs_doprocstatus(PFS_FILL_ARGS)
}
if (p->p_sflag & PS_INMEM) {
- struct timeval ut, st;
+ struct timeval start, ut, st;
calcru(p, &ut, &st, (struct timeval *) NULL);
mtx_unlock_spin(&sched_lock);
- sbuf_printf(sb, " %lld,%ld %ld,%ld %ld,%ld",
- (long long)p->p_stats->p_start.tv_sec,
- p->p_stats->p_start.tv_usec,
+ start = p->p_stats->p_start;
+ timevaladd(&start, &boottime);
+ sbuf_printf(sb, " %ld,%ld %ld,%ld %ld,%ld",
+ start.tv_sec, start.tv_usec,
ut.tv_sec, ut.tv_usec,
st.tv_sec, st.tv_usec);
} else {
OpenPOWER on IntegriCloud