diff options
| author | christos <christos@NetBSD.org> | 2009-01-11 02:45:45 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2009-01-11 02:45:45 +0000 |
| commit | 461a86f9bdbf4658bc4b37796e978427095f94a7 (patch) | |
| tree | eb340680ec500c8117744dbb3ea43074544ef572 /sys/dev/clockctl.c | |
| parent | 6bbe77565e03756efac493ed9189b441a5eeffba (diff) | |
merge christos-time_t
Diffstat (limited to 'sys/dev/clockctl.c')
| -rw-r--r-- | sys/dev/clockctl.c | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/sys/dev/clockctl.c b/sys/dev/clockctl.c index 77d2ba495e2..99947972a6f 100644 --- a/sys/dev/clockctl.c +++ b/sys/dev/clockctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: clockctl.c,v 1.23 2007/11/25 00:35:27 elad Exp $ */ +/* $NetBSD: clockctl.c,v 1.24 2009/01/11 02:45:50 christos Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -31,9 +31,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.23 2007/11/25 00:35:27 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.24 2009/01/11 02:45:50 christos Exp $"); #include "opt_ntp.h" +#include "opt_compat_netbsd.h" #include <sys/param.h> #include <sys/systm.h> @@ -48,6 +49,9 @@ __KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.23 2007/11/25 00:35:27 elad Exp $"); #endif /* NTP */ #include <sys/clockctl.h> +#ifdef COMPAT_50 +#include <compat/sys/clockctl.h> +#endif struct clockctl_softc { struct device clockctl_dev; @@ -79,57 +83,58 @@ clockctlioctl( int error = 0; switch (cmd) { - case CLOCKCTL_SETTIMEOFDAY: { - struct clockctl_settimeofday *args = - (struct clockctl_settimeofday *)data; + case CLOCKCTL_SETTIMEOFDAY: { + struct clockctl_settimeofday *args = data; - error = settimeofday1(args->tv, true, args->tzp, l, false); - if (error) - return (error); - break; - } - case CLOCKCTL_ADJTIME: { - struct clockctl_adjtime *args = - (struct clockctl_adjtime *)data; + error = settimeofday1(args->tv, true, args->tzp, l, false); + break; + } + case CLOCKCTL_ADJTIME: { + struct timeval atv, oldatv; + struct clockctl_adjtime *args = data; - error = adjtime1(args->delta, args->olddelta, - l->l_proc); + if (args->delta) { + error = copyin(args->delta, &atv, sizeof(*args->delta)); if (error) return (error); - break; } - case CLOCKCTL_CLOCK_SETTIME: { - struct clockctl_clock_settime *args = - (struct clockctl_clock_settime *)data; + adjtime1(args->delta ? &atv : NULL, + args->olddelta ? &oldatv : NULL, l->l_proc); + if (args->olddelta) + error = copyout(&oldatv, args->olddelta, + sizeof(args->olddelta)); + break; + } + case CLOCKCTL_CLOCK_SETTIME: { + struct clockctl_clock_settime *args = data; - error = clock_settime1(l->l_proc, args->clock_id, - args->tp, false); - if (error) - return (error); - break; - } + error = clock_settime1(l->l_proc, args->clock_id, + args->tp, false); + break; + } #ifdef NTP - case CLOCKCTL_NTP_ADJTIME: { - struct clockctl_ntp_adjtime *args = - (struct clockctl_ntp_adjtime *)data; - struct timex ntv; - register_t retval; - - error = copyin(args->tp, &ntv, sizeof(ntv)); - if (error) - return (error); + case CLOCKCTL_NTP_ADJTIME: { + struct clockctl_ntp_adjtime *args = data; + struct timex ntv; + register_t retval; - ntp_adjtime1(&ntv); + error = copyin(args->tp, &ntv, sizeof(ntv)); + if (error) + return (error); - error = copyout(&ntv, args->tp, sizeof(ntv)); - if (error == 0) - (void)copyout(&retval, &args->retval, sizeof(retval)); + ntp_adjtime1(&ntv); - return (error); - } + error = copyout(&ntv, args->tp, sizeof(ntv)); + if (error == 0) + error = copyout(&retval, &args->retval, sizeof(retval)); + } #endif /* NTP */ - default: - error = EINVAL; + default: +#ifdef COMPAT_50 + error = compat50_clockctlioctl(dev, cmd, data, flags, l); +#else + error = EINVAL; +#endif } return (error); |
