1 /* The kernel call implemented in this file:
4 * The parameters for this kernel call are:
5 * m4_l1: T_ENDPT (get info for this process)
6 * m4_l1: T_USER_TIME (return values ...)
12 #include "kernel/system.h"
14 #include <minix/endpoint.h>
18 /*===========================================================================*
20 *===========================================================================*/
21 int do_times(struct proc
* caller
, message
* m_ptr
)
23 /* Handle sys_times(). Retrieve the accounting information. */
24 register const struct proc
*rp
;
28 /* Insert the times needed by the SYS_TIMES kernel call in the message.
29 * The clock's interrupt handler may run to update the user or system time
30 * while in this code, but that cannot do any harm.
32 e_proc_nr
= (m_ptr
->T_ENDPT
== SELF
) ? caller
->p_endpoint
: m_ptr
->T_ENDPT
;
33 if(e_proc_nr
!= NONE
&& isokendpt(e_proc_nr
, &proc_nr
)) {
34 rp
= proc_addr(proc_nr
);
35 m_ptr
->T_USER_TIME
= rp
->p_user_time
;
36 m_ptr
->T_SYSTEM_TIME
= rp
->p_sys_time
;
38 m_ptr
->T_BOOT_TICKS
= get_uptime();
39 m_ptr
->T_BOOTTIME
= boottime
;
43 #endif /* USE_TIMES */