sizeof(*req)) == VMMDEV_ERR_OK) {
time(&otime); /* old time */
- ntime = (unsigned long)(req->time / 1000); /* new time */
+ ntime = req->time / 1000; /* new time */
/* Make time go forward, if the difference exceeds the drift
* threshold. Never make time go backward.
*/
- if ((int) (ntime - otime) >= drift)
+ if ((ntime - otime) >= drift)
stime(&ntime);
}
#define T_ENDPT m4_l1 /* process to request time info for */
#define T_USER_TIME m4_l1 /* user time consumed by process */
#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
-#define T_BOOTTIME m4_l3 /* Boottime in seconds (also for SYS_STIME) */
+#define T_BOOTTIME m4_ll1 /* Boottime in seconds (also for SYS_STIME) */
#define T_REAL_TICKS m4_l4 /* number of wall clock ticks since boottime */
#define T_BOOT_TICKS m4_l5 /* number of hard clock ticks since boottime */
/* Field names for SYS_SETTIME. */
#define T_SETTIME_NOW m4_l2 /* non-zero for immediate, 0 for adjtime */
#define T_CLOCK_ID m4_l3 /* clock to adjust */
-#define T_TIME_SEC m4_l4 /* time in seconds since 1970 */
+#define T_TIME_SEC m4_ll1 /* time in seconds since 1970 */
#define T_TIME_NSEC m4_l5 /* number of nano seconds */
/* Field names for SYS_TRACE, SYS_PRIVCTL, SYS_STATECTL. */
_ASSERT_MSG_SIZE(mess_3);
typedef struct {
+ int64_t m4ll1;
long m4l1, m4l2, m4l3, m4l4, m4l5;
- uint8_t padding[36];
+ uint8_t padding[28];
} mess_4;
_ASSERT_MSG_SIZE(mess_4);
#define m3_p1 m_u.m_m3.m3p1
#define m3_ca1 m_u.m_m3.m3ca1
+#define m4_ll1 m_u.m_m4.m4ll1
#define m4_l1 m_u.m_m4.m4l1
#define m4_l2 m_u.m_m4.m4l2
#define m4_l3 m_u.m_m4.m4l3
* The parameters for this kernel call are:
* m4_l2: T_SETTIME_NOW
* m4_l3: T_CLOCK_ID
- * m4_l4: T_TIME_SEC
+ * m4_ll1: T_TIME_SEC
* m4_l5: T_TIME_NSEC
*/
{
clock_t newclock;
int32_t ticks;
- time_t timediff;
- signed long long timediff_ticks;
+ time_t timediff, timediff_ticks;
if (m_ptr->T_CLOCK_ID != CLOCK_REALTIME) /* only realtime can change */
return EINVAL;
} /* else user wants to set the time */
timediff = m_ptr->T_TIME_SEC - boottime;
- timediff_ticks = (signed long long) timediff * system_hz;
+ timediff_ticks = timediff * system_hz;
/* prevent a negative value for realtime */
if (m_ptr->T_TIME_SEC <= boottime ||
* m_type: SYS_STIME
*
* The parameters for this kernel call are:
- * m4_l3: T_BOOTTIME
+ * m4_ll1: T_BOOTTIME
*/
#include "kernel/system.h"
* m4_l1: T_ENDPT (get info for this process)
* m4_l1: T_USER_TIME (return values ...)
* m4_l2: T_SYSTEM_TIME
- * m4_l3: T_BOOTTIME
+ * m4_ll1: T_BOOTTIME
* m4_l5: T_BOOT_TICKS
*/
}
m_ptr->T_BOOT_TICKS = get_monotonic();
m_ptr->T_REAL_TICKS = get_realtime();
- m_ptr->T_BOOTTIME = boottime;
+ m_ptr->T_BOOTTIME = boottime;
return(OK);
}
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 = (time_t) delta->tv_sec;
- m.PM_TIME_NSEC = (long) delta->tv_usec * 1000; /* convert usec to nsec */
+ m.PM_TIME_SEC = (int32_t)delta->tv_sec;
+ m.PM_TIME_NSEC = (int32_t)delta->tv_usec * 1000; /* convert usec to nsec */
if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
return -1;
if (_syscall(PM_PROC_NR, PM_CLOCK_GETRES, &m) < 0)
return -1;
- res->tv_sec = (time_t) m.PM_TIME_SEC;
- res->tv_nsec = (long) m.PM_TIME_NSEC;
+ res->tv_sec = m.PM_TIME_SEC;
+ res->tv_nsec = m.PM_TIME_NSEC;
return 0;
}
memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = fd;
- m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
- m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
- m.VFS_UTIMENS_ANSEC = tv[0].tv_nsec;
- m.VFS_UTIMENS_MNSEC = tv[1].tv_nsec;
+ /* For now just truncate to 32bit time_t values. */
+ m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec;
+ m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec;
+ m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec;
+ m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec;
m.VFS_UTIMENS_NAME = NULL;
m.VFS_UTIMENS_FLAGS = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW;
}
else {
- m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
- m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
- m.VFS_UTIMENS_ANSEC = tv[0].tv_usec * 1000;
- m.VFS_UTIMENS_MNSEC = tv[1].tv_usec * 1000;
+ m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec;
+ m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec;
+ m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000;
+ m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000;
}
m.VFS_UTIMENS_NAME = NULL;
m.VFS_UTIMENS_FLAGS = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW;
}
else {
- m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
- m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
- m.VFS_UTIMENS_ANSEC = tv[0].tv_usec * 1000;
- m.VFS_UTIMENS_MNSEC = tv[1].tv_usec * 1000;
+ /* For now just truncate time_t values to 32bits. */
+ m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec;
+ m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec;
+ m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000;
+ m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000;
}
m.VFS_UTIMENS_FLAGS = AT_SYMLINK_NOFOLLOW;
memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_LEN = strlen(name) + 1;
m.VFS_UTIMENS_NAME = (char *) __UNCONST(name);
- m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
- m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
- m.VFS_UTIMENS_ANSEC = tv[0].tv_nsec;
- m.VFS_UTIMENS_MNSEC = tv[1].tv_nsec;
+ /* For now just truncate time_t values to 32bits. */
+ m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec;
+ m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec;
+ m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec;
+ m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec;
m.VFS_UTIMENS_FLAGS = flags;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW;
}
else {
- m.VFS_UTIMENS_ATIME = tv[0].tv_sec;
- m.VFS_UTIMENS_MTIME = tv[1].tv_sec;
- m.VFS_UTIMENS_ANSEC = tv[0].tv_usec * 1000;
- m.VFS_UTIMENS_MNSEC = tv[1].tv_usec * 1000;
+ /* For now just truncate time_t values to 32bits. */
+ m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec;
+ m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec;
+ m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000;
+ m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000;
}
m.VFS_UTIMENS_FLAGS = 0;
#include "syslib.h"
#include <time.h>
-int sys_settime(now, clk_id, sec, nsec)
-int now;
-clockid_t clk_id;
-time_t sec;
-long nsec;
+int sys_settime(int now, clockid_t clk_id, time_t sec, long nsec)
{
- message m;
- int r;
+ message m;
+ int r;
- m.T_SETTIME_NOW = now;
- m.T_CLOCK_ID = clk_id;
- m.T_TIME_SEC = sec;
- m.T_TIME_NSEC = nsec;
+ m.T_SETTIME_NOW = now;
+ m.T_CLOCK_ID = clk_id;
+ m.T_TIME_SEC = sec;
+ m.T_TIME_NSEC = nsec;
- r = _kernel_call(SYS_SETTIME, &m);
- return(r);
+ r = _kernel_call(SYS_SETTIME, &m);
+ return r;
}
return EINVAL; /* invalid/unsupported clock_id */
}
- mp->mp_reply.PM_TIME_SEC = (time_t) (boottime + (clock / system_hz));
+ /* 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_NSEC =
- (long) ((clock % system_hz) * 1000000000ULL / system_hz);
+ (uint32_t) ((clock % system_hz) * 1000000000ULL / system_hz);
return(OK);
}
case CLOCK_REALTIME:
case CLOCK_MONOTONIC:
/* tv_sec is always 0 since system_hz is an int */
- mp->mp_reply.PM_TIME_SEC = (time_t) 0;
+ mp->mp_reply.PM_TIME_SEC = 0;
mp->mp_reply.PM_TIME_NSEC = 1000000000 / system_hz;
return(OK);
default:
if ( (s=getuptime(&ticks, &realtime, &boottime)) != OK)
panic("do_time couldn't get uptime: %d", s);
- mp->mp_reply.PM_TIME_SEC = (time_t) (boottime + (realtime / system_hz));
+ /* 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_USEC =
- (long) ((realtime % system_hz) * 1000000ULL / system_hz);
+ (uint32_t) ((realtime % system_hz) * 1000000ULL / system_hz);
return(OK);
}
}
if ( (s=getuptime(&uptime, &realtime, &boottime)) != OK)
panic("do_stime couldn't get uptime: %d", s);
- boottime = (long) m_in.PM_TIME_SEC - (realtime/system_hz);
+ boottime = (time_t)m_in.PM_TIME_SEC - (realtime/system_hz);
s= sys_stime(boottime); /* Tell kernel about boottime */
if (s != OK)
if (r != OK)
panic("clock_timespec err: %d", r);
- tv.tv_sec = (time_t) (boottime + (realtime/system_hz));
+ tv.tv_sec = boottime + (realtime/system_hz);
/* We do not want to overflow, and system_hz can be as high as 50kHz */
assert(system_hz < LONG_MAX/40000);
tv.tv_nsec = (realtime%system_hz) * 40000 / system_hz * 25000;
* from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
*/
-/* These types are Minix specific. */
#ifndef _ANSI_H_
#define _ANSI_H_
#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
#define _BSD_SIZE_T_ unsigned int /* sizeof() */
#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
+#define _BSD_TIME_T_ __int64_t /* time() */
#define _BSD_CLOCKID_T_ int /* clockid_t */
#define _BSD_TIMER_T_ int /* timer_t */
#define _BSD_SUSECONDS_T_ int /* suseconds_t */
#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
#define _BSD_SIZE_T_ unsigned int /* sizeof() */
#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
+#define _BSD_TIME_T_ __int64_t /* time() */
#define _BSD_CLOCKID_T_ int /* clockid_t */
#define _BSD_TIMER_T_ int /* timer_t */
#define _BSD_SUSECONDS_T_ int /* suseconds_t */
p->p_endpoint = endpt;
p->p_pid = pid;
- if (fscanf(fp, " %255s %c %d %d %u %*u %lu %lu",
+ if (fscanf(fp, " %255s %c %d %d %llu %*u %lu %lu",
name, &state, &p->p_blocked, &p->p_priority,
&p->p_user_time, &cycles_hi, &cycles_lo) != 7) {