coverity appeasement
[minix.git] / kernel / system / do_times.c
blob16a646a1d9281d630955377cf896cb9ff5a4b2d5
1 /* The kernel call implemented in this file:
2 * m_type: SYS_TIMES
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 ...)
7 * m4_l2: T_SYSTEM_TIME
8 * m4_l3: T_BOOTTIME
9 * m4_l5: T_BOOT_TICKS
12 #include "kernel/system.h"
14 #include <minix/endpoint.h>
16 #if USE_TIMES
18 /*===========================================================================*
19 * do_times *
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;
25 int proc_nr;
26 endpoint_t 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) ? 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;
40 return(OK);
43 #endif /* USE_TIMES */