diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index d9aeecfce815..feb830a75d48 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -42,6 +42,7 @@ */ #include +#include #include #include #include @@ -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 { diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index d0cfa5219f9d..83fca78c4ede 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -467,7 +467,7 @@ proc0_post(void *dummy __unused) */ sx_slock(&allproc_lock); LIST_FOREACH(p, &allproc, p_list) { - microtime(&p->p_stats->p_start); + microuptime(&p->p_stats->p_start); p->p_runtime.sec = 0; p->p_runtime.frac = 0; } diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 9de46418695a..19e5b1c038a9 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -250,8 +250,10 @@ acct_process(td) acct.ac_stime = encode_comp_t(st.tv_sec, st.tv_usec); /* (3) The elapsed time the command ran (and its starting time) */ - acct.ac_btime = p->p_stats->p_start.tv_sec; - microtime(&tmp); + tmp = boottime; + timevaladd(&tmp, &p->p_stats->p_start); + acct.ac_btime = tmp.tv_sec; + microuptime(&tmp); timevalsub(&tmp, &p->p_stats->p_start); acct.ac_etime = encode_comp_t(tmp.tv_sec, tmp.tv_usec); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 1cc9580904ab..7d2c65ca1e9f 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -686,7 +686,7 @@ fork1(td, flags, pages, procp) * If RFSTOPPED not requested, make child runnable and add to * run queue. */ - microtime(&(p2->p_stats->p_start)); + microuptime(&p2->p_stats->p_start); if ((flags & RFSTOPPED) == 0) { mtx_lock_spin(&sched_lock); p2->p_state = PRS_NORMAL; diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 46fa97c64874..d4846dda9635 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -79,7 +79,7 @@ kthread_create(void (*func)(void *), void *arg, struct thread *td; struct proc *p2; - if (!proc0.p_stats /* || proc0.p_stats->p_start.tv_sec == 0 */) + if (!proc0.p_stats) panic("kthread_create called too soon"); error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 111c0f20d959..5ad78829474f 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; diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c index ac0f3817b34b..183886e8b036 100644 --- a/sys/nfsclient/nfs_lock.c +++ b/sys/nfsclient/nfs_lock.c @@ -115,6 +115,7 @@ nfs_dolock(struct vop_advlock_args *ap) MALLOC(p->p_nlminfo, struct nlminfo *, sizeof(struct nlminfo), M_LOCKF, M_WAITOK | M_ZERO); p->p_nlminfo->pid_start = p->p_stats->p_start; + timevaladd(&p->p_nlminfo->pid_start, &boottime); } msg.lm_msg_ident.pid_start = p->p_nlminfo->pid_start; msg.lm_msg_ident.msg_seq = ++(p->p_nlminfo->msg_seq);