diff options
author | ps <ps@FreeBSD.org> | 2005-10-15 02:54:18 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2005-10-15 02:54:18 +0000 |
commit | c63313b35dc037347e1ede7ea87fa59d5274d48b (patch) | |
tree | 9f9a1f1ea252ef32c27637c08c7252daafe8b1bd /sys/compat | |
parent | a936b63f3d4634b73be4bdb5aa6ab71c17ee1eb9 (diff) | |
download | FreeBSD-src-c63313b35dc037347e1ede7ea87fa59d5274d48b.zip FreeBSD-src-c63313b35dc037347e1ede7ea87fa59d5274d48b.tar.gz |
Implement 32bit wrappers for clock_gettime, clock_settime, and
clock_getres.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 53 | ||||
-rw-r--r-- | sys/compat/freebsd32/syscalls.master | 12 |
2 files changed, 59 insertions, 6 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 5fcfe58..d3aa4e8 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1260,6 +1260,59 @@ freebsd32_nanosleep(struct thread *td, struct freebsd32_nanosleep_args *uap) return (error); } +int +freebsd32_clock_gettime(struct thread *td, + struct freebsd32_clock_gettime_args *uap) +{ + struct timespec ats; + struct timespec32 ats32; + int error; + + error = kern_clock_gettime(td, uap->clock_id, &ats); + if (error == 0) { + CP(ats, ats32, tv_sec); + CP(ats, ats32, tv_nsec); + error = copyout(&ats32, uap->tp, sizeof(ats32)); + } + return (error); +} + +int +freebsd32_clock_settime(struct thread *td, + struct freebsd32_clock_settime_args *uap) +{ + struct timespec ats; + struct timespec32 ats32; + int error; + + error = copyin(uap->tp, &ats32, sizeof(ats32)); + if (error) + return (error); + CP(ats32, ats, tv_sec); + CP(ats32, ats, tv_nsec); + + return (kern_clock_settime(td, uap->clock_id, &ats)); +} + +int +freebsd32_clock_getres(struct thread *td, + struct freebsd32_clock_getres_args *uap) +{ + struct timespec ts; + struct timespec32 ts32; + int error; + + if (uap->tp == NULL) + return (0); + error = kern_clock_getres(td, uap->clock_id, &ts); + if (error == 0) { + CP(ts, ts32, tv_sec); + CP(ts, ts32, tv_nsec); + error = copyout(&ts32, uap->tp, sizeof(ts32)); + } + return (error); +} + #if 0 int diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index cab7077..8e6806a 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -412,12 +412,12 @@ 231 AUE_NULL MNOPROTO { int shmget(key_t key, int size, \ int shmflg); } ; -232 AUE_NULL MNOPROTO { int clock_gettime(clockid_t clock_id, \ - struct timespec *tp); } -233 AUE_NULL MNOPROTO { int clock_settime(clockid_t clock_id, \ - const struct timespec *tp); } -234 AUE_NULL MNOPROTO { int clock_getres(clockid_t clock_id, \ - struct timespec *tp); } +232 AUE_NULL MSTD { int freebsd32_clock_gettime(clockid_t clock_id, \ + struct timespec32 *tp); } +233 AUE_NULL MSTD { int freebsd32_clock_settime(clockid_t clock_id, \ + const struct timespec32 *tp); } +234 AUE_NULL MSTD { int freebsd32_clock_getres(clockid_t clock_id, \ + struct timespec32 *tp); } 235 AUE_NULL UNIMPL timer_create 236 AUE_NULL UNIMPL timer_delete 237 AUE_NULL UNIMPL timer_settime |