/* Field names for the exit(2) call. */
#define PM_EXIT_STATUS m1_i1 /* int */
-/* Field names for the gettimeofday(2), clock_*(2), adjtime(2), stime(2) calls.
- */
-#define PM_TIME_CLK_ID m2_i1 /* clockid_t */
-#define PM_TIME_NOW m2_i2 /* int */
-#define PM_TIME_SEC m2_ll1 /* time_t */
-#define PM_TIME_USEC m2_l2 /* long */
-#define PM_TIME_NSEC m2_l2 /* long */
-
/* Field names for the ptrace(2) call. */
#define PM_PTRACE_PID m2_i1 /* pid_t */
#define PM_PTRACE_REQ m2_i2 /* int */
} mess_sigcalls;
_ASSERT_MSG_SIZE(mess_sigcalls);
+typedef struct {
+ time_t sec;
+
+ clockid_t clk_id;
+ int now;
+ long nsec;
+
+ uint8_t padding[36];
+} mess_lc_pm_time;
+_ASSERT_MSG_SIZE(mess_lc_pm_time);
+
+typedef struct {
+ time_t sec;
+
+ long nsec;
+
+ uint8_t padding[44];
+} mess_pm_lc_time;
+_ASSERT_MSG_SIZE(mess_pm_lc_time);
+
typedef struct {
pid_t pid;
int options;
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
mess_fs_vfs_readwrite m_fs_vfs_readwrite;
+ mess_lc_pm_time m_lc_pm_time;
mess_lc_pm_waitpid m_lc_pm_waitpid;
mess_lc_vfs_chown m_lc_vfs_chown;
mess_lsys_vfs_copyfd m_lsys_vfs_copyfd;
mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver;
+ mess_pm_lc_time m_pm_lc_time;
mess_pm_lc_waitpid m_pm_lc_waitpid;
mess_pm_lsys_getepinfo m_pm_lsys_getepinfo;
message m;
memset(&m, 0, sizeof(m));
- m.PM_TIME_CLK_ID = (clockid_t) CLOCK_REALTIME;
- m.PM_TIME_NOW = 0; /* use adjtime() method to slowly adjust the clock. */
- m.PM_TIME_SEC = delta->tv_sec;
- m.PM_TIME_NSEC = delta->tv_usec * 1000; /* convert usec to nsec */
+ m.m_lc_pm_time.clk_id = CLOCK_REALTIME;
+ m.m_lc_pm_time.now = 0; /* use adjtime() method to slowly adjust the clock. */
+ m.m_lc_pm_time.sec = delta->tv_sec;
+ m.m_lc_pm_time.nsec = delta->tv_usec * 1000; /* convert usec to nsec */
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;
message m;
memset(&m, 0, sizeof(m));
- m.PM_TIME_CLK_ID = clock_id;
+ m.m_lc_pm_time.clk_id = clock_id;
if (_syscall(PM_PROC_NR, PM_CLOCK_GETRES, &m) < 0)
return -1;
- res->tv_sec = m.PM_TIME_SEC;
- res->tv_nsec = m.PM_TIME_NSEC;
+ res->tv_sec = m.m_pm_lc_time.sec;
+ res->tv_nsec = m.m_pm_lc_time.nsec;
return 0;
}
message m;
memset(&m, 0, sizeof(m));
- m.PM_TIME_CLK_ID = clock_id;
+ m.m_lc_pm_time.clk_id = clock_id;
if (_syscall(PM_PROC_NR, PM_CLOCK_GETTIME, &m) < 0)
return -1;
- res->tv_sec = m.PM_TIME_SEC;
- res->tv_nsec = m.PM_TIME_NSEC;
+ res->tv_sec = m.m_pm_lc_time.sec;
+ res->tv_nsec = m.m_pm_lc_time.nsec;
return 0;
}
message m;
memset(&m, 0, sizeof(m));
- m.PM_TIME_CLK_ID = clock_id;
- m.PM_TIME_NOW = 1; /* set time immediately. don't use adjtime() method. */
- m.PM_TIME_SEC = ts->tv_sec;
- m.PM_TIME_NSEC = ts->tv_nsec;
+ m.m_lc_pm_time.clk_id = clock_id;
+ m.m_lc_pm_time.now = 1; /* set time immediately. don't use adjtime() method. */
+ m.m_lc_pm_time.sec = ts->tv_sec;
+ m.m_lc_pm_time.nsec = ts->tv_nsec;
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;
if (_syscall(PM_PROC_NR, PM_GETTIMEOFDAY, &m) < 0)
return -1;
- tp->tv_sec = m.PM_TIME_SEC;
- tp->tv_usec = m.PM_TIME_USEC;
+ tp->tv_sec = m.m_pm_lc_time.sec;
+ tp->tv_usec = m.m_pm_lc_time.nsec / 1000;
return 0;
}
message m;
memset(&m, 0, sizeof(m));
- m.PM_TIME_SEC = *top;
+ m.m_lc_pm_time.sec = *top;
return(_syscall(PM_PROC_NR, PM_STIME, &m));
}
if ( (s=getuptime(&ticks, &realtime, &boottime)) != OK)
panic("do_time couldn't get uptime: %d", s);
- switch (m_in.PM_TIME_CLK_ID) {
+ switch (m_in.m_lc_pm_time.clk_id) {
case CLOCK_REALTIME:
clock = realtime;
break;
return EINVAL; /* invalid/unsupported clock_id */
}
- mp->mp_reply.PM_TIME_SEC = boottime + (clock / system_hz);
- mp->mp_reply.PM_TIME_NSEC =
+ mp->mp_reply.m_pm_lc_time.sec = boottime + (clock / system_hz);
+ mp->mp_reply.m_pm_lc_time.nsec =
(uint32_t) ((clock % system_hz) * 1000000000ULL / system_hz);
return(OK);
*===========================================================================*/
int do_getres()
{
- switch (m_in.PM_TIME_CLK_ID) {
+ switch (m_in.m_lc_pm_time.clk_id) {
case CLOCK_REALTIME:
case CLOCK_MONOTONIC:
/* tv_sec is always 0 since system_hz is an int */
- mp->mp_reply.PM_TIME_SEC = 0;
- mp->mp_reply.PM_TIME_NSEC = 1000000000 / system_hz;
+ mp->mp_reply.m_pm_lc_time.sec = 0;
+ mp->mp_reply.m_pm_lc_time.nsec = 1000000000 / system_hz;
return(OK);
default:
return EINVAL; /* invalid/unsupported clock_id */
return(EPERM);
}
- switch (m_in.PM_TIME_CLK_ID) {
+ switch (m_in.m_lc_pm_time.clk_id) {
case CLOCK_REALTIME:
- s= sys_settime(m_in.PM_TIME_NOW, m_in.PM_TIME_CLK_ID,
- m_in.PM_TIME_SEC, m_in.PM_TIME_NSEC);
+ s = sys_settime(m_in.m_lc_pm_time.now, m_in.m_lc_pm_time.clk_id,
+ m_in.m_lc_pm_time.sec, m_in.m_lc_pm_time.nsec);
return(s);
case CLOCK_MONOTONIC: /* monotonic cannot be changed */
default:
if ( (s=getuptime(&ticks, &realtime, &boottime)) != OK)
panic("do_time couldn't get uptime: %d", s);
- mp->mp_reply.PM_TIME_SEC = boottime + (realtime / system_hz);
- mp->mp_reply.PM_TIME_USEC =
- (uint32_t) ((realtime % system_hz) * 1000000ULL / system_hz);
+ mp->mp_reply.m_pm_lc_time.sec = boottime + (realtime / system_hz);
+ mp->mp_reply.m_pm_lc_time.nsec =
+ (uint32_t) ((realtime % system_hz) * 1000000000ULL / system_hz);
return(OK);
}
}
if ( (s=getuptime(&uptime, &realtime, &boottime)) != OK)
panic("do_stime couldn't get uptime: %d", s);
- boottime = m_in.PM_TIME_SEC - (realtime/system_hz);
+ boottime = m_in.m_lc_pm_time.sec - (realtime/system_hz);
s= sys_stime(boottime); /* Tell kernel about boottime */
if (s != OK)