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/common/linux32_time.c | |
| 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/common/linux32_time.c')
| -rw-r--r-- | sys/compat/linux32/common/linux32_time.c | 30 |
1 files changed, 28 insertions, 2 deletions
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) { |
