libc: add clock_settime() system call.
This also adds the sys_settime() kernel call which allows for the adjusting of the clock named realtime in the kernel. The existing sys_stime() function is still needed for a separate job (setting the boottime). The boottime is set in the readclock driver. The sys_settime() interface is meant to be flexible and will support both clock_settime() and adjtime() when adjtime() is implemented later. settimeofday() was adjusted to use the clock_settime() interface. One side note discovered during testing: uptime(1) (part of the last(1)), uses wtmp to determine boottime (not Minix's times(2)). This leads `uptime` to report odd results when you set the time to a time prior to boottime. This isn't a new bug introduced by my changes. It's been there for a while.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#define NCALLS 116 /* number of system calls allowed */
|
||||
#define NCALLS 117 /* number of system calls allowed */
|
||||
|
||||
/* In case it isn't obvious enough: this list is sorted numerically. */
|
||||
#define EXIT 1
|
||||
@@ -104,6 +104,7 @@
|
||||
#define PM_GETSID 113 /* PM getsid() */
|
||||
#define CLOCK_GETRES 114 /* clock_getres() */
|
||||
#define CLOCK_GETTIME 115 /* clock_gettime() */
|
||||
#define CLOCK_SETTIME 116 /* clock_settime() */
|
||||
|
||||
#define TASK_REPLY 121 /* to VFS: reply code from drivers, not
|
||||
* really a standalone call.
|
||||
|
||||
@@ -335,6 +335,7 @@
|
||||
# define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
|
||||
|
||||
# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
|
||||
# define SYS_SETTIME (KERNEL_CALL + 40) /* sys_settime() */
|
||||
|
||||
# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
|
||||
# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
|
||||
@@ -491,6 +492,12 @@
|
||||
#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_NSEC m4_l5 /* number of nano seconds */
|
||||
|
||||
/* Field names for SYS_TRACE, SYS_PRIVCTL, SYS_STATECTL. */
|
||||
#define CTL_ENDPT m2_i1 /* process number of the caller */
|
||||
#define CTL_REQUEST m2_i2 /* server control request */
|
||||
|
||||
@@ -65,6 +65,7 @@ int sys_vmctl_get_memreq(endpoint_t *who, vir_bytes *mem, vir_bytes
|
||||
int sys_vmctl_enable_paging(void * data);
|
||||
|
||||
int sys_readbios(phys_bytes address, void *buf, size_t size);
|
||||
int sys_settime(int now, clockid_t clk_id, time_t sec, long nsec);
|
||||
int sys_stime(time_t boottime);
|
||||
int sys_sysctl(int ctl, char *arg1, int arg2);
|
||||
int sys_sysctl_stacktrace(endpoint_t who);
|
||||
|
||||
@@ -162,10 +162,8 @@ int clock_getres(clockid_t, struct timespec *)
|
||||
__RENAME(__clock_getres50);
|
||||
int clock_gettime(clockid_t, struct timespec *)
|
||||
__RENAME(__clock_gettime50);
|
||||
#ifndef __minix
|
||||
int clock_settime(clockid_t, const struct timespec *)
|
||||
__RENAME(__clock_settime50);
|
||||
#endif /* !__minix */
|
||||
int nanosleep(const struct timespec *, struct timespec *)
|
||||
__RENAME(__nanosleep50);
|
||||
#ifndef __minix
|
||||
|
||||
Reference in New Issue
Block a user