From: Lionel Sambuc Date: Tue, 13 May 2014 06:43:49 +0000 (+0200) Subject: Message type for PM_ITIMER X-Git-Tag: v3.3.0~293 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-dsfromkey.html?a=commitdiff_plain;h=a5ed845b2036d8de01517445691ac7e5e2475746;p=minix.git Message type for PM_ITIMER Change-Id: I191ba9630028d9822f6a2fd4d7d3f461eb4d1493 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 1f674f673..8bcea61a1 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -76,11 +76,6 @@ #define PM_SYSUNAME_LEN m1_i3 /* char * */ #define PM_SYSUNAME_VALUE m1_p1 /* size_t */ -/* Field names for the getitimer(2)/setitimer(2) calls. */ -#define PM_ITIMER_WHICH m1_i1 /* int */ -#define PM_ITIMER_VALUE m1_p1 /* const struct itimerval * */ -#define PM_ITIMER_OVALUE m1_p2 /* struct itimerval * */ - /* Field names for the execve(2) call. */ #define PM_EXEC_NAME m1_p1 /* const char * */ #define PM_EXEC_NAMELEN m1_i1 /* size_t */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index cff4bfa2d..532b34408 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -145,6 +145,15 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + int which; + vir_bytes value; /* const struct itimerval * */ + vir_bytes ovalue; /* struct itimerval * */ + + uint8_t padding[44]; +} mess_lc_pm_itimer; +_ASSERT_MSG_SIZE(mess_lc_pm_itimer); + typedef struct { time_t sec; @@ -922,6 +931,7 @@ typedef struct { mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_fs_vfs_readwrite m_fs_vfs_readwrite; + mess_lc_pm_itimer m_lc_pm_itimer; mess_lc_pm_time m_lc_pm_time; mess_lc_pm_waitpid m_lc_pm_waitpid; diff --git a/lib/libc/sys-minix/getitimer.c b/lib/libc/sys-minix/getitimer.c index 5e06e1953..cb4ac563b 100644 --- a/lib/libc/sys-minix/getitimer.c +++ b/lib/libc/sys-minix/getitimer.c @@ -14,9 +14,9 @@ int getitimer(int which, struct itimerval *value) message m; memset(&m, 0, sizeof(m)); - m.PM_ITIMER_WHICH = which; - m.PM_ITIMER_VALUE = NULL; /* only retrieve the timer */ - m.PM_ITIMER_OVALUE = (char *) value; + m.m_lc_pm_itimer.which = which; + m.m_lc_pm_itimer.value = 0; /* only retrieve the timer */ + m.m_lc_pm_itimer.ovalue = (vir_bytes)value; return _syscall(PM_PROC_NR, PM_ITIMER, &m); } diff --git a/lib/libc/sys-minix/setitimer.c b/lib/libc/sys-minix/setitimer.c index 882b68657..3157793f7 100644 --- a/lib/libc/sys-minix/setitimer.c +++ b/lib/libc/sys-minix/setitimer.c @@ -23,9 +23,9 @@ int setitimer(int which, const struct itimerval *__restrict value, } memset(&m, 0, sizeof(m)); - m.PM_ITIMER_WHICH = which; - m.PM_ITIMER_VALUE = (char *) __UNCONST(value); - m.PM_ITIMER_OVALUE = (char *) ovalue; + m.m_lc_pm_itimer.which = which; + m.m_lc_pm_itimer.value = (vir_bytes)value; + m.m_lc_pm_itimer.ovalue = (vir_bytes)ovalue; return _syscall(PM_PROC_NR, PM_ITIMER, &m); } diff --git a/servers/pm/alarm.c b/servers/pm/alarm.c index 93f1e93e7..d496e9db2 100644 --- a/servers/pm/alarm.c +++ b/servers/pm/alarm.c @@ -95,15 +95,15 @@ int do_itimer() int r, which; /* Make sure 'which' is one of the defined timers. */ - which = m_in.PM_ITIMER_WHICH; + which = m_in.m_lc_pm_itimer.which; if (which < 0 || which >= NR_ITIMERS) return(EINVAL); /* Determine whether to set and/or return the given timer value, based on * which of the value and ovalue parameters are nonzero. At least one of * them must be nonzero. */ - setval = (m_in.PM_ITIMER_VALUE != NULL); - getval = (m_in.PM_ITIMER_OVALUE != NULL); + setval = (m_in.m_lc_pm_itimer.value != 0); + getval = (m_in.m_lc_pm_itimer.ovalue != 0); if (!setval && !getval) return(EINVAL); @@ -111,8 +111,8 @@ int do_itimer() * Also, make sure its fields have sane values. */ if (setval) { - r = sys_datacopy(who_e, (vir_bytes) m_in.PM_ITIMER_VALUE, - PM_PROC_NR, (vir_bytes) &value, (phys_bytes) sizeof(value)); + r = sys_datacopy(who_e, m_in.m_lc_pm_itimer.value, + PM_PROC_NR, (vir_bytes)&value, (phys_bytes)sizeof(value)); if (r != OK) return(r); if (!is_sane_timeval(&value.it_value) || @@ -143,9 +143,9 @@ int do_itimer() /* If requested, copy the old interval timer to user space. */ if (r == OK && getval) { - r = sys_datacopy(PM_PROC_NR, (vir_bytes) &ovalue, - who_e, (vir_bytes) m_in.PM_ITIMER_OVALUE, - (phys_bytes) sizeof(ovalue)); + r = sys_datacopy(PM_PROC_NR, (vir_bytes)&ovalue, + who_e, m_in.m_lc_pm_itimer.ovalue, + (phys_bytes)sizeof(ovalue)); } return(r);