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 "../system.h"
14 #include <minix/endpoint.h>
18 /*===========================================================================*
20 *===========================================================================*/
21 PUBLIC
int do_times(m_ptr
)
22 register message
*m_ptr
; /* pointer to request message */
24 /* Handle sys_times(). Retrieve the accounting information. */
25 register struct proc
*rp
;
26 int proc_nr
, e_proc_nr
;
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
) ? m_ptr
->m_source
: 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 */