Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux PR/50428: Rin Okuyama: support SA_RESTORER ...



details:   https://anonhg.NetBSD.org/src/rev/60b60f619e25
branches:  trunk
changeset: 341630:60b60f619e25
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 14 13:29:35 2015 +0000

description:
PR/50428: Rin Okuyama: support SA_RESTORER flag for rt_sigaction(2) in the
ports that support it.

diffstat:

 sys/compat/linux/arch/alpha/linux_signal.h |   5 ++---
 sys/compat/linux/arch/amd64/linux_signal.h |  10 +++++-----
 sys/compat/linux/arch/mips/linux_signal.h  |   7 +++----
 sys/compat/linux/common/linux_signal.c     |  17 ++++++++---------
 4 files changed, 18 insertions(+), 21 deletions(-)

diffs (141 lines):

diff -r bdd6dc0b15a8 -r 60b60f619e25 sys/compat/linux/arch/alpha/linux_signal.h
--- a/sys/compat/linux/arch/alpha/linux_signal.h        Sat Nov 14 13:28:53 2015 +0000
+++ b/sys/compat/linux/arch/alpha/linux_signal.h        Sat Nov 14 13:29:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.9 2008/04/28 20:23:42 martin Exp $  */
+/*     $NetBSD: linux_signal.h,v 1.10 2015/11/14 13:29:35 christos Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -92,13 +92,12 @@
 #define LINUX_SA_RESETHAND     0x00000010
 #define LINUX_SA_NOCLDWAIT     0x00000020
 #define LINUX_SA_SIGINFO       0x00000040
-#define LINUX_SA_RESTORER      0x04000000
 
 #define LINUX_SA_NOMASK                LINUX_SA_NODEFER
 #define LINUX_SA_ONESHOT       LINUX_SA_RESETHAND
 #define LINUX_SA_INTERRUPT     0x20000000      /* Ignore this */
 
-#define LINUX_SA_ALLBITS       0x2400007f
+#define LINUX_SA_ALLBITS       0x2000007f
 
 #define LINUX_SIG_BLOCK                1
 #define LINUX_SIG_UNBLOCK      2
diff -r bdd6dc0b15a8 -r 60b60f619e25 sys/compat/linux/arch/amd64/linux_signal.h
--- a/sys/compat/linux/arch/amd64/linux_signal.h        Sat Nov 14 13:28:53 2015 +0000
+++ b/sys/compat/linux/arch/amd64/linux_signal.h        Sat Nov 14 13:29:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.h,v 1.4 2005/12/11 12:20:14 christos Exp $ */
+/*     $NetBSD: linux_signal.h,v 1.5 2015/11/14 13:29:35 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -103,24 +103,24 @@
 
 /* struct old_sigaction32 in Linux; uses a 32 bit pointer for handlers */
 struct linux_compat_old_sigaction { 
-       int linux_sa_handler;
+       linux_handler_t linux_sa_handler;
        linux_old_sigset_t linux_sa_mask;
        unsigned int linux_sa_flags;
-       int linux_sa_restorer;
+       void (*linux_sa_restorer)(void);
 };
 
 /* Dummy declaration to avoid errors, unused */
 struct linux_old_sigaction { 
        linux_handler_t linux_sa_handler;
        unsigned long linux_sa_flags;
-       linux_handler_t linux_sa_restorer;
+       void (*linux_sa_restorer)(void);
        linux_sigset_t linux_sa_mask;
 };
 
 struct linux_sigaction {
        linux_handler_t linux_sa_handler;
        unsigned long linux_sa_flags;
-       linux_handler_t linux_sa_restorer;
+       void (*linux_sa_restorer)(void);
        linux_sigset_t linux_sa_mask;
 };
 
diff -r bdd6dc0b15a8 -r 60b60f619e25 sys/compat/linux/arch/mips/linux_signal.h
--- a/sys/compat/linux/arch/mips/linux_signal.h Sat Nov 14 13:28:53 2015 +0000
+++ b/sys/compat/linux/arch/mips/linux_signal.h Sat Nov 14 13:29:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.h,v 1.13 2008/04/28 20:23:43 martin Exp $ */
+/* $NetBSD: linux_signal.h,v 1.14 2015/11/14 13:29:35 christos Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
@@ -104,15 +104,14 @@
 #define LINUX_SA_NOCLDSTOP     0x00000001
 #define LINUX_SA_SIGINFO       0x00000008
 #define LINUX_SA_NOCLDWAIT     0x00010000
-#define LINUX_SA_RESTORER      0x04000000
 #define LINUX_SA_ONSTACK       0x08000000
 #define LINUX_SA_RESTART       0x10000000
-#define LINUX_SA_INTERRUPT     0x20000000
 #define LINUX_SA_NODEFER       0x40000000
 #define LINUX_SA_RESETHAND     0x80000000
 #define LINUX_SA_NOMASK                LINUX_SA_NODEFER
 #define LINUX_SA_ONESHOT       LINUX_SA_RESETHAND
-#define LINUX_SA_ALLBITS       0xfc010009 /* XXX from i386, not in mips. */
+#define LINUX_SA_ALLBITS       0xd8010009
+/* XXX LINUX_SA_RESTORER has been deprecated; not used any version of glibc */
 
 #define        LINUX_MINSIGSTKSZ       2048
 
diff -r bdd6dc0b15a8 -r 60b60f619e25 sys/compat/linux/common/linux_signal.c
--- a/sys/compat/linux/common/linux_signal.c    Sat Nov 14 13:28:53 2015 +0000
+++ b/sys/compat/linux/common/linux_signal.c    Sat Nov 14 13:29:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_signal.c,v 1.76 2014/11/09 17:48:08 maxv Exp $   */
+/*     $NetBSD: linux_signal.c,v 1.77 2015/11/14 13:29:35 christos Exp $       */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.76 2014/11/09 17:48:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.77 2015/11/14 13:29:35 christos Exp $");
 
 #define COMPAT_LINUX 1
 
@@ -331,7 +331,7 @@
        int error, sig;
        void *tramp = NULL;
        int vers = 0;
-#if defined __amd64__
+#ifdef LINUX_SA_RESTORER
        struct sigacts *ps = l->l_proc->p_sigacts;
 #endif
 
@@ -354,11 +354,10 @@
                sigemptyset(&obsa.sa_mask);
                obsa.sa_flags = 0;
        } else {
-#if defined __amd64__
-               if (nlsa.linux_sa_flags & LINUX_SA_RESTORER) {
-                       if ((tramp = nlsa.linux_sa_restorer) != NULL)
-                               vers = 2; /* XXX arch dependent */
-               }
+#ifdef LINUX_SA_RESTORER
+               if ((nlsa.linux_sa_flags & LINUX_SA_RESTORER) &&
+                   (tramp = nlsa.linux_sa_restorer) != NULL)
+                               vers = 2;
 #endif
 
                error = sigaction1(l, linux_to_native_signo[sig],
@@ -371,7 +370,7 @@
        if (SCARG(uap, osa)) {
                native_to_linux_sigaction(&olsa, &obsa);
 
-#if defined __amd64__
+#ifdef LINUX_SA_RESTORER
                if (ps->sa_sigdesc[sig].sd_vers != 0) {
                        olsa.linux_sa_restorer = ps->sa_sigdesc[sig].sd_tramp;
                        olsa.linux_sa_flags |= LINUX_SA_RESTORER;



Home | Main Index | Thread Index | Old Index