diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2004-10-05 18:51:11 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2004-10-05 18:51:11 +0000 |
| commit | 78c85e8dfc1c4a90a3ecb51acf35c33fe1faf331 (patch) | |
| tree | 61af271e7225bd0154aaa08a967c5ce027c7bc2a /sys/alpha | |
| parent | a55db2b6e63b4d36024857d89a7ab59747f17d97 (diff) | |
Notes
Diffstat (limited to 'sys/alpha')
| -rw-r--r-- | sys/alpha/osf1/osf1_misc.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c index 9cebf524dbfb..8f3a7b26a42a 100644 --- a/sys/alpha/osf1/osf1_misc.c +++ b/sys/alpha/osf1/osf1_misc.c @@ -1335,29 +1335,16 @@ osf1_getrusage(td, uap) struct thread *td; struct osf1_getrusage_args *uap; { - struct proc *p; - struct rusage *rup; struct osf1_rusage oru; + struct rusage ru; + int error; - p = td->td_proc; - switch (uap->who) { - case RUSAGE_SELF: - rup = &p->p_stats->p_ru; - mtx_lock_spin(&sched_lock); - calcru(p, &rup->ru_utime, &rup->ru_stime, NULL); - mtx_unlock_spin(&sched_lock); - break; - - case RUSAGE_CHILDREN: - rup = &p->p_stats->p_cru; - break; - - default: - return (EINVAL); - } - TV_CP(rup->ru_utime, oru.ru_utime); - TV_CP(rup->ru_stime, oru.ru_stime); - bcopy(&(rup->ru_first), &(oru.ru_first), + error = kern_getrusage(td, uap->who, &ru); + if (error) + return (error); + TV_CP(ru.ru_utime, oru.ru_utime); + TV_CP(ru.ru_stime, oru.ru_stime); + bcopy(&(ru.ru_first), &(oru.ru_first), (&(oru.ru_last) - &(oru.ru_first))); return (copyout((caddr_t)&oru, (caddr_t)uap->rusage, @@ -1372,9 +1359,13 @@ osf1_wait4(td, uap) { int error, status; struct osf1_rusage oru; - struct rusage ru; + struct rusage ru, *rup; - error = kern_wait(td, uap->pid, &status, uap->options, &ru); + if (uap->rusage != NULL) + rup = &ru; + else + rup = NULL; + error = kern_wait(td, uap->pid, &status, uap->options, rup); if (error) return (error); if (uap->status != NULL) |
