1 /* The kernel call implemented in this file:
4 * The parameters for this kernel call are:
5 * m_lsys_krn_sys_times.endpt (get info for this process)
6 * m_krn_lsys_sys_times.user_time (return values ...)
7 * m_krn_lsys_sys_times.system_time
8 * m_krn_lsys_sys_times.boot_time
9 * m_krn_lsys_sys_times.boot_ticks
10 * m_krn_lsys_sys_times.real_ticks
13 #include "kernel/system.h"
15 #include <minix/endpoint.h>
19 /*===========================================================================*
21 *===========================================================================*/
22 int do_times(struct proc
* caller
, message
* m_ptr
)
24 /* Handle sys_times(). Retrieve the accounting information. */
25 register const struct proc
*rp
;
29 /* Insert the times needed by the SYS_TIMES kernel call in the message.
30 * The clock's interrupt handler may run to update the user or system time
31 * while in this code, but that cannot do any harm.
33 e_proc_nr
= (m_ptr
->m_lsys_krn_sys_times
.endpt
== SELF
) ?
34 caller
->p_endpoint
: m_ptr
->m_lsys_krn_sys_times
.endpt
;
35 if(e_proc_nr
!= NONE
&& isokendpt(e_proc_nr
, &proc_nr
)) {
36 rp
= proc_addr(proc_nr
);
37 m_ptr
->m_krn_lsys_sys_times
.user_time
= rp
->p_user_time
;
38 m_ptr
->m_krn_lsys_sys_times
.system_time
= rp
->p_sys_time
;
40 m_ptr
->m_krn_lsys_sys_times
.boot_ticks
= get_monotonic();
41 m_ptr
->m_krn_lsys_sys_times
.real_ticks
= get_realtime();
42 m_ptr
->m_krn_lsys_sys_times
.boot_time
= get_boottime();
46 #endif /* USE_TIMES */