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.
This commit is contained in:
parent
7181375540
commit
cf19223289
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.62 2008/04/04 12:38:52 njoly Exp $
|
$NetBSD: syscalls.master,v 1.63 2008/11/12 18:07:40 njoly Exp $
|
||||||
;
|
;
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -537,8 +537,9 @@
|
|||||||
337 UNIMPL sched_rr_get_interval
|
337 UNIMPL sched_rr_get_interval
|
||||||
338 UNIMPL afs_syscall
|
338 UNIMPL afs_syscall
|
||||||
339 STD { int linux_sys_uname(struct linux_utsname *up); }
|
339 STD { int linux_sys_uname(struct linux_utsname *up); }
|
||||||
340 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
340 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
341 STD { void *linux_sys_mremap(void *old_address, \
|
341 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
342 UNIMPL nfsservctl
|
342 UNIMPL nfsservctl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.24 2008/10/26 20:25:49 christos Exp $
|
$NetBSD: syscalls.master,v 1.25 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -125,8 +125,9 @@
|
|||||||
32 NOARGS { int sys_dup(u_int fd); }
|
32 NOARGS { int sys_dup(u_int fd); }
|
||||||
33 NOARGS { int sys_dup2(u_int from, u_int to); }
|
33 NOARGS { int sys_dup2(u_int from, u_int to); }
|
||||||
34 STD { int linux_sys_pause(void); }
|
34 STD { int linux_sys_pause(void); }
|
||||||
35 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
35 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
36 NOARGS { int sys_getitimer(u_int which, \
|
36 NOARGS { int sys_getitimer(u_int which, \
|
||||||
struct itimerval *itv); }
|
struct itimerval *itv); }
|
||||||
37 STD { int linux_sys_alarm(unsigned int secs); }
|
37 STD { int linux_sys_alarm(unsigned int secs); }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.35 2008/04/23 14:07:49 ad Exp $
|
$NetBSD: syscalls.master,v 1.36 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; Derived from sys/compat/linux/arch/*/syscalls.master
|
; Derived from sys/compat/linux/arch/*/syscalls.master
|
||||||
; and from Linux 2.4.12 arch/arm/kernel/calls.S
|
; and from Linux 2.4.12 arch/arm/kernel/calls.S
|
||||||
@ -273,8 +273,9 @@
|
|||||||
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
||||||
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
||||||
161 UNIMPL sched_rr_get_interval
|
161 UNIMPL sched_rr_get_interval
|
||||||
162 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
162 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
163 STD { void *linux_sys_mremap(void *old_address, \
|
163 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.93 2008/10/26 16:38:22 christos Exp $
|
$NetBSD: syscalls.master,v 1.94 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -284,8 +284,9 @@
|
|||||||
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
||||||
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
||||||
161 UNIMPL sys_sched_rr_get_interval
|
161 UNIMPL sys_sched_rr_get_interval
|
||||||
162 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
162 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
163 STD { void *linux_sys_mremap(void *old_address, \
|
163 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.62 2008/06/18 12:21:20 tsutsui Exp $
|
$NetBSD: syscalls.master,v 1.63 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -291,8 +291,9 @@
|
|||||||
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
||||||
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
||||||
161 UNIMPL sched_rr_get_interval
|
161 UNIMPL sched_rr_get_interval
|
||||||
162 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
162 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
163 STD { void *linux_sys_mremap(void *old_address, \
|
163 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
164 STD { int linux_sys_setresuid16(linux_uid16_t ruid, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.29 2008/04/23 14:07:50 ad Exp $
|
$NetBSD: syscalls.master,v 1.30 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -278,8 +278,9 @@
|
|||||||
163 STD { int linux_sys_sched_get_priority_max(int policy); }
|
163 STD { int linux_sys_sched_get_priority_max(int policy); }
|
||||||
164 STD { int linux_sys_sched_get_priority_min(int policy); }
|
164 STD { int linux_sys_sched_get_priority_min(int policy); }
|
||||||
165 UNIMPL sched_rr_get_interval
|
165 UNIMPL sched_rr_get_interval
|
||||||
166 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
166 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
167 STD { void *linux_sys_mremap(void *old_address, \
|
167 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
168 NOARGS { int linux_sys_accept(int s, \
|
168 NOARGS { int linux_sys_accept(int s, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$NetBSD: syscalls.master,v 1.37 2008/04/23 14:07:50 ad Exp $
|
$NetBSD: syscalls.master,v 1.38 2008/11/12 18:07:40 njoly Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||||
|
|
||||||
@ -301,8 +301,9 @@
|
|||||||
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
159 STD { int linux_sys_sched_get_priority_max(int policy); }
|
||||||
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
160 STD { int linux_sys_sched_get_priority_min(int policy); }
|
||||||
161 UNIMPL sched_rr_get_interval
|
161 UNIMPL sched_rr_get_interval
|
||||||
162 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \
|
162 STD { int linux_sys_nanosleep( \
|
||||||
struct timespec *rmtp); }
|
const struct linux_timespec *rqtp, \
|
||||||
|
struct linux_timespec *rmtp); }
|
||||||
163 STD { void *linux_sys_mremap(void *old_address, \
|
163 STD { void *linux_sys_mremap(void *old_address, \
|
||||||
size_t old_size, size_t new_size, u_long flags); }
|
size_t old_size, size_t new_size, u_long flags); }
|
||||||
164 STD { int linux_sys_setresuid(uid_t ruid, uid_t euid, \
|
164 STD { int linux_sys_setresuid(uid_t ruid, uid_t euid, \
|
||||||
|
@ -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.
|
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/ucred.h>
|
#include <sys/ucred.h>
|
||||||
@ -143,6 +143,32 @@ linux_to_native_timespec(struct timespec *ntp, struct linux_timespec *ltp)
|
|||||||
ntp->tv_nsec = ltp->tv_nsec;
|
ntp->tv_nsec = ltp->tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
linux_to_native_clockid(clockid_t *n, clockid_t l)
|
linux_to_native_clockid(clockid_t *n, clockid_t l)
|
||||||
{
|
{
|
||||||
|
@ -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.
|
; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
|
||||||
; (See syscalls.conf to see what it is processed into.)
|
; (See syscalls.conf to see what it is processed into.)
|
||||||
@ -279,8 +279,8 @@
|
|||||||
159 UNIMPL sched_get_priority_max
|
159 UNIMPL sched_get_priority_max
|
||||||
160 UNIMPL sched_get_priority_min
|
160 UNIMPL sched_get_priority_min
|
||||||
161 UNIMPL sched_rr_get_interval
|
161 UNIMPL sched_rr_get_interval
|
||||||
162 NOARGS { int netbsd32_nanosleep(netbsd32_timespecp_t rqtp \
|
162 STD { int linux32_sys_nanosleep(linux32_timespecp_t rqtp, \
|
||||||
netbsd32_timespecp_t rmtp); }
|
linux32_timespecp_t rmtp); }
|
||||||
163 STD { int linux32_sys_mremap(netbsd32_voidp old_address, \
|
163 STD { int linux32_sys_mremap(netbsd32_voidp old_address, \
|
||||||
netbsd32_size_t old_size, netbsd32_size_t new_size, \
|
netbsd32_size_t old_size, netbsd32_size_t new_size, \
|
||||||
netbsd32_u_long flags); }
|
netbsd32_u_long flags); }
|
||||||
|
@ -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.
|
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
|
||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -254,6 +254,32 @@ linux32_to_native_timespec(struct timespec *ntp, struct linux32_timespec *ltp)
|
|||||||
ntp->tv_nsec = ltp->tv_nsec;
|
ntp->tv_nsec = ltp->tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
linux32_sys_clock_settime(struct lwp *l,
|
linux32_sys_clock_settime(struct lwp *l,
|
||||||
const struct linux32_sys_clock_settime_args *uap, register_t *retval)
|
const struct linux32_sys_clock_settime_args *uap, register_t *retval)
|
||||||
|
Loading…
Reference in New Issue
Block a user