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/linux/common/linux_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/linux/common/linux_time.c')
| -rw-r--r-- | sys/compat/linux/common/linux_time.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sys/compat/linux/common/linux_time.c b/sys/compat/linux/common/linux_time.c index eeae91942f8..3e9d86b87f6 100644 --- a/sys/compat/linux/common/linux_time.c +++ b/sys/compat/linux/common/linux_time.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_time.c,v 1.25 2008/06/18 12:24:18 tsutsui Exp $ */ +/* $NetBSD: linux_time.c,v 1.26 2008/11/12 18:07:41 njoly Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.25 2008/06/18 12:24:18 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.26 2008/11/12 18:07:41 njoly Exp $"); #include <sys/param.h> #include <sys/ucred.h> @@ -144,6 +144,32 @@ linux_to_native_timespec(struct timespec *ntp, struct linux_timespec *ltp) } int +linux_sys_nanosleep(struct lwp *l, const struct linux_sys_nanosleep_args *uap, + register_t *retval) +{ + /* { + syscallarg(struct linux_timespec *) rqtp; + syscallarg(struct linux_timespec *) rmtp; + } */ + struct timespec rqts, rmts; + struct linux_timespec lrqts, lrmts; + int error, error1; + + error = copyin(SCARG(uap, rqtp), &lrqts, sizeof(lrqts)); + if (error != 0) + return error; + linux_to_native_timespec(&rqts, &lrqts); + + error = nanosleep1(l, &rqts, SCARG(uap, rmtp) ? &rmts : NULL); + if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR)) + return error; + + native_to_linux_timespec(&lrmts, &rmts); + error1 = copyout(&lrmts, SCARG(uap, rmtp), sizeof(lrmts)); + return error1 ? error1 : error; +} + +int linux_to_native_clockid(clockid_t *n, clockid_t l) { switch (l) { |
