* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.13 1997/01/26 05:18:27 downsj Exp
+ * created from OpenBSD: syscalls.master,v 1.14 1997/04/20 20:48:27 tholo Exp
*/
#include <sys/param.h>
{ 0, 0,
sys_nosys }, /* 231 = unimplemented shmget */
#endif
+ { 2, s(struct sys_clock_gettime_args),
+ sys_clock_gettime }, /* 232 = clock_gettime */
+ { 2, s(struct sys_clock_settime_args),
+ sys_clock_settime }, /* 233 = clock_settime */
+ { 2, s(struct sys_clock_getres_args),
+ sys_clock_getres }, /* 234 = clock_getres */
{ 0, 0,
- sys_nosys }, /* 232 = unimplemented */
+ sys_nosys }, /* 235 = unimplemented timer_create */
{ 0, 0,
- sys_nosys }, /* 233 = unimplemented */
+ sys_nosys }, /* 236 = unimplemented timer_delete */
{ 0, 0,
- sys_nosys }, /* 234 = unimplemented */
+ sys_nosys }, /* 237 = unimplemented timer_settime */
{ 0, 0,
- sys_nosys }, /* 235 = unimplemented */
+ sys_nosys }, /* 238 = unimplemented timer_gettime */
{ 0, 0,
- sys_nosys }, /* 236 = unimplemented */
- { 0, 0,
- sys_nosys }, /* 237 = unimplemented */
- { 0, 0,
- sys_nosys }, /* 238 = unimplemented */
- { 0, 0,
- sys_nosys }, /* 239 = unimplemented */
- { 0, 0,
- sys_nosys }, /* 240 = unimplemented */
+ sys_nosys }, /* 239 = unimplemented timer_getoverrun */
+ { 2, s(struct sys_nanosleep_args),
+ sys_nanosleep }, /* 240 = nanosleep */
{ 0, 0,
sys_nosys }, /* 241 = unimplemented */
{ 0, 0,
-/* $OpenBSD: kern_time.c,v 1.5 1997/03/16 01:18:48 flipk Exp $ */
+/* $OpenBSD: kern_time.c,v 1.6 1997/04/20 20:49:42 tholo Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
#include <machine/cpu.h>
+static void settime __P((struct timeval *));
+
/*
* Time of day and interval timer support.
*
* timers when they expire.
*/
+/* This function is used by clock_settime and settimeofday */
+static void
+settime(tv)
+ struct timeval *tv;
+{
+ struct timeval delta;
+ int s;
+
+ /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
+ s = splclock();
+ timersub(tv, &time, &delta);
+ time = *tv;
+ (void) splsoftclock();
+ timeradd(&boottime, &delta, &boottime);
+ timeradd(&runtime, &delta, &runtime);
+# if defined(NFS) || defined(NFSSERVER)
+ nqnfs_lease_updatetime(delta.tv_sec);
+# endif
+ splx(s);
+ resettodr();
+}
+
+/* ARGSUSED */
+int
+sys_clock_gettime(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct sys_clock_gettime_args /* {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+ } */ *uap = v;
+ clockid_t clock_id;
+ struct timeval atv;
+ struct timespec ats;
+
+ clock_id = SCARG(uap, clock_id);
+ if (clock_id != CLOCK_REALTIME)
+ return (EINVAL);
+
+ microtime(&atv);
+ TIMEVAL_TO_TIMESPEC(&atv,&ats);
+
+ return copyout(&ats, SCARG(uap, tp), sizeof(ats));
+}
+
+/* ARGSUSED */
+int
+sys_clock_settime(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct sys_clock_settime_args /* {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(const struct timespec *) tp;
+ } */ *uap = v;
+ clockid_t clock_id;
+ struct timeval atv;
+ struct timespec ats;
+ int error;
+
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return (error);
+
+ clock_id = SCARG(uap, clock_id);
+ if (clock_id != CLOCK_REALTIME)
+ return (EINVAL);
+
+ if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0)
+ return (error);
+
+ TIMESPEC_TO_TIMEVAL(&atv,&ats);
+ settime(&atv);
+
+ return 0;
+}
+
+int
+sys_clock_getres(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct sys_clock_getres_args /* {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+ } */ *uap = v;
+ clockid_t clock_id;
+ struct timespec ts;
+ int error = 0;
+
+ clock_id = SCARG(uap, clock_id);
+ if (clock_id != CLOCK_REALTIME)
+ return (EINVAL);
+
+ if (SCARG(uap, tp)) {
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000000000 / hz;
+
+ error = copyout(&ts, SCARG(uap, tp), sizeof (ts));
+ }
+
+ return error;
+}
+
+/* ARGSUSED */
+int
+sys_nanosleep(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ static int nanowait;
+ register struct sys_nanosleep_args/* {
+ syscallarg(struct timespec *) rqtp;
+ syscallarg(struct timespec *) rmtp;
+ } */ *uap = v;
+ struct timespec rqt;
+ struct timespec rmt;
+ struct timeval atv, utv;
+ int error, s, timo;
+
+ error = copyin((caddr_t)SCARG(uap, rqtp), (caddr_t)&rqt,
+ sizeof(struct timespec));
+ if (error)
+ return (error);
+
+ TIMESPEC_TO_TIMEVAL(&atv,&rqt)
+ if (itimerfix(&atv))
+ return (EINVAL);
+
+ s = splclock();
+ timeradd(&atv,&time,&atv);
+ timo = hzto(&atv);
+ /*
+ * Avoid inadvertantly sleeping forever
+ */
+ if (timo == 0)
+ timo = 1;
+ splx(s);
+
+ error = tsleep(&nanowait, PWAIT | PCATCH, "nanosleep", timo);
+ if (error == ERESTART)
+ error = EINTR;
+ if (error == EWOULDBLOCK)
+ error = 0;
+
+ if (SCARG(uap, rmtp)) {
+ s = splclock();
+ utv = time;
+ splx(s);
+
+ timersub(&atv, &utv, &utv);
+ if (utv.tv_sec < 0)
+ timerclear(&utv);
+
+ TIMEVAL_TO_TIMESPEC(&utv,&rmt);
+ error = copyout((caddr_t)&rmt, (caddr_t)SCARG(uap,rmtp),
+ sizeof(rmt));
+ }
+
+ return error;
+}
+
/* ARGSUSED */
int
sys_gettimeofday(p, v, retval)
syscallarg(struct timeval *) tv;
syscallarg(struct timezone *) tzp;
} */ *uap = v;
- struct timeval atv, delta;
+ struct timeval atv;
struct timezone atz;
- int error, s;
+ int error;
if ((error = suser(p->p_ucred, &p->p_acflag)))
return (error);
if (SCARG(uap, tzp) && (error = copyin((caddr_t)SCARG(uap, tzp),
(caddr_t)&atz, sizeof(atz))))
return (error);
- if (SCARG(uap, tv)) {
- /*
- * If the system is secure, we do not allow the time to be
- * set to an earlier value (it may be slowed using adjtime,
- * but not set back). This feature prevent interlopers from
- * setting arbitrary time stamps on files.
- */
- if (securelevel > 1 && timercmp(&atv, &time, <))
- return (EPERM);
- /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
- s = splclock();
- timersub(&atv, &time, &delta);
- time = atv;
- (void) splsoftclock();
- timeradd(&boottime, &delta, &boottime);
- timeradd(&runtime, &delta, &runtime);
-# if defined(NFSCLIENT) || defined(NFSSERVER)
- nqnfs_lease_updatetime(delta.tv_sec);
-# endif
- splx(s);
- resettodr();
- }
+ if (SCARG(uap, tv))
+ settime(&atv);
if (SCARG(uap, tzp))
tz = atz;
return (0);
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.13 1997/01/26 05:18:27 downsj Exp
+ * created from OpenBSD: syscalls.master,v 1.14 1997/04/20 20:48:27 tholo Exp
*/
char *syscallnames[] = {
"#230 (unimplemented shmdt)", /* 230 = unimplemented shmdt */
"#231 (unimplemented shmget)", /* 231 = unimplemented shmget */
#endif
- "#232 (unimplemented)", /* 232 = unimplemented */
- "#233 (unimplemented)", /* 233 = unimplemented */
- "#234 (unimplemented)", /* 234 = unimplemented */
- "#235 (unimplemented)", /* 235 = unimplemented */
- "#236 (unimplemented)", /* 236 = unimplemented */
- "#237 (unimplemented)", /* 237 = unimplemented */
- "#238 (unimplemented)", /* 238 = unimplemented */
- "#239 (unimplemented)", /* 239 = unimplemented */
- "#240 (unimplemented)", /* 240 = unimplemented */
+ "clock_gettime", /* 232 = clock_gettime */
+ "clock_settime", /* 233 = clock_settime */
+ "clock_getres", /* 234 = clock_getres */
+ "#235 (unimplemented timer_create)", /* 235 = unimplemented timer_create */
+ "#236 (unimplemented timer_delete)", /* 236 = unimplemented timer_delete */
+ "#237 (unimplemented timer_settime)", /* 237 = unimplemented timer_settime */
+ "#238 (unimplemented timer_gettime)", /* 238 = unimplemented timer_gettime */
+ "#239 (unimplemented timer_getoverrun)", /* 239 = unimplemented timer_getoverrun */
+ "nanosleep", /* 240 = nanosleep */
"#241 (unimplemented)", /* 241 = unimplemented */
"#242 (unimplemented)", /* 242 = unimplemented */
"#243 (unimplemented)", /* 243 = unimplemented */
- $OpenBSD: syscalls.master,v 1.13 1997/01/26 05:18:27 downsj Exp $
+ $OpenBSD: syscalls.master,v 1.14 1997/04/20 20:48:27 tholo Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
230 UNIMPL shmdt
231 UNIMPL shmget
#endif
-232 UNIMPL
-233 UNIMPL
-234 UNIMPL
-235 UNIMPL
-236 UNIMPL
-237 UNIMPL
-238 UNIMPL
-239 UNIMPL
-240 UNIMPL
+232 STD { int sys_clock_gettime(clockid_t clock_id, \
+ struct timespec *tp); }
+233 STD { int sys_clock_settime(clockid_t clock_id, \
+ const struct timespec *tp); }
+234 STD { int sys_clock_getres(clockid_t clock_id, \
+ struct timespec *tp); }
+235 UNIMPL timer_create
+236 UNIMPL timer_delete
+237 UNIMPL timer_settime
+238 UNIMPL timer_gettime
+239 UNIMPL timer_getoverrun
+240 STD { int sys_nanosleep(const struct timespec *rqtp, \
+ struct timespec *rmtp); }
241 UNIMPL
242 UNIMPL
243 UNIMPL
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.13 1997/01/26 05:18:27 downsj Exp
+ * created from OpenBSD: syscalls.master,v 1.14 1997/04/20 20:48:27 tholo Exp
*/
#define SYS_syscall 0
#define SYS_shmctl 229
#define SYS_shmdt 230
#define SYS_shmget 231
+#define SYS_clock_gettime 232
+#define SYS_clock_settime 233
+#define SYS_clock_getres 234
+#define SYS_nanosleep 240
#define SYS_minherit 250
#define SYS_rfork 251
#define SYS_poll 252
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.13 1997/01/26 05:18:27 downsj Exp
+ * created from OpenBSD: syscalls.master,v 1.14 1997/04/20 20:48:27 tholo Exp
*/
#define syscallarg(x) union { x datum; register_t pad; }
syscallarg(int) shmflg;
};
+struct sys_clock_gettime_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+};
+
+struct sys_clock_settime_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(const struct timespec *) tp;
+};
+
+struct sys_clock_getres_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+};
+
+struct sys_nanosleep_args {
+ syscallarg(const struct timespec *) rqtp;
+ syscallarg(struct timespec *) rmtp;
+};
+
struct sys_minherit_args {
syscallarg(caddr_t) addr;
syscallarg(size_t) len;
int sys_shmget __P((struct proc *, void *, register_t *));
#else
#endif
+int sys_clock_gettime __P((struct proc *, void *, register_t *));
+int sys_clock_settime __P((struct proc *, void *, register_t *));
+int sys_clock_getres __P((struct proc *, void *, register_t *));
+int sys_nanosleep __P((struct proc *, void *, register_t *));
int sys_minherit __P((struct proc *, void *, register_t *));
int sys_rfork __P((struct proc *, void *, register_t *));
int sys_poll __P((struct proc *, void *, register_t *));