Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
This commit is contained in:
parent
56bd854634
commit
d25eb1e966
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.91 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.92 2017/01/02 16:32:09 manu Exp $
|
||||
;
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -731,7 +731,10 @@
|
|||
linux_umode_t mode); }
|
||||
462 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
463 UNIMPL pselect6
|
||||
463 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
464 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.57 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.58 2017/01/02 16:32:09 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -489,7 +489,10 @@
|
|||
linux_umode_t mode); }
|
||||
269 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
270 UNIMPL pselect6
|
||||
270 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
271 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.64 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.65 2017/01/02 16:32:09 manu Exp $
|
||||
|
||||
; Derived from sys/compat/linux/arch/*/syscalls.master
|
||||
; and from Linux 2.4.12 arch/arm/kernel/calls.S
|
||||
|
@ -530,7 +530,10 @@
|
|||
linux_umode_t mode); }
|
||||
334 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
335 UNIMPL pselect6
|
||||
335 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
336 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.121 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.122 2017/01/02 16:32:09 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -503,7 +503,10 @@
|
|||
linux_umode_t mode); }
|
||||
307 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
308 UNIMPL pselect6
|
||||
308 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
309 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.90 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.91 2017/01/02 16:32:09 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -511,7 +511,10 @@
|
|||
linux_umode_t mode); }
|
||||
300 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
301 UNIMPL pselect6
|
||||
301 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
302 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.60 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.61 2017/01/02 16:32:10 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -501,7 +501,10 @@
|
|||
linux_umode_t mode); }
|
||||
300 STD { int|linux_sys||faccessat(int fd, const char *path, \
|
||||
int amode); }
|
||||
301 UNIMPL pselect6
|
||||
301 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
302 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: syscalls.master,v 1.69 2016/07/24 13:22:01 njoly Exp $
|
||||
$NetBSD: syscalls.master,v 1.70 2017/01/02 16:32:10 manu Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
|
@ -478,7 +478,10 @@
|
|||
277 UNIMPL inotify_rm_watch
|
||||
278 UNIMPL spu_run
|
||||
279 UNIMPL spu_create
|
||||
280 UNIMPL pselect6
|
||||
280 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \
|
||||
fd_set *writefds, fd_set *exceptfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sized_sigset_t *ss); }
|
||||
281 STD { int|linux_sys||ppoll(struct pollfd *fds, u_int nfds, \
|
||||
struct linux_timespec *timeout, \
|
||||
linux_sigset_t *sigset); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_misc.c,v 1.233 2016/11/10 17:00:51 christos Exp $ */
|
||||
/* $NetBSD: linux_misc.c,v 1.234 2017/01/02 16:32:10 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -57,7 +57,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.233 2016/11/10 17:00:51 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.234 2017/01/02 16:32:10 manu Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -925,6 +925,87 @@ linux_select1(struct lwp *l, register_t *retval, int nfds, fd_set *readfds,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Derived from FreeBSD's sys/compat/linux/linux_misc.c:linux_pselect6()
|
||||
* which was contributed by Dmitry Chagin
|
||||
* https://svnweb.freebsd.org/base?view=revision&revision=283403
|
||||
*/
|
||||
int
|
||||
linux_sys_pselect6(struct lwp *l,
|
||||
const struct linux_sys_pselect6_args *uap, register_t *retval)
|
||||
{
|
||||
/* {
|
||||
syscallarg(int) nfds;
|
||||
syscallarg(fd_set *) readfds;
|
||||
syscallarg(fd_set *) writefds;
|
||||
syscallarg(fd_set *) exceptfds;
|
||||
syscallarg(struct timespec *) timeout;
|
||||
syscallarg(linux_sized_sigset_t *) ss;
|
||||
} */
|
||||
struct timespec uts, ts0, ts1, *tsp;
|
||||
linux_sized_sigset_t lsss;
|
||||
struct linux_timespec lts;
|
||||
linux_sigset_t lss;
|
||||
sigset_t *ssp;
|
||||
sigset_t ss;
|
||||
int error;
|
||||
|
||||
ssp = NULL;
|
||||
if (SCARG(uap, ss) != NULL) {
|
||||
if ((error = copyin(SCARG(uap, ss), &lsss, sizeof(lsss))) != 0)
|
||||
return (error);
|
||||
if (lsss.ss_len != sizeof(lss))
|
||||
return (EINVAL);
|
||||
if (lsss.ss != NULL) {
|
||||
if ((error = copyin(lsss.ss, &lss, sizeof(lss))) != 0)
|
||||
return (error);
|
||||
linux_to_native_sigset(&ss, &lss);
|
||||
ssp = &ss;
|
||||
}
|
||||
}
|
||||
|
||||
if (SCARG(uap, timeout) != NULL) {
|
||||
error = copyin(SCARG(uap, timeout), <s, sizeof(lts));
|
||||
if (error != 0)
|
||||
return (error);
|
||||
linux_to_native_timespec(&uts, <s);
|
||||
|
||||
if (itimespecfix(&uts))
|
||||
return (EINVAL);
|
||||
|
||||
nanotime(&ts0);
|
||||
tsp = &uts;
|
||||
} else {
|
||||
tsp = NULL;
|
||||
}
|
||||
|
||||
error = selcommon(retval, SCARG(uap, nfds), SCARG(uap, readfds),
|
||||
SCARG(uap, writefds), SCARG(uap, exceptfds), tsp, ssp);
|
||||
|
||||
if (error == 0 && tsp != NULL) {
|
||||
if (retval != 0) {
|
||||
/*
|
||||
* Compute how much time was left of the timeout,
|
||||
* by subtracting the current time and the time
|
||||
* before we started the call, and subtracting
|
||||
* that result from the user-supplied value.
|
||||
*/
|
||||
nanotime(&ts1);
|
||||
timespecsub(&ts1, &ts0, &ts1);
|
||||
timespecsub(&uts, &ts1, &uts);
|
||||
if (uts.tv_sec < 0)
|
||||
timespecclear(&uts);
|
||||
} else {
|
||||
timespecclear(&uts);
|
||||
}
|
||||
|
||||
native_to_linux_timespec(<s, &uts);
|
||||
error = copyout(<s, SCARG(uap, timeout), sizeof(lts));
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
linux_sys_ppoll(struct lwp *l,
|
||||
const struct linux_sys_ppoll_args *uap, register_t *retval)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_signal.h,v 1.30 2009/05/29 14:19:13 njoly Exp $ */
|
||||
/* $NetBSD: linux_signal.h,v 1.31 2017/01/02 16:32:10 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -48,6 +48,11 @@
|
|||
#include <compat/linux/arch/amd64/linux_signal.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
linux_sigset_t *ss;
|
||||
size_t ss_len;
|
||||
} linux_sized_sigset_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern const int native_to_linux_signo[];
|
||||
extern const int linux_to_native_signo[];
|
||||
|
|
Loading…
Reference in New Issue