Module Name:    src
Committed By:   christos
Date:           Sat Nov 14 13:29:35 UTC 2015

Modified Files:
        src/sys/compat/linux/arch/alpha: linux_signal.h
        src/sys/compat/linux/arch/amd64: linux_signal.h
        src/sys/compat/linux/arch/mips: linux_signal.h
        src/sys/compat/linux/common: linux_signal.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/linux/arch/alpha/linux_signal.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/arch/amd64/linux_signal.h
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux/arch/mips/linux_signal.h
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/linux/common/linux_signal.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/linux_signal.h
diff -u src/sys/compat/linux/arch/alpha/linux_signal.h:1.9 src/sys/compat/linux/arch/alpha/linux_signal.h:1.10
--- src/sys/compat/linux/arch/alpha/linux_signal.h:1.9	Mon Apr 28 16:23:42 2008
+++ src/sys/compat/linux/arch/alpha/linux_signal.h	Sat Nov 14 08:29:35 2015
@@ -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

Index: src/sys/compat/linux/arch/amd64/linux_signal.h
diff -u src/sys/compat/linux/arch/amd64/linux_signal.h:1.4 src/sys/compat/linux/arch/amd64/linux_signal.h:1.5
--- src/sys/compat/linux/arch/amd64/linux_signal.h:1.4	Sun Dec 11 07:20:14 2005
+++ src/sys/compat/linux/arch/amd64/linux_signal.h	Sat Nov 14 08:29:35 2015
@@ -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 @@ typedef void (*linux_handler_t)(int);
 
 /* 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;
 };
 

Index: src/sys/compat/linux/arch/mips/linux_signal.h
diff -u src/sys/compat/linux/arch/mips/linux_signal.h:1.13 src/sys/compat/linux/arch/mips/linux_signal.h:1.14
--- src/sys/compat/linux/arch/mips/linux_signal.h:1.13	Mon Apr 28 16:23:43 2008
+++ src/sys/compat/linux/arch/mips/linux_signal.h	Sat Nov 14 08:29:35 2015
@@ -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 @@ struct linux_pt_regs {
 #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
 

Index: src/sys/compat/linux/common/linux_signal.c
diff -u src/sys/compat/linux/common/linux_signal.c:1.76 src/sys/compat/linux/common/linux_signal.c:1.77
--- src/sys/compat/linux/common/linux_signal.c:1.76	Sun Nov  9 12:48:08 2014
+++ src/sys/compat/linux/common/linux_signal.c	Sat Nov 14 08:29:35 2015
@@ -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 @@ linux_sys_rt_sigaction(struct lwp *l, co
 	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 @@ linux_sys_rt_sigaction(struct lwp *l, co
 		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 @@ linux_sys_rt_sigaction(struct lwp *l, co
 	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;

Reply via email to