7 #include <sys/resource.h>
9 int getrusage(int who
, struct rusage
*r_usage
)
14 memset(&m
, 0, sizeof(m
));
15 m
.m_lc_pm_rusage
.who
= who
;
16 m
.m_lc_pm_rusage
.addr
= (vir_bytes
)r_usage
;
18 if (r_usage
== NULL
) {
22 if (who
!= RUSAGE_SELF
&& who
!= RUSAGE_CHILDREN
) {
27 memset(r_usage
, 0, sizeof(struct rusage
));
28 if ((rc
= _syscall(PM_PROC_NR
, PM_GETRUSAGE
, &m
)) < 0)
31 memset(&m
, 0, sizeof(m
));
32 m
.m_lc_vfs_rusage
.addr
= (vir_bytes
)r_usage
;
33 if ((rc
= _syscall(VFS_PROC_NR
, VFS_GETRUSAGE
, &m
)) < 0)
36 memset(&m
, 0, sizeof(m
));
37 m
.m_lc_vm_rusage
.addr
= (vir_bytes
)r_usage
;
38 return _syscall(VM_PROC_NR
, VM_GETRUSAGE
, &m
);