summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r--sys/compat/linux/linux_misc.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 3f08028..f17e0ad 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -689,9 +689,9 @@ struct l_times_argv {
int
linux_times(struct thread *td, struct linux_times_args *args)
{
- struct timeval tv;
+ struct timeval tv, utime, stime, cutime, cstime;
struct l_times_argv tms;
- struct rusage ru;
+ struct proc *p;
int error;
#ifdef DEBUG
@@ -699,15 +699,17 @@ linux_times(struct thread *td, struct linux_times_args *args)
printf(ARGS(times, "*"));
#endif
- mtx_lock_spin(&sched_lock);
- calcru(td->td_proc, &ru.ru_utime, &ru.ru_stime, NULL);
- mtx_unlock_spin(&sched_lock);
+ p = td->td_proc;
+ PROC_LOCK(p);
+ calcru(p, &utime, &stime);
+ calccru(p, &cutime, &cstime);
+ PROC_UNLOCK(p);
- tms.tms_utime = CONVTCK(ru.ru_utime);
- tms.tms_stime = CONVTCK(ru.ru_stime);
+ tms.tms_utime = CONVTCK(utime);
+ tms.tms_stime = CONVTCK(stime);
- tms.tms_cutime = CONVTCK(td->td_proc->p_stats->p_cru.ru_utime);
- tms.tms_cstime = CONVTCK(td->td_proc->p_stats->p_cru.ru_stime);
+ tms.tms_cutime = CONVTCK(cutime);
+ tms.tms_cstime = CONVTCK(cstime);
if ((error = copyout(&tms, args->buf, sizeof(tms))))
return error;
@@ -851,7 +853,7 @@ int
linux_wait4(struct thread *td, struct linux_wait4_args *args)
{
int error, options, tmpstat;
- struct rusage ru;
+ struct rusage ru, *rup;
struct proc *p;
#ifdef DEBUG
@@ -866,7 +868,11 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args)
if (args->options & __WCLONE)
options |= WLINUXCLONE;
- error = kern_wait(td, args->pid, &tmpstat, options, &ru);
+ if (args->rusage != NULL)
+ rup = &ru;
+ else
+ rup = NULL;
+ error = kern_wait(td, args->pid, &tmpstat, options, rup);
if (error)
return error;
OpenPOWER on IntegriCloud