Message type for PM_ITIMER
Change-Id: I191ba9630028d9822f6a2fd4d7d3f461eb4d1493
This commit is contained in:
parent
1ae60bd2e8
commit
a5ed845b20
5 changed files with 24 additions and 19 deletions
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,7 +111,7 @@ 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,
|
||||
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);
|
||||
|
||||
|
@ -144,7 +144,7 @@ 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,
|
||||
who_e, m_in.m_lc_pm_itimer.ovalue,
|
||||
(phys_bytes)sizeof(ovalue));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue