Module Name: src Committed By: pooka Date: Wed Sep 19 21:19:15 UTC 2012
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 Log Message: emulate ppoll which is essentially our pollts To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/compat/linux/arch/alpha/syscalls.master cvs rdiff -u -r1.40 -r1.41 src/sys/compat/linux/arch/amd64/syscalls.master cvs rdiff -u -r1.48 -r1.49 src/sys/compat/linux/arch/arm/syscalls.master cvs rdiff -u -r1.107 -r1.108 src/sys/compat/linux/arch/i386/syscalls.master cvs rdiff -u -r1.73 -r1.74 src/sys/compat/linux/arch/m68k/syscalls.master cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/arch/mips/syscalls.master cvs rdiff -u -r1.50 -r1.51 src/sys/compat/linux/arch/powerpc/syscalls.master cvs rdiff -u -r1.219 -r1.220 src/sys/compat/linux/common/linux_misc.c 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.76 src/sys/compat/linux/arch/alpha/syscalls.master:1.77 --- src/sys/compat/linux/arch/alpha/syscalls.master:1.76 Fri Nov 18 04:03:50 2011 +++ src/sys/compat/linux/arch/alpha/syscalls.master Wed Sep 19 21:19:14 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.76 2011/11/18 04:03:50 christos Exp $ + $NetBSD: syscalls.master,v 1.77 2012/09/19 21:19:14 pooka Exp $ ; ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -712,7 +712,9 @@ 461 UNIMPL fchmodat 462 UNIMPL faccessat 463 UNIMPL pselect6 -464 UNIMPL ppoll +464 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 465 UNIMPL unshare 466 STD { int|linux_sys||set_robust_list( \ struct linux_robust_list_head *head, size_t len); } Index: src/sys/compat/linux/arch/amd64/syscalls.master diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.40 src/sys/compat/linux/arch/amd64/syscalls.master:1.41 --- src/sys/compat/linux/arch/amd64/syscalls.master:1.40 Fri Nov 18 04:03:50 2011 +++ src/sys/compat/linux/arch/amd64/syscalls.master Wed Sep 19 21:19:14 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.40 2011/11/18 04:03:50 christos Exp $ + $NetBSD: syscalls.master,v 1.41 2012/09/19 21:19:14 pooka Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -476,7 +476,9 @@ 268 UNIMPL fchmodat 269 UNIMPL faccessat 270 UNIMPL pselect6 -271 UNIMPL ppoll +271 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 272 UNIMPL unshare 273 STD { int|linux_sys||set_robust_list( \ struct linux_robust_list_head *head, size_t len); } Index: src/sys/compat/linux/arch/arm/syscalls.master diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.48 src/sys/compat/linux/arch/arm/syscalls.master:1.49 --- src/sys/compat/linux/arch/arm/syscalls.master:1.48 Fri Nov 18 04:03:50 2011 +++ src/sys/compat/linux/arch/arm/syscalls.master Wed Sep 19 21:19:14 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.48 2011/11/18 04:03:50 christos Exp $ + $NetBSD: syscalls.master,v 1.49 2012/09/19 21:19:14 pooka Exp $ ; Derived from sys/compat/linux/arch/*/syscalls.master ; and from Linux 2.4.12 arch/arm/kernel/calls.S @@ -517,7 +517,9 @@ 333 UNIMPL fchmodat 334 UNIMPL faccessat 335 UNIMPL pselect6 -336 UNIMPL ppoll +336 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 337 UNIMPL unshare 338 STD { int|linux_sys||set_robust_list( \ struct linux_robust_list_head *head, size_t len); } Index: src/sys/compat/linux/arch/i386/syscalls.master diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.107 src/sys/compat/linux/arch/i386/syscalls.master:1.108 --- src/sys/compat/linux/arch/i386/syscalls.master:1.107 Fri Nov 18 04:03:50 2011 +++ src/sys/compat/linux/arch/i386/syscalls.master Wed Sep 19 21:19:14 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.107 2011/11/18 04:03:50 christos Exp $ + $NetBSD: syscalls.master,v 1.108 2012/09/19 21:19:14 pooka Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -490,7 +490,9 @@ 306 UNIMPL fchmodat 307 UNIMPL faccessat 308 UNIMPL pselect6 -309 UNIMPL ppoll +309 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 310 UNIMPL unshare 311 STD { int|linux_sys||set_robust_list( \ struct linux_robust_list_head *head, size_t len); } Index: src/sys/compat/linux/arch/m68k/syscalls.master diff -u src/sys/compat/linux/arch/m68k/syscalls.master:1.73 src/sys/compat/linux/arch/m68k/syscalls.master:1.74 --- src/sys/compat/linux/arch/m68k/syscalls.master:1.73 Fri Nov 18 04:03:50 2011 +++ src/sys/compat/linux/arch/m68k/syscalls.master Wed Sep 19 21:19:14 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.73 2011/11/18 04:03:50 christos Exp $ + $NetBSD: syscalls.master,v 1.74 2012/09/19 21:19:14 pooka Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -498,7 +498,9 @@ 299 UNIMPL fchmodat 300 UNIMPL faccessat 301 UNIMPL pselect6 -302 UNIMPL ppoll +302 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 303 UNIMPL unshare 304 STD { int|linux_sys||set_robust_list( \ struct linux_robust_list_head *head, size_t len); } Index: src/sys/compat/linux/arch/mips/syscalls.master diff -u src/sys/compat/linux/arch/mips/syscalls.master:1.43 src/sys/compat/linux/arch/mips/syscalls.master:1.44 --- src/sys/compat/linux/arch/mips/syscalls.master:1.43 Fri Nov 18 04:03:51 2011 +++ src/sys/compat/linux/arch/mips/syscalls.master Wed Sep 19 21:19:15 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.43 2011/11/18 04:03:51 christos Exp $ + $NetBSD: syscalls.master,v 1.44 2012/09/19 21:19:15 pooka Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -487,7 +487,9 @@ 299 UNIMPL fchmodat 300 UNIMPL faccessat 301 UNIMPL pselect6 -302 UNIMPL ppoll +302 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 303 UNIMPL unshare 304 UNIMPL splice 305 UNIMPL sync_file_range Index: src/sys/compat/linux/arch/powerpc/syscalls.master diff -u src/sys/compat/linux/arch/powerpc/syscalls.master:1.50 src/sys/compat/linux/arch/powerpc/syscalls.master:1.51 --- src/sys/compat/linux/arch/powerpc/syscalls.master:1.50 Fri Nov 18 04:03:51 2011 +++ src/sys/compat/linux/arch/powerpc/syscalls.master Wed Sep 19 21:19:15 2012 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.50 2011/11/18 04:03:51 christos Exp $ + $NetBSD: syscalls.master,v 1.51 2012/09/19 21:19:15 pooka Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -476,7 +476,9 @@ 278 UNIMPL spu_run 279 UNIMPL spu_create 280 UNIMPL pselect6 -281 UNIMPL ppoll +281 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ + struct linux_timespec *timeout, \ + linux_sigset_t *sigset); } 282 UNIMPL unshare 283 UNIMPL splice 284 UNIMPL tee Index: src/sys/compat/linux/common/linux_misc.c diff -u src/sys/compat/linux/common/linux_misc.c:1.219 src/sys/compat/linux/common/linux_misc.c:1.220 --- src/sys/compat/linux/common/linux_misc.c:1.219 Fri Oct 14 09:23:28 2011 +++ src/sys/compat/linux/common/linux_misc.c Wed Sep 19 21:19:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.219 2011/10/14 09:23:28 hannken Exp $ */ +/* $NetBSD: linux_misc.c,v 1.220 2012/09/19 21:19:15 pooka 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.219 2011/10/14 09:23:28 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.220 2012/09/19 21:19:15 pooka Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc.c #include <sys/mbuf.h> #include <sys/mman.h> #include <sys/mount.h> +#include <sys/poll.h> #include <sys/prot.h> #include <sys/reboot.h> #include <sys/resource.h> @@ -119,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc.c #include <compat/linux/common/linux_ptrace.h> #include <compat/linux/common/linux_reboot.h> #include <compat/linux/common/linux_emuldata.h> +#include <compat/linux/common/linux_sched.h> #include <compat/linux/linux_syscallargs.h> @@ -920,6 +922,42 @@ linux_select1(struct lwp *l, register_t return 0; } +int +linux_sys_ppoll(struct lwp *l, + const struct linux_sys_ppoll_args *uap, register_t *retval) +{ + /* { + syscallarg(struct pollfd *) fds; + syscallarg(int) nfds; + syscallarg(struct linux_timespec *) timeout; + syscallarg(linux_sigset_t *) sigset; + } */ + struct linux_timespec lts0, *lts; + struct timespec ts0, *ts = NULL; + linux_sigset_t lsigmask0, *lsigmask; + sigset_t sigmask0, *sigmask = NULL; + int error; + + lts = SCARG(uap, timeout); + if (lts) { + if ((error = copyin(lts, <s0, sizeof(lts0))) != 0) + return error; + linux_to_native_timespec(&ts0, <s0); + ts = &ts0; + } + + lsigmask = SCARG(uap, sigset); + if (lsigmask) { + if ((error = copyin(lsigmask, &lsigmask0, sizeof(lsigmask0)))) + return error; + linux_to_native_sigset(&sigmask0, &lsigmask0); + sigmask = &sigmask0; + } + + return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), + ts, sigmask); +} + /* * Set the 'personality' (emulation mode) for the current process. Only * accept the Linux personality here (0). This call is needed because