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