source: trunk/minix/kernel/system/do_times.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.3 KB
Line 
1/* The kernel call implemented in this file:
2 * m_type: SYS_TIMES
3 *
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_l5: T_BOOT_TICKS
9 */
10
11#include "../system.h"
12
13#include <minix/endpoint.h>
14
15#if USE_TIMES
16
17/*===========================================================================*
18 * do_times *
19 *===========================================================================*/
20PUBLIC int do_times(m_ptr)
21register message *m_ptr; /* pointer to request message */
22{
23/* Handle sys_times(). Retrieve the accounting information. */
24 register struct proc *rp;
25 int proc_nr, e_proc_nr;
26
27 /* Insert the times needed by the SYS_TIMES kernel call in the message.
28 * The clock's interrupt handler may run to update the user or system time
29 * while in this code, but that cannot do any harm.
30 */
31 e_proc_nr = (m_ptr->T_ENDPT == SELF) ? m_ptr->m_source : m_ptr->T_ENDPT;
32 if(e_proc_nr != NONE && isokendpt(e_proc_nr, &proc_nr)) {
33 rp = proc_addr(proc_nr);
34 m_ptr->T_USER_TIME = rp->p_user_time;
35 m_ptr->T_SYSTEM_TIME = rp->p_sys_time;
36 }
37 m_ptr->T_BOOT_TICKS = get_uptime();
38 return(OK);
39}
40
41#endif /* USE_TIMES */
42
Note: See TracBrowser for help on using the repository browser.