Module Name: src
Committed By: manu
Date: Mon Jan 2 16:32:10 UTC 2017
Modified Files:
src/sys/compat/linux/arch/alpha: syscalls.master
src/sys/compat/linux/arch/amd64: syscalls.master
src/sys/compat/linux/arch/arm: syscalls.master
src/sys/compat/linux/arch/i386: syscalls.master
src/sys/compat/linux/arch/m68k: syscalls.master
src/sys/compat/linux/arch/mips: syscalls.master
src/sys/compat/linux/arch/powerpc: syscalls.master
src/sys/compat/linux/common: linux_misc.c linux_signal.h
Log Message:
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/compat/linux/arch/alpha/syscalls.master
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.121 -r1.122 src/sys/compat/linux/arch/i386/syscalls.master
cvs rdiff -u -r1.90 -r1.91 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.60 -r1.61 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.69 -r1.70 src/sys/compat/linux/arch/powerpc/syscalls.master
cvs rdiff -u -r1.233 -r1.234 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.30 -r1.31 src/sys/compat/linux/common/linux_signal.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/arch/alpha/syscalls.master
diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.91 src/sys/compat/linux/arch/alpha/syscalls.master:1.92
--- src/sys/compat/linux/arch/alpha/syscalls.master:1.91 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/alpha/syscalls.master Mon Jan 2 16:32:09 2017
@@ -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); }
Index: src/sys/compat/linux/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.57 src/sys/compat/linux/arch/amd64/syscalls.master:1.58
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.57 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/amd64/syscalls.master Mon Jan 2 16:32:09 2017
@@ -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); }
Index: src/sys/compat/linux/arch/arm/syscalls.master
diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.64 src/sys/compat/linux/arch/arm/syscalls.master:1.65
--- src/sys/compat/linux/arch/arm/syscalls.master:1.64 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/arm/syscalls.master Mon Jan 2 16:32:09 2017
@@ -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); }
Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.121 src/sys/compat/linux/arch/i386/syscalls.master:1.122
--- src/sys/compat/linux/arch/i386/syscalls.master:1.121 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/i386/syscalls.master Mon Jan 2 16:32:09 2017
@@ -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); }
Index: src/sys/compat/linux/arch/m68k/syscalls.master
diff -u src/sys/compat/linux/arch/m68k/syscalls.master:1.90 src/sys/compat/linux/arch/m68k/syscalls.master:1.91
--- src/sys/compat/linux/arch/m68k/syscalls.master:1.90 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/m68k/syscalls.master Mon Jan 2 16:32:09 2017
@@ -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); }
Index: src/sys/compat/linux/arch/mips/syscalls.master
diff -u src/sys/compat/linux/arch/mips/syscalls.master:1.60 src/sys/compat/linux/arch/mips/syscalls.master:1.61
--- src/sys/compat/linux/arch/mips/syscalls.master:1.60 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/mips/syscalls.master Mon Jan 2 16:32:10 2017
@@ -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); }
Index: src/sys/compat/linux/arch/powerpc/syscalls.master
diff -u src/sys/compat/linux/arch/powerpc/syscalls.master:1.69 src/sys/compat/linux/arch/powerpc/syscalls.master:1.70
--- src/sys/compat/linux/arch/powerpc/syscalls.master:1.69 Sun Jul 24 13:22:01 2016
+++ src/sys/compat/linux/arch/powerpc/syscalls.master Mon Jan 2 16:32:10 2017
@@ -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); }
Index: src/sys/compat/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.233 src/sys/compat/linux/common/linux_misc.c:1.234
--- src/sys/compat/linux/common/linux_misc.c:1.233 Thu Nov 10 17:00:51 2016
+++ src/sys/compat/linux/common/linux_misc.c Mon Jan 2 16:32:10 2017
@@ -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
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)
Index: src/sys/compat/linux/common/linux_signal.h
diff -u src/sys/compat/linux/common/linux_signal.h:1.30 src/sys/compat/linux/common/linux_signal.h:1.31
--- src/sys/compat/linux/common/linux_signal.h:1.30 Fri May 29 14:19:13 2009
+++ src/sys/compat/linux/common/linux_signal.h Mon Jan 2 16:32:10 2017
@@ -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[];