/* ARGSUSED */ int sys___clock_settime50(struct lwp *l, const struct sys___clock_settime50_args *uap, register_t *retval) { /* { syscallarg(clockid_t) clock_id; syscallarg(const struct timespec *) tp; } */ int error; struct timespec ats; if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0) return error; return clock_settime1(l->l_proc, SCARG(uap, clock_id), &ats, true); }
int netbsd32___clock_settime50(struct lwp *l, const struct netbsd32___clock_settime50_args *uap, register_t *retval) { /* { syscallarg(netbsd32_clockid_t) clock_id; syscallarg(const netbsd32_timespecp_t) tp; } */ struct netbsd32_timespec ts32; struct timespec ats; int error; if ((error = copyin(SCARG_P32(uap, tp), &ts32, sizeof(ts32))) != 0) return (error); netbsd32_to_timespec(&ts32, &ats); return clock_settime1(l->l_proc, SCARG(uap, clock_id), &ats, true); }
int clockctlioctl( dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) { int error = 0; switch (cmd) { case CLOCKCTL_SETTIMEOFDAY: { struct clockctl_settimeofday *args = data; error = settimeofday1(args->tv, true, args->tzp, l, false); break; } case CLOCKCTL_ADJTIME: { struct timeval atv, oldatv; struct clockctl_adjtime *args = data; if (args->delta) { error = copyin(args->delta, &atv, sizeof(atv)); if (error) return (error); } adjtime1(args->delta ? &atv : NULL, args->olddelta ? &oldatv : NULL, l->l_proc); if (args->olddelta) error = copyout(&oldatv, args->olddelta, sizeof(oldatv)); break; } case CLOCKCTL_CLOCK_SETTIME: { struct clockctl_clock_settime *args = data; struct timespec ts; error = copyin(args->tp, &ts, sizeof ts); if (error) return (error); error = clock_settime1(l->l_proc, args->clock_id, &ts, false); break; } #ifdef NTP case CLOCKCTL_NTP_ADJTIME: { struct clockctl_ntp_adjtime *args = data; struct timex ntv; error = copyin(args->tp, &ntv, sizeof(ntv)); if (error) return (error); ntp_adjtime1(&ntv); error = copyout(&ntv, args->tp, sizeof(ntv)); if (error == 0) args->retval = ntp_timestatus(); break; } #endif /* NTP */ default: #ifdef COMPAT_50 error = compat50_clockctlioctl(dev, cmd, data, flags, l); #else error = EINVAL; #endif } return (error); }