Source-Changes-HG archive

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

[src/trunk]: src/sys/compat make signal array handling uniform, and put signa...



details:   https://anonhg.NetBSD.org/src/rev/51b9b25a2aea
branches:  trunk
changeset: 524855:51b9b25a2aea
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 31 22:22:43 2002 +0000

description:
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.

diffstat:

 sys/compat/hpux/files.hpux                     |    3 +-
 sys/compat/hpux/hpux_sig.c                     |   29 +--
 sys/compat/hpux/hpux_signo.c                   |   67 +++++++++
 sys/compat/ibcs2/files.ibcs2                   |    3 +-
 sys/compat/ibcs2/ibcs2_signal.c                |   86 +----------
 sys/compat/ibcs2/ibcs2_signal.h                |    4 +-
 sys/compat/ibcs2/ibcs2_signo.c                 |  108 +++++++++++++++
 sys/compat/irix/files.irix                     |    3 +-
 sys/compat/irix/irix_signal.c                  |   18 +-
 sys/compat/linux/arch/alpha/linux_machdep.c    |    6 +-
 sys/compat/linux/arch/alpha/linux_sigarray.c   |    6 +-
 sys/compat/linux/arch/arm/linux_machdep.c      |    6 +-
 sys/compat/linux/arch/arm/linux_sigarray.c     |    6 +-
 sys/compat/linux/arch/i386/linux_machdep.c     |   18 +-
 sys/compat/linux/arch/i386/linux_sigarray.c    |    6 +-
 sys/compat/linux/arch/m68k/linux_machdep.c     |    8 +-
 sys/compat/linux/arch/m68k/linux_sigarray.c    |    6 +-
 sys/compat/linux/arch/mips/linux_machdep.c     |    6 +-
 sys/compat/linux/arch/mips/linux_sigarray.c    |    6 +-
 sys/compat/linux/arch/powerpc/linux_machdep.c  |    8 +-
 sys/compat/linux/arch/powerpc/linux_sigarray.c |    6 +-
 sys/compat/linux/common/linux_misc.c           |    9 +-
 sys/compat/linux/common/linux_sched.c          |    6 +-
 sys/compat/linux/common/linux_sig_notalpha.c   |    6 +-
 sys/compat/linux/common/linux_sigaction.c      |    8 +-
 sys/compat/linux/common/linux_signal.c         |   90 +-----------
 sys/compat/linux/common/linux_signal.h         |    6 +-
 sys/compat/linux/common/linux_signo.c          |  121 ++++++++++++++++
 sys/compat/linux/files.linux                   |    3 +-
 sys/compat/osf1/files.osf1                     |    6 +-
 sys/compat/osf1/osf1_cvt.c                     |    8 +-
 sys/compat/osf1/osf1_cvt.h                     |    9 +-
 sys/compat/osf1/osf1_cvt_errno.c               |  132 ------------------
 sys/compat/osf1/osf1_cvt_signal.c              |  114 ---------------
 sys/compat/osf1/osf1_errno.c                   |  132 ++++++++++++++++++
 sys/compat/osf1/osf1_exec.c                    |    6 +-
 sys/compat/osf1/osf1_signo.c                   |  117 ++++++++++++++++
 sys/compat/svr4/files.svr4                     |    3 +-
 sys/compat/svr4/svr4_misc.c                    |   12 +-
 sys/compat/svr4/svr4_signal.c                  |  151 +-------------------
 sys/compat/svr4/svr4_signal.h                  |    6 +-
 sys/compat/svr4/svr4_signo.c                   |  180 +++++++++++++++++++++++++
 sys/compat/svr4_32/svr4_32_misc.c              |   12 +-
 sys/compat/svr4_32/svr4_32_signal.c            |   20 +-
 44 files changed, 884 insertions(+), 682 deletions(-)

diffs (truncated from 2577 to 300 lines):

diff -r b6fdffbfa217 -r 51b9b25a2aea sys/compat/hpux/files.hpux
--- a/sys/compat/hpux/files.hpux        Sun Mar 31 22:21:02 2002 +0000
+++ b/sys/compat/hpux/files.hpux        Sun Mar 31 22:22:43 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hpux,v 1.7 2000/12/01 19:15:12 jdolecek Exp $
+#      $NetBSD: files.hpux,v 1.8 2002/03/31 22:22:43 christos Exp $
 #
 # Config file description for machine-independent HPUX compat code.
 # Included by ports that need it.
