Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux32 add sigtimedwait support



details:   https://anonhg.NetBSD.org/src/rev/fca6e72ab3e6
branches:  trunk
changeset: 771279:fca6e72ab3e6
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 18 04:08:56 2011 +0000

description:
add sigtimedwait support

diffstat:

 sys/compat/linux32/arch/amd64/linux32_siginfo.h     |   91 ++++++++++
 sys/compat/linux32/arch/amd64/linux32_signal.h      |  133 +---------------
 sys/compat/linux32/arch/amd64/linux32_syscall.h     |    5 +-
 sys/compat/linux32/arch/amd64/linux32_syscallargs.h |   11 +-
 sys/compat/linux32/arch/amd64/linux32_syscalls.c    |    6 +-
 sys/compat/linux32/arch/amd64/linux32_sysent.c      |    8 +-
 sys/compat/linux32/arch/amd64/syscalls.master       |    7 +-
 sys/compat/linux32/common/linux32_misc.c            |    5 +-
 sys/compat/linux32/common/linux32_sched.h           |   88 ++++++++++
 sys/compat/linux32/common/linux32_siginfo.h         |  118 +++++++++++++
 sys/compat/linux32/common/linux32_signal.c          |  172 +++++++++++++++++++-
 sys/compat/linux32/common/linux32_signal.h          |    5 +-
 sys/compat/linux32/common/linux32_time.c            |    5 +-
 sys/compat/linux32/common/linux32_types.h           |    7 +-
 14 files changed, 505 insertions(+), 156 deletions(-)

diffs (truncated from 899 to 300 lines):

diff -r fcbe525aa190 -r fca6e72ab3e6 sys/compat/linux32/arch/amd64/linux32_siginfo.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/linux32/arch/amd64/linux32_siginfo.h   Fri Nov 18 04:08:56 2011 +0000
@@ -0,0 +1,91 @@
+/*     $NetBSD: linux32_siginfo.h,v 1.1 2011/11/18 04:08:56 christos Exp $     */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Eric Haszlakiewicz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AMD64_LINUX32_SIGINFO_H
+#define _AMD64_LINUX32_SIGINFO_H
+
+typedef union linux32_sigval {
+       int     sival_int;
+       netbsd32_voidp  sival_ptr;
+} linux32_sigval_t;
+
+#define SI_MAX_SIZE    128
+#define SI_PAD_SIZE    ((SI_MAX_SIZE/sizeof(int)) - 3)
+
+typedef struct linux32_siginfo {
+       int     lsi_signo;
+       int     lsi_errno;
+       int     lsi_code;
+       union {
+               int _pad[SI_PAD_SIZE];
+
+               /* kill() */
+               struct {
+                       linux32_pid_t   _pid;
+                       linux32_uid_t   _uid;
+               } _kill;
+
+               /* POSIX.1b signals */
+               struct {
+                       linux32_pid_t   _pid;
+                       linux32_uid_t   _uid;
+                       linux32_sigval_t        _sigval;
+               } _rt;
+
+               /* POSIX.1b timers */
+               struct {
+                       unsigned int    _timer1;
+                       unsigned int    _timer2;
+               } _timer;
+
+               /* SIGCHLD */
+               struct {
+                       linux32_pid_t   _pid;
+                       linux32_uid_t   _uid;
+                       int             _status;
+                       linux32_clock_t _utime;
+                       linux32_clock_t _stime;
+               } _sigchld;
+
+               /* SIGPOLL */
+               struct {
+                       int _band;
+                       int _fd;
+               } _sigpoll;
+
+               /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+               struct {
+                       netbsd32_voidp _addr;
+               } _sigfault;
+       } _sidata;
+} linux32_siginfo_t;
+
+#endif /* !_AMD64_LINUX32_SIGINFO_H */
diff -r fcbe525aa190 -r fca6e72ab3e6 sys/compat/linux32/arch/amd64/linux32_signal.h
--- a/sys/compat/linux32/arch/amd64/linux32_signal.h    Fri Nov 18 04:07:43 2011 +0000
+++ b/sys/compat/linux32/arch/amd64/linux32_signal.h    Fri Nov 18 04:08:56 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_signal.h,v 1.2 2009/06/08 14:42:10 njoly Exp $ */
+/*     $NetBSD: linux32_signal.h,v 1.3 2011/11/18 04:08:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -91,137 +91,6 @@
        linux32_sigset_t        linux_sa_mask;
 };
 
-typedef union linux32_sigval {
-       int     sival_int;
-       netbsd32_voidp  sival_ptr;
-} linux32_sigval_t;
-
-#define SI_MAX_SIZE    128
-#define SI_PAD_SIZE    ((SI_MAX_SIZE/sizeof(int)) - 3)
-
-typedef struct linux32_siginfo {
-       int     lsi_signo;
-       int     lsi_errno;
-       int     lsi_code;
-       union {
-               int _pad[SI_PAD_SIZE];
-
-               /* kill() */
-               struct {
-                       linux32_pid_t   _pid;
-                       linux32_uid_t   _uid;
-               } _kill;
-
-               /* POSIX.1b signals */
-               struct {
-                       linux32_pid_t   _pid;
-                       linux32_uid_t   _uid;
-                       linux32_sigval_t        _sigval;
-               } _rt;
-
-               /* POSIX.1b timers */
-               struct {
-                       unsigned int    _timer1;
-                       unsigned int    _timer2;
-               } _timer;
-
-               /* SIGCHLD */
-               struct {
-                       linux32_pid_t   _pid;
-                       linux32_uid_t   _uid;
-                       int             _status;
-                       linux32_clock_t _utime;
-                       linux32_clock_t _stime;
-               } _sigchld;
-
-               /* SIGPOLL */
-               struct {
-                       int _band;
-                       int _fd;
-               } _sigpoll;
-
-               /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-               struct {
-                       netbsd32_voidp _addr;
-               } _sigfault;
-       } _sidata;
-} linux32_siginfo_t;
-
-#define lsi_pid                _sidata._kill._pid
-#define lsi_uid                _sidata._kill._uid
-#define lsi_status      _sidata._sigchld._status
-#define lsi_utime       _sidata._sigchld._utime
-#define lsi_stime       _sidata._sigchld._stime
-#define lsi_value       _sidata._rt._sigval
-#define lsi_int         _sidata._rt._sigval.sival_int
-#define lsi_ptr         _sidata._rt._sigval.sival_ptr
-#define lsi_addr        _sidata._sigfault._addr
-#define lsi_band        _sidata._sigpoll._band
-#define lsi_fd          _sidata._sigpoll._fd
-
-/*
- * si_code values for non-signals
- */
-#define LINUX32_SI_USER                0
-#define        LINUX32_SI_KERNEL               0x80
-#define LINUX32_SI_QUEUE               -1
-#define LINUX32_SI_TIMER               -2
-#define LINUX32_SI_MESGQ               -3
-#define LINUX32_SI_ASYNCIO     -4
-#define LINUX32_SI_SIGIO               -5
-#define LINUX32_SI_SIGNL               -6
-
-/* si_code values for SIGILL */
-#define        LINUX32_ILL_ILLOPC      1
-#define        LINUX32_ILL_ILLOPN      2
-#define        LINUX32_ILL_ILLADR      3
-#define        LINUX32_ILL_ILLTRP      4
-#define        LINUX32_ILL_PRVOPC      5
-#define        LINUX32_ILL_PRVREG      6
-#define        LINUX32_ILL_COPROC      7
-#define        LINUX32_ILL_BADSTK      8
-
-/* si_code values for SIGFPE */
-#define        LINUX32_FPE_INTDIV      1
-#define        LINUX32_FPE_INTOVF      2
-#define        LINUX32_FPE_FLTDIV      3
-#define        LINUX32_FPE_FLTOVF      4
-#define        LINUX32_FPE_FLTUND      5
-#define        LINUX32_FPE_FLTRES      6
-#define        LINUX32_FPE_FLTINV      7
-#define        LINUX32_FPE_FLTSUB      8
-
-/* si_code values for SIGSEGV */
-#define        LINUX32_SEGV_MAPERR     1
-#define        LINUX32_SEGV_ACCERR     2
-
-/* si_code values for SIGBUS */
-#define        LINUX32_BUS_ADRALN      1
-#define        LINUX32_BUS_ADRERR      2
-#define        LINUX32_BUS_OBJERR      3
-
-/* si_code values for SIGTRAP */
-#define        LINUX32_TRAP_BRKPT      1
-#define        LINUX32_TRAP_TRACE      2
-
-/* si_code values for SIGCHLD */
-#define        LINUX32_CLD_EXITED      1
-#define        LINUX32_CLD_KILLED      2
-#define        LINUX32_CLD_DUMPED      3
-#define        LINUX32_CLD_TRAPPED     4
-#define        LINUX32_CLD_STOPPED     5
-#define        LINUX32_CLD_CONTINUED   6
-
-/* si_code values for SIGPOLL */
-#define        LINUX32_POLL_IN         1
-#define        LINUX32_POLL_OUT                2
-#define        LINUX32_POLL_MSG                3
-#define        LINUX32_POLL_ERR                4
-#define        LINUX32_POLL_PRI                5
-#define        LINUX32_POLL_HUP                6
-
-#define LINUX32_SI_FROMUSER(sp)        ((sp)->si_code <= 0)
-#define LINUX32_SI_FROMKERNEL(sp)      ((sp)->si_code > 0)
 
 struct linux32_sigaltstack { 
         netbsd32_voidp ss_sp;
diff -r fcbe525aa190 -r fca6e72ab3e6 sys/compat/linux32/arch/amd64/linux32_syscall.h
--- a/sys/compat/linux32/arch/amd64/linux32_syscall.h   Fri Nov 18 04:07:43 2011 +0000
+++ b/sys/compat/linux32/arch/amd64/linux32_syscall.h   Fri Nov 18 04:08:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_syscall.h,v 1.63 2011/05/30 21:37:40 alnsn Exp $ */
+/* $NetBSD: linux32_syscall.h,v 1.64 2011/11/18 04:08:56 christos Exp $ */
 
 /*
  * System call numbers.
@@ -445,6 +445,9 @@
 /* syscall: "rt_sigpending" ret: "int" args: "linux32_sigsetp_t" "netbsd32_size_t" */
 #define        LINUX32_SYS_rt_sigpending       176
 
+/* syscall: "rt_sigtimedwait" ret: "int" args: "const linux32_sigset_t *" "linux32_siginfo_t *" "const struct linux_timespec32 *" */
+#define        LINUX32_SYS_rt_sigtimedwait     177
+
 /* syscall: "rt_queueinfo" ret: "int" args: "int" "int" "linux32_siginfop_t" */
 #define        LINUX32_SYS_rt_queueinfo        178
 
diff -r fcbe525aa190 -r fca6e72ab3e6 sys/compat/linux32/arch/amd64/linux32_syscallargs.h
--- a/sys/compat/linux32/arch/amd64/linux32_syscallargs.h       Fri Nov 18 04:07:43 2011 +0000
+++ b/sys/compat/linux32/arch/amd64/linux32_syscallargs.h       Fri Nov 18 04:08:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_syscallargs.h,v 1.63 2011/05/30 21:37:40 alnsn Exp $ */
+/* $NetBSD: linux32_syscallargs.h,v 1.64 2011/11/18 04:08:56 christos Exp $ */
 
 /*
  * System call argument lists.
@@ -604,6 +604,13 @@
 };
 check_syscall_args(linux32_sys_rt_sigpending)
 
+struct linux32_sys_rt_sigtimedwait_args {
+       syscallarg(const linux32_sigset_t *) set;
+       syscallarg(linux32_siginfo_t *) info;
+       syscallarg(const struct linux_timespec32 *) timeout;
+};
+check_syscall_args(linux32_sys_rt_sigtimedwait)
+
 struct linux32_sys_rt_queueinfo_args {
        syscallarg(int) pid;
        syscallarg(int) sig;
@@ -1189,6 +1196,8 @@
 
 int    linux32_sys_rt_sigpending(struct lwp *, const struct linux32_sys_rt_sigpending_args *, register_t *);
 
+int    linux32_sys_rt_sigtimedwait(struct lwp *, const struct linux32_sys_rt_sigtimedwait_args *, register_t *);
+
 int    linux32_sys_rt_queueinfo(struct lwp *, const struct linux32_sys_rt_queueinfo_args *, register_t *);
 
 int    linux32_sys_rt_sigsuspend(struct lwp *, const struct linux32_sys_rt_sigsuspend_args *, register_t *);
diff -r fcbe525aa190 -r fca6e72ab3e6 sys/compat/linux32/arch/amd64/linux32_syscalls.c
--- a/sys/compat/linux32/arch/amd64/linux32_syscalls.c  Fri Nov 18 04:07:43 2011 +0000
+++ b/sys/compat/linux32/arch/amd64/linux32_syscalls.c  Fri Nov 18 04:08:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_syscalls.c,v 1.63 2011/05/30 21:37:40 alnsn Exp $ */
+/* $NetBSD: linux32_syscalls.c,v 1.64 2011/11/18 04:08:56 christos Exp $ */
 



Home | Main Index | Thread Index | Old Index