Added lance entry to drivers.conf.
[minix3-old.git] / kernel / system / do_times.c
blob36ecf00e93db38501f1e903af011bafaea51003e
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 "../system.h"
14 #include <minix/endpoint.h>
16 #if USE_TIMES
18 /*===========================================================================*
19 * do_times *
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;
40 return(OK);
43 #endif /* USE_TIMES */