@@ -14,6 +14,7 @@
 file   compat/hpux/hpux_ipc.c          compat_hpux
 file   compat/hpux/hpux_net.c          compat_hpux
 file   compat/hpux/hpux_sig.c          compat_hpux
+file   compat/hpux/hpux_signo.c        compat_hpux
 file   compat/hpux/hpux_syscalls.c     compat_hpux
 file   compat/hpux/hpux_sysent.c       compat_hpux
 file   compat/hpux/hpux_tty.c          compat_hpux
diff -r b6fdffbfa217 -r 51b9b25a2aea sys/compat/hpux/hpux_sig.c
--- a/sys/compat/hpux/hpux_sig.c        Sun Mar 31 22:21:02 2002 +0000
+++ b/sys/compat/hpux/hpux_sig.c        Sun Mar 31 22:22:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpux_sig.c,v 1.21 2001/11/13 02:08:15 lukem Exp $      */
+/*     $NetBSD: hpux_sig.c,v 1.22 2002/03/31 22:22:43 christos Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_sig.c,v 1.21 2001/11/13 02:08:15 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_sig.c,v 1.22 2002/03/31 22:22:43 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,21 +61,8 @@
 #include <compat/hpux/hpux_sig.h>
 #include <compat/hpux/hpux_syscallargs.h>
 
-/* indexed by HPUX signal number - 1 */
-char hpuxtobsdsigmap[NSIG] = {
-/*01*/ SIGHUP,  SIGINT, SIGQUIT, SIGILL,   SIGTRAP, SIGIOT,  SIGEMT,   SIGFPE,
-/*09*/  SIGKILL, SIGBUS, SIGSEGV, SIGSYS,   SIGPIPE, SIGALRM, SIGTERM,  SIGUSR1,
-/*17*/  SIGUSR2, SIGCHLD, 0,      SIGVTALRM,SIGPROF, SIGIO,   SIGWINCH, SIGSTOP,
-/*25*/ SIGTSTP, SIGCONT,SIGTTIN, SIGTTOU,  SIGURG,  0,       0,        0
-};
-
-/* indexed by BSD signal number - 1 */
-char bsdtohpuxsigmap[NSIG] = {
-/*01*/  1,  2,  3,  4,  5,  6,  7,  8,
-/*09*/   9, 10, 11, 12, 13, 14, 15, 29,
-/*17*/  24, 25, 26, 18, 27, 28, 22,  0,
-/*25*/  0, 20, 21, 23,  0, 16, 17,  0
-};
+extern const unsigned char native_to_hpux_signo[];
+extern const unsigned char hpux_to_native_signo[];
 
 /*
  * XXX: In addition to mapping the signal number we also have
@@ -406,9 +393,9 @@
 hpuxtobsdsig(sig)
        int sig;
 {
-       if (--sig < 0 || sig >= NSIG)
+       if (sig < 0 || sig >= NSIG)
                return(0);
-       return((int)hpuxtobsdsigmap[sig]);
+       return hpux_to_native_signo[sig];
 }
 
 /* signal numbers: convert from BSD to HPUX */
@@ -416,9 +403,9 @@
 bsdtohpuxsig(sig)
        int sig;
 {
-       if (--sig < 0 || sig >= NSIG)
+       if (sig < 0 || sig >= NSIG)
                return(0);
-       return((int)bsdtohpuxsigmap[sig]);
+       return native_to_hpux_signo[sig];
 }
 
 /* signal masks: convert from HPUX to BSD (not pretty or fast) */
diff -r b6fdffbfa217 -r 51b9b25a2aea sys/compat/hpux/hpux_signo.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/hpux/hpux_signo.c      Sun Mar 31 22:22:43 2002 +0000
@@ -0,0 +1,67 @@
+/*     $NetBSD: hpux_signo.c,v 1.1 2002/03/31 22:22:43 christos Exp $  */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: Utah $Hdr: hpux_sig.c 1.4 92/01/20$
+ *
+ *     @(#)hpux_sig.c  8.2 (Berkeley) 9/23/93
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: hpux_signo.c,v 1.1 2002/03/31 22:22:43 christos Exp $");
+
+#include <sys/types.h>
+#include <sys/signal.h>
+
+
+/* indexed by HPUX signal number */
+const int hpux_to_native_signo[NSIG] = {
+       0,
+/*01*/ SIGHUP,  SIGINT, SIGQUIT, SIGILL,   SIGTRAP, SIGIOT,  SIGEMT,   SIGFPE,
+/*09*/  SIGKILL, SIGBUS, SIGSEGV, SIGSYS,   SIGPIPE, SIGALRM, SIGTERM,  SIGUSR1,
+/*17*/  SIGUSR2, SIGCHLD, 0,      SIGVTALRM,SIGPROF, SIGIO,   SIGWINCH, SIGSTOP,
+/*25*/ SIGTSTP, SIGCONT,SIGTTIN, SIGTTOU,  SIGURG,  0,       0,        0
+};
+
+/* indexed by BSD signal number */
+const int native_to_hpux_signo[NSIG] = {
+        0,
+/*01*/  1,  2,  3,  4,  5,  6,  7,  8,
+/*09*/   9, 10, 11, 12, 13, 14, 15, 29,
+/*17*/  24, 25, 26, 18, 27, 28, 22,  0,
+/*25*/  0, 20, 21, 23,  0, 16, 17,  0
+};
diff -r b6fdffbfa217 -r 51b9b25a2aea sys/compat/ibcs2/files.ibcs2
--- a/sys/compat/ibcs2/files.ibcs2      Sun Mar 31 22:21:02 2002 +0000
+++ b/sys/compat/ibcs2/files.ibcs2      Sun Mar 31 22:22:43 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.ibcs2,v 1.7 2000/12/01 19:17:41 jdolecek Exp $
+#      $NetBSD: files.ibcs2,v 1.8 2002/03/31 22:22:44 christos Exp $
 #
 # Config file description for machine-independent IBCS-2 compat code.
 # Included by ports that need it.
@@ -16,6 +16,7 @@
 file   compat/ibcs2/ibcs2_ipc.c        compat_ibcs2
 file   compat/ibcs2/ibcs2_misc.c       compat_ibcs2
 file   compat/ibcs2/ibcs2_signal.c     compat_ibcs2
+file   compat/ibcs2/ibcs2_signo.c      compat_ibcs2
 file   compat/ibcs2/ibcs2_socksys.c    compat_ibcs2
 file   compat/ibcs2/ibcs2_stat.c       compat_ibcs2
 file   compat/ibcs2/ibcs2_syscalls.c   compat_ibcs2
diff -r b6fdffbfa217 -r 51b9b25a2aea sys/compat/ibcs2/ibcs2_signal.c
--- a/sys/compat/ibcs2/ibcs2_signal.c   Sun Mar 31 22:21:02 2002 +0000
+++ b/sys/compat/ibcs2/ibcs2_signal.c   Sun Mar 31 22:22:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_signal.c,v 1.14 2001/11/13 02:08:27 lukem Exp $  */
+/*     $NetBSD: ibcs2_signal.c,v 1.15 2002/03/31 22:22:44 christos Exp $       */
 
 /*
  * Copyright (c) 1995 Scott Bartram
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.14 2001/11/13 02:08:27 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.15 2002/03/31 22:22:44 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,76 +54,8 @@
 #define ibcs2_sigismember(s, n)        (*(s) & ibcs2_sigmask(n))
 #define ibcs2_sigaddset(s, n)  (*(s) |= ibcs2_sigmask(n))
 
-int const native_to_ibcs2_sig[NSIG] = {
-       0,                      /* 0 */
-       IBCS2_SIGHUP,           /* 1 */
-       IBCS2_SIGINT,           /* 2 */
-       IBCS2_SIGQUIT,          /* 3 */
-       IBCS2_SIGILL,           /* 4 */
-       IBCS2_SIGTRAP,          /* 5 */
-       IBCS2_SIGABRT,          /* 6 */
-       IBCS2_SIGEMT,           /* 7 */
-       IBCS2_SIGFPE,           /* 8 */
-       IBCS2_SIGKILL,          /* 9 */
-       IBCS2_SIGBUS,           /* 10 */
-       IBCS2_SIGSEGV,          /* 11 */
-       IBCS2_SIGSYS,           /* 12 */
-       IBCS2_SIGPIPE,          /* 13 */
-       IBCS2_SIGALRM,          /* 14 */
-       IBCS2_SIGTERM,          /* 15 */
-       0,                      /* 16 - SIGURG */
-       IBCS2_SIGSTOP,          /* 17 */
-       IBCS2_SIGTSTP,          /* 18 */
-       IBCS2_SIGCONT,          /* 19 */
-       IBCS2_SIGCLD,           /* 20 */
-       IBCS2_SIGTTIN,          /* 21 */
-       IBCS2_SIGTTOU,          /* 22 */
-       IBCS2_SIGPOLL,          /* 23 */
-       IBCS2_SIGXCPU,          /* 24 */
-       IBCS2_SIGXFSZ,          /* 25 */
-       IBCS2_SIGVTALRM,        /* 26 */
-       IBCS2_SIGPROF,          /* 27 */
-       IBCS2_SIGWINCH,         /* 28 */
-       0,                      /* 29 - SIGINFO */
-       IBCS2_SIGUSR1,          /* 30 */
-       IBCS2_SIGUSR2,          /* 31 */
-       IBCS2_SIGPWR,           /* 32 */
-};
-
-int const ibcs2_to_native_sig[IBCS2_NSIG] = {
-       0,                      /* 0 */
-       SIGHUP,                 /* 1 */
-       SIGINT,                 /* 2 */
-       SIGQUIT,                /* 3 */
-       SIGILL,                 /* 4 */
-       SIGTRAP,                /* 5 */
-       SIGABRT,                /* 6 */
-       SIGEMT,                 /* 7 */
-       SIGFPE,                 /* 8 */
-       SIGKILL,                /* 9 */
-       SIGBUS,                 /* 10 */
-       SIGSEGV,                /* 11 */
-       SIGSYS,                 /* 12 */
-       SIGPIPE,                /* 13 */
-       SIGALRM,                /* 14 */
-       SIGTERM,                /* 15 */
-       SIGUSR1,                /* 16 */
-       SIGUSR2,                /* 17 */
-       SIGCHLD,                /* 18 */
-       SIGPWR,                 /* 19 */
-       SIGWINCH,               /* 20 */
-       0,                      /* 21 - SIGPHONE */
-       SIGIO,                  /* 22 */
-       SIGSTOP,                /* 23 */
-       SIGTSTP,                /* 24 */
-       SIGCONT,                /* 25 */
-       SIGTTIN,                /* 26 */
-       SIGTTOU,                /* 27 */
-       SIGVTALRM,              /* 28 */
-       SIGPROF,                /* 29 */
-       SIGXCPU,                /* 30 */
-       SIGXFSZ,                /* 31 */
-};
+extern const int native_to_ibcs2_signo[];
+extern const int ibcs2_to_native_signo[];
 
 void ibcs2_to_native_sigaction __P((const struct ibcs2_sigaction *, struct sigaction *));
 void native_to_ibcs2_sigaction __P((const struct sigaction *, struct ibcs2_sigaction *));
@@ -140,7 +72,7 @@
        sigemptyset(bss);
        for (i = 1; i < IBCS2_NSIG; i++) {
                if (ibcs2_sigismember(iss, i)) {
-                       newsig = ibcs2_to_native_sig[i];
+                       newsig = ibcs2_to_native_signo[i];
                        if (newsig)
                                sigaddset(bss, newsig);
                }
@@ -157,7 +89,7 @@
        ibcs2_sigemptyset(iss);
        for (i = 1; i < NSIG; i++) {
                if (sigismember(bss, i)) {
-                       newsig = native_to_ibcs2_sig[i];
+                       newsig = native_to_ibcs2_signo[i];
                        if (newsig)
                                ibcs2_sigaddset(iss, newsig);
                }
@@ -265,7 +197,7 @@
                        return (error);
                ibcs2_to_native_sigaction(&nisa, &nbsa);
        }
-       error = sigaction1(p, ibcs2_to_native_sig[SCARG(uap, signum)],
+       error = sigaction1(p, ibcs2_to_native_signo[SCARG(uap, signum)],
            SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0);
        if (error)
                return (error);
@@ -321,7 +253,7 @@
                syscallarg(int) sig;
                syscallarg(ibcs2_sig_t) fp;
        } */ *uap = v;
-       int signum = ibcs2_to_native_sig[IBCS2_SIGNO(SCARG(uap, sig))];



Home | Main Index | Thread Index | Old Index