From: Lionel Sambuc Date: Thu, 22 May 2014 09:32:14 +0000 (+0200) Subject: Message type for SYS_TIMES X-Git-Tag: v3.3.0~220 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-dsfromkey.html?a=commitdiff_plain;h=1ca0b449b29d5c92b603ab4a98072d62e30fc23e;p=minix.git Message type for SYS_TIMES Change-Id: Ia408aa7d76c47da9f600a724f82b347ba6ac641b --- diff --git a/include/minix/com.h b/include/minix/com.h index bb83ca374..a931d6dee 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -338,13 +338,7 @@ # define GET_REGS 24 /* get general process registers */ # define GET_RUSAGE 25 /* get resource usage */ -/* Field names for SYS_TIMES. */ -#define T_ENDPT m4_l1 /* process to request time info for */ -#define T_USER_TIME m4_l1 /* user time consumed by process */ -#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */ #define T_BOOTTIME m4_ll1 /* Boottime in seconds (also for SYS_STIME) */ -#define T_REAL_TICKS m4_l4 /* number of wall clock ticks since boottime */ -#define T_BOOT_TICKS m4_l5 /* number of hard clock ticks since boottime */ /* Field names for SYS_SETTIME. */ #define T_SETTIME_NOW m4_l2 /* non-zero for immediate, 0 for adjtime */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 768619a09..0f3e7fecc 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -784,6 +784,24 @@ typedef struct { } mess_lsys_krn_sys_setalarm; _ASSERT_MSG_SIZE(mess_lsys_krn_sys_setalarm); +typedef struct { + endpoint_t endpt; + + uint8_t padding[52]; +} mess_lsys_krn_sys_times; +_ASSERT_MSG_SIZE(mess_lsys_krn_sys_times); + +typedef struct { + clock_t real_ticks; + clock_t boot_ticks; + clock_t boot_time; + clock_t user_time; + clock_t system_time; + + uint8_t padding[36]; +} mess_krn_lsys_sys_times; +_ASSERT_MSG_SIZE(mess_krn_lsys_sys_times); + typedef struct { endpoint_t src_endpt; int segment; @@ -1490,6 +1508,7 @@ typedef struct { mess_krn_lsys_schedule m_krn_lsys_schedule; mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami; mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl; + mess_krn_lsys_sys_times m_krn_lsys_sys_times; mess_krn_lsys_sys_umap m_krn_lsys_sys_umap; mess_krn_lsys_sys_vumap m_krn_lsys_sys_vumap; @@ -1576,6 +1595,7 @@ typedef struct { mess_lsys_krn_sys_memset m_lsys_krn_sys_memset; mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio; mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm; + mess_lsys_krn_sys_times m_lsys_krn_sys_times; mess_lsys_krn_sys_umap m_lsys_krn_sys_umap; mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio; mess_lsys_krn_sys_vumap m_lsys_krn_sys_vumap; diff --git a/kernel/system/do_times.c b/kernel/system/do_times.c index b5d5cef25..3a8c0d5d3 100644 --- a/kernel/system/do_times.c +++ b/kernel/system/do_times.c @@ -2,11 +2,12 @@ * m_type: SYS_TIMES * * The parameters for this kernel call are: - * m4_l1: T_ENDPT (get info for this process) - * m4_l1: T_USER_TIME (return values ...) - * m4_l2: T_SYSTEM_TIME - * m4_ll1: T_BOOTTIME - * m4_l5: T_BOOT_TICKS + * 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" @@ -29,17 +30,17 @@ int do_times(struct proc * caller, message * m_ptr) * 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->T_ENDPT == SELF) ? caller->p_endpoint : m_ptr->T_ENDPT; + 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->T_USER_TIME = rp->p_user_time; - m_ptr->T_SYSTEM_TIME = rp->p_sys_time; + 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->T_BOOT_TICKS = get_monotonic(); - m_ptr->T_REAL_TICKS = get_realtime(); - m_ptr->T_BOOTTIME = boottime; + 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 = boottime; return(OK); } #endif /* USE_TIMES */ - diff --git a/lib/libsys/getticks.c b/lib/libsys/getticks.c index d4ffe5b9f..873716b33 100644 --- a/lib/libsys/getticks.c +++ b/lib/libsys/getticks.c @@ -4,19 +4,14 @@ * getuptime * *===========================================================================*/ int getticks(ticks) -clock_t *ticks; /* monotonic time in ticks */ +clock_t *ticks; /* monotonic time in ticks */ { message m; int s; - m.m_type = SYS_TIMES; /* request time information */ - m.T_ENDPT = NONE; /* ignore process times */ + m.m_type = SYS_TIMES; /* request time information */ + m.m_lsys_krn_sys_times.endpt = NONE; /* ignore process times */ s = _kernel_call(SYS_TIMES, &m); - *ticks = m.T_BOOT_TICKS; + *ticks = m.m_krn_lsys_sys_times.boot_ticks; return(s); } - - - - - diff --git a/lib/libsys/getuptime.c b/lib/libsys/getuptime.c index 1d7743842..0a977997c 100644 --- a/lib/libsys/getuptime.c +++ b/lib/libsys/getuptime.c @@ -4,23 +4,18 @@ * getuptime * *===========================================================================*/ int getuptime(ticks, realtime, boottime) -clock_t *ticks; /* monotonic time in ticks */ -clock_t *realtime; /* wall time in ticks */ +clock_t *ticks; /* monotonic time in ticks */ +clock_t *realtime; /* wall time in ticks */ time_t *boottime; { message m; int s; - m.m_type = SYS_TIMES; /* request time information */ - m.T_ENDPT = NONE; /* ignore process times */ + m.m_type = SYS_TIMES; /* request time information */ + m.m_lsys_krn_sys_times.endpt = NONE; /* ignore process times */ s = _kernel_call(SYS_TIMES, &m); - *ticks = m.T_BOOT_TICKS; - *realtime = m.T_REAL_TICKS; - *boottime = m.T_BOOTTIME; + *ticks = m.m_krn_lsys_sys_times.boot_ticks; + *realtime = m.m_krn_lsys_sys_times.real_ticks; + *boottime = m.m_krn_lsys_sys_times.boot_time; return(s); } - - - - - diff --git a/lib/libsys/sys_times.c b/lib/libsys/sys_times.c index 1ad3bc979..7c34b8337 100644 --- a/lib/libsys/sys_times.c +++ b/lib/libsys/sys_times.c @@ -13,11 +13,11 @@ time_t *boottime; /* boot time */ message m; int r; - m.T_ENDPT = proc_ep; + m.m_lsys_krn_sys_times.endpt = proc_ep; r = _kernel_call(SYS_TIMES, &m); - if (user_time) *user_time = m.T_USER_TIME; - if (sys_time) *sys_time = m.T_SYSTEM_TIME; - if (uptime) *uptime = m.T_BOOT_TICKS; - if (boottime) *boottime = m.T_BOOTTIME; + if (user_time) *user_time = m.m_krn_lsys_sys_times.user_time; + if (sys_time) *sys_time = m.m_krn_lsys_sys_times.system_time; + if (uptime) *uptime = m.m_krn_lsys_sys_times.boot_ticks; + if (boottime) *boottime = m.m_krn_lsys_sys_times.boot_time; return(r); }