PM_TIME_SEC into 64bit

Change-Id: I609ee8cac7aae8af2c0c0381710433a5df0caebd
This commit is contained in:
Lionel Sambuc 2013-11-27 12:01:26 +01:00
parent 3eaea2dc69
commit 4a0199d66d
9 changed files with 18 additions and 18 deletions

View file

@ -82,7 +82,7 @@
*/
#define PM_TIME_CLK_ID m2_i1 /* clockid_t */
#define PM_TIME_NOW m2_i2 /* int */
#define PM_TIME_SEC m2_l1 /* time_t */
#define PM_TIME_SEC m2_ll1 /* time_t */
#define PM_TIME_USEC m2_l2 /* long */
#define PM_TIME_NSEC m2_l2 /* long */

View file

@ -25,12 +25,13 @@ typedef struct {
_ASSERT_MSG_SIZE(mess_1);
typedef struct {
int64_t m2ll1;
int m2i1, m2i2, m2i3;
long m2l1, m2l2;
char *m2p1;
sigset_t sigset;
short m2s1;
uint8_t padding[14];
uint8_t padding[6];
} mess_2;
_ASSERT_MSG_SIZE(mess_2);
@ -206,6 +207,7 @@ typedef int _ASSERT_message[/* CONSTCOND */sizeof(message) == 64 ?1 : -1];
#define m1_p4 m_u.m_m1.m1p4
#define m1_ull1 m_u.m_m1.m1ull1
#define m2_ll1 m_u.m_m2.m2ll1
#define m2_i1 m_u.m_m2.m2i1
#define m2_i2 m_u.m_m2.m2i2
#define m2_i3 m_u.m_m2.m2i3

View file

@ -17,8 +17,8 @@ int adjtime(const struct timeval *delta, struct timeval *olddelta)
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 = (int32_t)delta->tv_sec;
m.PM_TIME_NSEC = (int32_t)delta->tv_usec * 1000; /* convert usec to nsec */
m.PM_TIME_SEC = delta->tv_sec;
m.PM_TIME_NSEC = delta->tv_usec * 1000; /* convert usec to nsec */
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;

View file

@ -14,7 +14,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
message m;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
m.PM_TIME_CLK_ID = clock_id;
if (_syscall(PM_PROC_NR, PM_CLOCK_GETRES, &m) < 0)
return -1;

View file

@ -14,13 +14,13 @@ int clock_gettime(clockid_t clock_id, struct timespec *res)
message m;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
m.PM_TIME_CLK_ID = clock_id;
if (_syscall(PM_PROC_NR, PM_CLOCK_GETTIME, &m) < 0)
return -1;
res->tv_sec = (time_t) m.PM_TIME_SEC;
res->tv_nsec = (long) m.PM_TIME_USEC;
res->tv_sec = m.PM_TIME_SEC;
res->tv_nsec = m.PM_TIME_NSEC;
return 0;
}

View file

@ -14,10 +14,10 @@ int clock_settime(clockid_t clock_id, const struct timespec *ts)
message m;
memset(&m, 0, sizeof(m));
m.PM_TIME_CLK_ID = (clockid_t) clock_id;
m.PM_TIME_CLK_ID = clock_id;
m.PM_TIME_NOW = 1; /* set time immediately. don't use adjtime() method. */
m.PM_TIME_SEC = (time_t) ts->tv_sec;
m.PM_TIME_NSEC = (long) ts->tv_nsec;
m.PM_TIME_SEC = ts->tv_sec;
m.PM_TIME_NSEC = ts->tv_nsec;
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;

View file

@ -14,6 +14,6 @@ int stime(time_t *top)
message m;
memset(&m, 0, sizeof(m));
m.PM_TIME_SEC = (long)*top;
m.PM_TIME_SEC = *top;
return(_syscall(PM_PROC_NR, PM_STIME, &m));
}

View file

@ -661,7 +661,7 @@ register struct mproc *child; /* tells which process is exiting */
static void tell_tracer(child)
struct mproc *child; /* tells which process is exiting */
{
int exitstatus, mp_tracer;
int mp_tracer;
struct mproc *tracer;
mp_tracer = child->mp_tracer;

View file

@ -38,8 +38,7 @@ int do_gettime()
return EINVAL; /* invalid/unsupported clock_id */
}
/* For now simply truncate time to a 32b value. */
mp->mp_reply.PM_TIME_SEC = (int32_t) (boottime + (clock / system_hz));
mp->mp_reply.PM_TIME_SEC = boottime + (clock / system_hz);
mp->mp_reply.PM_TIME_NSEC =
(uint32_t) ((clock % system_hz) * 1000000000ULL / system_hz);
@ -102,8 +101,7 @@ int do_time()
if ( (s=getuptime(&ticks, &realtime, &boottime)) != OK)
panic("do_time couldn't get uptime: %d", s);
/* For now simply truncate time to a 32b value. */
mp->mp_reply.PM_TIME_SEC = (int32_t) (boottime + (realtime / system_hz));
mp->mp_reply.PM_TIME_SEC = boottime + (realtime / system_hz);
mp->mp_reply.PM_TIME_USEC =
(uint32_t) ((realtime % system_hz) * 1000000ULL / system_hz);
return(OK);
@ -126,7 +124,7 @@ int do_stime()
}
if ( (s=getuptime(&uptime, &realtime, &boottime)) != OK)
panic("do_stime couldn't get uptime: %d", s);
boottime = (time_t)m_in.PM_TIME_SEC - (realtime/system_hz);
boottime = m_in.PM_TIME_SEC - (realtime/system_hz);
s= sys_stime(boottime); /* Tell kernel about boottime */
if (s != OK)