Message type for RTCDEV_*
Change-Id: Ie4257e745e1d8b6a151934949f10c7fdb1ac4778
This commit is contained in:
parent
3a82a3f90a
commit
d6626d0575
6 changed files with 37 additions and 24 deletions
|
@ -148,11 +148,11 @@ readclock(int type, struct tm *t, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.RTCDEV_TM = (char *) t;
|
m.m_lc_readclock_rtcdev.tm = (vir_bytes)t;
|
||||||
m.RTCDEV_FLAGS = flags;
|
m.m_lc_readclock_rtcdev.flags = flags;
|
||||||
|
|
||||||
r = _syscall(ep, type, &m);
|
r = _syscall(ep, type, &m);
|
||||||
if (r != RTCDEV_REPLY || m.RTCDEV_STATUS != 0) {
|
if (r != RTCDEV_REPLY || m.m_readclock_lc_rtcdev.status != 0) {
|
||||||
if (!quiet) errmsg("Call to readclock.drv failed\n");
|
if (!quiet) errmsg("Call to readclock.drv failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,12 +82,12 @@ fwd_msg(int type, struct tm *t, int t_access, int flags)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
m.RTCDEV_GRANT = gid;
|
m.m_lc_readclock_rtcdev.grant = gid;
|
||||||
m.RTCDEV_FLAGS = flags;
|
m.m_lc_readclock_rtcdev.flags = flags;
|
||||||
|
|
||||||
r = _syscall(ep, type, &m);
|
r = _syscall(ep, type, &m);
|
||||||
cpf_revoke(gid);
|
cpf_revoke(gid);
|
||||||
if (r != RTCDEV_REPLY || m.RTCDEV_STATUS != 0) {
|
if (r != RTCDEV_REPLY || m.m_readclock_lc_rtcdev.status != 0) {
|
||||||
log_warn(&log, "Call to '%s' failed.\n", target_label);
|
log_warn(&log, "Call to '%s' failed.\n", target_label);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,14 +71,14 @@ main(int argc, char **argv)
|
||||||
switch (m.m_type) {
|
switch (m.m_type) {
|
||||||
case RTCDEV_GET_TIME:
|
case RTCDEV_GET_TIME:
|
||||||
/* Any user can read the time */
|
/* Any user can read the time */
|
||||||
reply_status = rtc.get_time(&t, m.RTCDEV_FLAGS);
|
reply_status = rtc.get_time(&t, m.m_lc_readclock_rtcdev.flags);
|
||||||
if (reply_status != OK) {
|
if (reply_status != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write results back to calling process */
|
/* write results back to calling process */
|
||||||
reply_status =
|
reply_status =
|
||||||
store_t(caller, (vir_bytes) m.RTCDEV_TM, &t);
|
store_t(caller, m.m_lc_readclock_rtcdev.tm, &t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTCDEV_SET_TIME:
|
case RTCDEV_SET_TIME:
|
||||||
|
@ -86,14 +86,14 @@ main(int argc, char **argv)
|
||||||
if (getnuid(caller) == SUPER_USER) {
|
if (getnuid(caller) == SUPER_USER) {
|
||||||
/* read time from calling process */
|
/* read time from calling process */
|
||||||
reply_status =
|
reply_status =
|
||||||
fetch_t(caller, (vir_bytes) m.RTCDEV_TM,
|
fetch_t(caller, m.m_lc_readclock_rtcdev.tm,
|
||||||
&t);
|
&t);
|
||||||
if (reply_status != OK) {
|
if (reply_status != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
reply_status =
|
reply_status =
|
||||||
rtc.set_time(&t, m.RTCDEV_FLAGS);
|
rtc.set_time(&t, m.m_lc_readclock_rtcdev.flags);
|
||||||
} else {
|
} else {
|
||||||
reply_status = EPERM;
|
reply_status = EPERM;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* Send Reply */
|
/* Send Reply */
|
||||||
m.m_type = RTCDEV_REPLY;
|
m.m_type = RTCDEV_REPLY;
|
||||||
m.RTCDEV_STATUS = reply_status;
|
m.m_readclock_lc_rtcdev.status = reply_status;
|
||||||
|
|
||||||
log_debug(&log, "Sending Reply");
|
log_debug(&log, "Sending Reply");
|
||||||
|
|
||||||
|
|
|
@ -302,15 +302,14 @@ main(int argc, char *argv[])
|
||||||
switch (m.m_type) {
|
switch (m.m_type) {
|
||||||
case RTCDEV_GET_TIME_G:
|
case RTCDEV_GET_TIME_G:
|
||||||
/* Any user can read the time */
|
/* Any user can read the time */
|
||||||
reply_status = rtc_get_time(&t, m.RTCDEV_FLAGS);
|
reply_status = rtc_get_time(&t, m.m_lc_readclock_rtcdev.flags);
|
||||||
if (reply_status != OK) {
|
if (reply_status != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write results back to calling process */
|
/* write results back to calling process */
|
||||||
reply_status =
|
reply_status =
|
||||||
store_t(caller, (cp_grant_id_t) m.RTCDEV_GRANT,
|
store_t(caller, m.m_lc_readclock_rtcdev.grant, &t);
|
||||||
&t);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTCDEV_SET_TIME_G:
|
case RTCDEV_SET_TIME_G:
|
||||||
|
@ -319,13 +318,14 @@ main(int argc, char *argv[])
|
||||||
/* read time from calling process */
|
/* read time from calling process */
|
||||||
reply_status =
|
reply_status =
|
||||||
fetch_t(caller,
|
fetch_t(caller,
|
||||||
(cp_grant_id_t) m.RTCDEV_GRANT, &t);
|
m.m_lc_readclock_rtcdev.grant, &t);
|
||||||
if (reply_status != OK) {
|
if (reply_status != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
reply_status =
|
reply_status =
|
||||||
rtc_set_time(&t, m.RTCDEV_FLAGS);
|
rtc_set_time(&t,
|
||||||
|
m.m_lc_readclock_rtcdev.flags);
|
||||||
} else {
|
} else {
|
||||||
reply_status = EPERM;
|
reply_status = EPERM;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Send Reply */
|
/* Send Reply */
|
||||||
m.m_type = RTCDEV_REPLY;
|
m.m_type = RTCDEV_REPLY;
|
||||||
m.RTCDEV_STATUS = reply_status;
|
m.m_readclock_lc_rtcdev.status = reply_status;
|
||||||
|
|
||||||
log_debug(&log, "Sending Reply");
|
log_debug(&log, "Sending Reply");
|
||||||
|
|
||||||
|
|
|
@ -1230,13 +1230,7 @@
|
||||||
/* Message types for real time clock responses. */
|
/* Message types for real time clock responses. */
|
||||||
#define RTCDEV_REPLY (RTCDEV_RS_BASE + 0) /* general reply code */
|
#define RTCDEV_REPLY (RTCDEV_RS_BASE + 0) /* general reply code */
|
||||||
|
|
||||||
/* Field names for real time clock messages */
|
/* Bits in 'lc_readclock_rtcdev.flags' field of real time clock requests. */
|
||||||
#define RTCDEV_TM m2_p1 /* pointer to struct tm */
|
|
||||||
#define RTCDEV_FLAGS m2_s1 /* clock flags flags */
|
|
||||||
#define RTCDEV_STATUS m2_i2 /* OK or error code */
|
|
||||||
#define RTCDEV_GRANT m2_i3 /* grant containing struct tm */
|
|
||||||
|
|
||||||
/* Bits in 'RTCDEV_FLAGS' field of real time clock requests. */
|
|
||||||
#define RTCDEV_NOFLAGS 0x00 /* no flags are set */
|
#define RTCDEV_NOFLAGS 0x00 /* no flags are set */
|
||||||
#define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
|
#define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
|
||||||
#define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
|
#define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
|
||||||
|
|
|
@ -313,6 +313,22 @@ typedef struct {
|
||||||
} mess_lc_pm_time;
|
} mess_lc_pm_time;
|
||||||
_ASSERT_MSG_SIZE(mess_lc_pm_time);
|
_ASSERT_MSG_SIZE(mess_lc_pm_time);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
cp_grant_id_t grant;
|
||||||
|
vir_bytes tm; /* struct tm * */
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
uint8_t padding[44];
|
||||||
|
} mess_lc_readclock_rtcdev;
|
||||||
|
_ASSERT_MSG_SIZE(mess_lc_readclock_rtcdev);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int status;
|
||||||
|
|
||||||
|
uint8_t padding[52];
|
||||||
|
} mess_readclock_lc_rtcdev;
|
||||||
|
_ASSERT_MSG_SIZE(mess_readclock_lc_rtcdev);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
time_t sec;
|
time_t sec;
|
||||||
|
|
||||||
|
@ -1249,6 +1265,7 @@ typedef struct {
|
||||||
mess_lc_pm_sysuname m_lc_pm_sysuname;
|
mess_lc_pm_sysuname m_lc_pm_sysuname;
|
||||||
mess_lc_pm_time m_lc_pm_time;
|
mess_lc_pm_time m_lc_pm_time;
|
||||||
mess_lc_pm_waitpid m_lc_pm_waitpid;
|
mess_lc_pm_waitpid m_lc_pm_waitpid;
|
||||||
|
mess_lc_readclock_rtcdev m_lc_readclock_rtcdev;
|
||||||
|
|
||||||
mess_lc_vfs_chown m_lc_vfs_chown;
|
mess_lc_vfs_chown m_lc_vfs_chown;
|
||||||
mess_lc_vfs_close m_lc_vfs_close;
|
mess_lc_vfs_close m_lc_vfs_close;
|
||||||
|
@ -1313,6 +1330,8 @@ typedef struct {
|
||||||
|
|
||||||
mess_pm_sched_scheduling_set_nice m_pm_sched_scheduling_set_nice;
|
mess_pm_sched_scheduling_set_nice m_pm_sched_scheduling_set_nice;
|
||||||
|
|
||||||
|
mess_readclock_lc_rtcdev m_readclock_lc_rtcdev;
|
||||||
|
|
||||||
mess_rs_pm_exec_restart m_rs_pm_exec_restart;
|
mess_rs_pm_exec_restart m_rs_pm_exec_restart;
|
||||||
mess_rs_pm_srv_kill m_rs_pm_srv_kill;
|
mess_rs_pm_srv_kill m_rs_pm_srv_kill;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue