summaryrefslogtreecommitdiff
path: root/sys/kern/kern_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_time.c')
-rw-r--r--sys/kern/kern_time.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 1a6819835a44..3b62532d9a1f 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -157,21 +157,23 @@ clock_gettime(struct thread *td, struct clock_gettime_args *uap)
{
struct timespec ats;
struct timeval sys, user;
+ struct proc *p;
+ p = td->td_proc;
switch (uap->clock_id) {
case CLOCK_REALTIME:
nanotime(&ats);
break;
case CLOCK_VIRTUAL:
- mtx_lock_spin(&sched_lock);
- calcru(td->td_proc, &user, &sys, NULL);
- mtx_unlock_spin(&sched_lock);
+ PROC_LOCK(p);
+ calcru(p, &user, &sys);
+ PROC_UNLOCK(p);
TIMEVAL_TO_TIMESPEC(&user, &ats);
break;
case CLOCK_PROF:
- mtx_lock_spin(&sched_lock);
- calcru(td->td_proc, &user, &sys, NULL);
- mtx_unlock_spin(&sched_lock);
+ PROC_LOCK(p);
+ calcru(p, &user, &sys);
+ PROC_UNLOCK(p);
timevaladd(&user, &sys);
TIMEVAL_TO_TIMESPEC(&user, &ats);
break;