source: branches/minix3-book/kernel/system/do_times.c@ 25

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

Importazione sorgenti libro

File size: 1.2 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_PROC_NR (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#if USE_TIMES
14
15/*===========================================================================*
16 * do_times *
17 *===========================================================================*/
18PUBLIC int do_times(m_ptr)
19register message *m_ptr; /* pointer to request message */
20{
21/* Handle sys_times(). Retrieve the accounting information. */
22 register struct proc *rp;
23 int proc_nr;
24
25 /* Insert the times needed by the SYS_TIMES kernel call in the message.
26 * The clock's interrupt handler may run to update the user or system time
27 * while in this code, but that cannot do any harm.
28 */
29 proc_nr = (m_ptr->T_PROC_NR == SELF) ? m_ptr->m_source : m_ptr->T_PROC_NR;
30 if (isokprocn(proc_nr)) {
31 rp = proc_addr(m_ptr->T_PROC_NR);
32 m_ptr->T_USER_TIME = rp->p_user_time;
33 m_ptr->T_SYSTEM_TIME = rp->p_sys_time;
34 }
35 m_ptr->T_BOOT_TICKS = get_uptime();
36 return(OK);
37}
38
39#endif /* USE_TIMES */
40
Note: See TracBrowser for help on using the repository browser.