diff options
| author | njoly <njoly@NetBSD.org> | 2008-11-12 18:07:40 +0000 |
|---|---|---|
| committer | njoly <njoly@NetBSD.org> | 2008-11-12 18:07:40 +0000 |
| commit | cf1922328920fc187a1365dddb72709fb43b4e2a (patch) | |
| tree | c72693dbccf998d2b052f49243bcf4e69d292f18 /sys/compat/linux32 | |
| parent | 7181375540c2dbfc337f893a547e879cc44a4ac5 (diff) | |
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
Diffstat (limited to 'sys/compat/linux32')
| -rw-r--r-- | sys/compat/linux32/arch/amd64/syscalls.master | 6 | ||||
| -rw-r--r-- | sys/compat/linux32/common/linux32_time.c | 30 |
2 files changed, 31 insertions, 5 deletions
diff --git a/sys/compat/linux32/arch/amd64/syscalls.master b/sys/compat/linux32/arch/amd64/syscalls.master index a546e8dbba8..4bf4f11650a 100644 --- a/sys/compat/linux32/arch/amd64/syscalls.master +++ b/sys/compat/linux32/arch/amd64/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.38 2008/10/06 14:53:01 njoly Exp $ + $NetBSD: syscalls.master,v 1.39 2008/11/12 18:07:41 njoly Exp $ ; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file. ; (See syscalls.conf to see what it is processed into.) @@ -279,8 +279,8 @@ 159 UNIMPL sched_get_priority_max 160 UNIMPL sched_get_priority_min 161 UNIMPL sched_rr_get_interval -162 NOARGS { int netbsd32_nanosleep(netbsd32_timespecp_t rqtp \ - netbsd32_timespecp_t rmtp); } +162 STD { int linux32_sys_nanosleep(linux32_timespecp_t rqtp, \ + linux32_timespecp_t rmtp); } 163 STD { int linux32_sys_mremap(netbsd32_voidp old_address, \ netbsd32_size_t old_size, netbsd32_size_t new_size, \ netbsd32_u_long flags); } diff --git a/sys/compat/linux32/common/linux32_time.c b/sys/compat/linux32/common/linux32_time.c index 8af76eb050d..35402be410a 100644 --- a/sys/compat/linux32/common/linux32_time.c +++ b/sys/compat/linux32/common/linux32_time.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_time.c,v 1.21 2008/09/08 15:31:19 christos Exp $ */ +/* $NetBSD: linux32_time.c,v 1.22 2008/11/12 18:07:41 njoly Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.21 2008/09/08 15:31:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.22 2008/11/12 18:07:41 njoly Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -255,6 +255,32 @@ linux32_to_native_timespec(struct timespec *ntp, struct linux32_timespec *ltp) } int +linux32_sys_nanosleep(struct lwp *l, + const struct linux32_sys_nanosleep_args *uap, register_t *retval) +{ + /* { + syscallarg(linux32_timespecp_t) rqtp; + syscallarg(linux32_timespecp_t) rmtp; + } */ + struct timespec rqts, rmts; + struct linux32_timespec lrqts, lrmts; + int error, error1; + + error = copyin(SCARG_P32(uap, rqtp), &lrqts, sizeof(lrqts)); + if (error != 0) + return error; + linux32_to_native_timespec(&rqts, &lrqts); + + error = nanosleep1(l, &rqts, SCARG_P32(uap, rmtp) ? &rmts : NULL); + if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR)) + return error; + + native_to_linux32_timespec(&lrmts, &rmts); + error1 = copyout(&lrmts, SCARG_P32(uap, rmtp), sizeof(lrmts)); + return error1 ? error1 : error; +} + +int linux32_sys_clock_settime(struct lwp *l, const struct linux32_sys_clock_settime_args *uap, register_t *retval) { |
