d91f738bd8
Please note that this information is for use by system services only! The clock facility is not ready to be used directly by userland, and thus, this kernel page extension is NOT part of the userland ABI. For service programmers' convenience, change the prototype of the getticks(3) to return the uptime clock value directly, since the call can no longer fail. Correct the sys_times(2) reply message to use the right field type for the boot time. Restructure the kernel internals a bit so as to have all the clock stuff closer together. Change-Id: Ifc050b7bd253aecbe46e3bd7d7cc75bd86e45555
46 lines
1.6 KiB
C
46 lines
1.6 KiB
C
/* 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 */
|