xref: /netbsd-src/sys/compat/linux/common/linux_signo.c (revision abbc8a65e23054d25cf7067e2df63d999881954c)
1*abbc8a65Sryo /*	$NetBSD: linux_signo.c,v 1.7 2021/09/23 06:56:27 ryo Exp $	*/
2ac29fb37Schristos /*-
3ac29fb37Schristos  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
4ac29fb37Schristos  * All rights reserved.
5ac29fb37Schristos  *
6ac29fb37Schristos  * This code is derived from software contributed to The NetBSD Foundation
7ac29fb37Schristos  * by Frank van der Linden and Eric Haszlakiewicz.
8ac29fb37Schristos  *
9ac29fb37Schristos  * Redistribution and use in source and binary forms, with or without
10ac29fb37Schristos  * modification, are permitted provided that the following conditions
11ac29fb37Schristos  * are met:
12ac29fb37Schristos  * 1. Redistributions of source code must retain the above copyright
13ac29fb37Schristos  *    notice, this list of conditions and the following disclaimer.
14ac29fb37Schristos  * 2. Redistributions in binary form must reproduce the above copyright
15ac29fb37Schristos  *    notice, this list of conditions and the following disclaimer in the
16ac29fb37Schristos  *    documentation and/or other materials provided with the distribution.
17ac29fb37Schristos  *
18ac29fb37Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19ac29fb37Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20ac29fb37Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21ac29fb37Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22ac29fb37Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23ac29fb37Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24ac29fb37Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25ac29fb37Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26ac29fb37Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ac29fb37Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28ac29fb37Schristos  * POSSIBILITY OF SUCH DAMAGE.
29ac29fb37Schristos  */
30ac29fb37Schristos 
31ac29fb37Schristos #include <sys/cdefs.h>
32*abbc8a65Sryo __KERNEL_RCSID(0, "$NetBSD: linux_signo.c,v 1.7 2021/09/23 06:56:27 ryo Exp $");
33ac29fb37Schristos 
34ac29fb37Schristos #include <sys/types.h>
35ac29fb37Schristos #include <sys/signal.h>
36ac29fb37Schristos 
37ac29fb37Schristos #include <compat/linux/common/linux_types.h>
38ac29fb37Schristos #include <compat/linux/common/linux_signal.h>
39ac29fb37Schristos 
40ac29fb37Schristos #ifndef LINUX_SIGINFO
41ac29fb37Schristos #define LINUX_SIGINFO	0
42ac29fb37Schristos #endif
43ac29fb37Schristos 
44ac29fb37Schristos #ifndef LINUX_SIGEMT
45ac29fb37Schristos #define LINUX_SIGEMT	0
46ac29fb37Schristos #endif
47ac29fb37Schristos 
48ac29fb37Schristos /* Note: linux_to_native_signo[] is in <arch>/linux_sigarray.c */
49cb483bd2Schristos #ifdef LINUX_SIGHUP
50ac29fb37Schristos const int native_to_linux_signo[] = {
51ac29fb37Schristos 	0,			/* 0 */
52ac29fb37Schristos 	LINUX_SIGHUP,		/* 1 */
53ac29fb37Schristos 	LINUX_SIGINT,		/* 2 */
54ac29fb37Schristos 	LINUX_SIGQUIT,		/* 3 */
55ac29fb37Schristos 	LINUX_SIGILL,		/* 4 */
56ac29fb37Schristos 	LINUX_SIGTRAP,		/* 5 */
57ac29fb37Schristos 	LINUX_SIGABRT,		/* 6 */
58ac29fb37Schristos 	LINUX_SIGEMT,		/* 7 */
59ac29fb37Schristos 	LINUX_SIGFPE,		/* 8 */
60ac29fb37Schristos 	LINUX_SIGKILL,		/* 9 */
61ac29fb37Schristos 	LINUX_SIGBUS,		/* 10 */
62ac29fb37Schristos 	LINUX_SIGSEGV,		/* 11 */
63ac29fb37Schristos 	LINUX_SIGSYS,		/* 12 */
64ac29fb37Schristos 	LINUX_SIGPIPE,		/* 13 */
65ac29fb37Schristos 	LINUX_SIGALRM,		/* 14 */
66ac29fb37Schristos 	LINUX_SIGTERM,		/* 15 */
67ac29fb37Schristos 	LINUX_SIGURG,		/* 16 */
68ac29fb37Schristos 	LINUX_SIGSTOP,		/* 17 */
69ac29fb37Schristos 	LINUX_SIGTSTP,		/* 18 */
70ac29fb37Schristos 	LINUX_SIGCONT,		/* 19 */
71ac29fb37Schristos 	LINUX_SIGCHLD,		/* 20 */
72ac29fb37Schristos 	LINUX_SIGTTIN,		/* 21 */
73ac29fb37Schristos 	LINUX_SIGTTOU,		/* 22 */
74ac29fb37Schristos 	LINUX_SIGIO,		/* 23 */
75ac29fb37Schristos 	LINUX_SIGXCPU,		/* 24 */
76ac29fb37Schristos 	LINUX_SIGXFSZ,		/* 25 */
77ac29fb37Schristos 	LINUX_SIGVTALRM,	/* 26 */
78ac29fb37Schristos 	LINUX_SIGPROF,		/* 27 */
79ac29fb37Schristos 	LINUX_SIGWINCH,		/* 28 */
80ac29fb37Schristos 	LINUX_SIGINFO,		/* 29 */
81ac29fb37Schristos 	LINUX_SIGUSR1,		/* 30 */
82ac29fb37Schristos 	LINUX_SIGUSR2,		/* 31 */
83ac29fb37Schristos 	LINUX_SIGPWR,		/* 32 */
84ac29fb37Schristos 	LINUX_SIGRTMIN + 0,	/* 33 */
85ac29fb37Schristos 	LINUX_SIGRTMIN + 1,	/* 34 */
86ac29fb37Schristos 	LINUX_SIGRTMIN + 2,	/* 35 */
87ac29fb37Schristos 	LINUX_SIGRTMIN + 3,	/* 36 */
88ac29fb37Schristos 	LINUX_SIGRTMIN + 4,	/* 37 */
89ac29fb37Schristos 	LINUX_SIGRTMIN + 5,	/* 38 */
90ac29fb37Schristos 	LINUX_SIGRTMIN + 6,	/* 39 */
91ac29fb37Schristos 	LINUX_SIGRTMIN + 7,	/* 40 */
92ac29fb37Schristos 	LINUX_SIGRTMIN + 8,	/* 41 */
93ac29fb37Schristos 	LINUX_SIGRTMIN + 9,	/* 42 */
94ac29fb37Schristos 	LINUX_SIGRTMIN + 10,	/* 43 */
95ac29fb37Schristos 	LINUX_SIGRTMIN + 11,	/* 44 */
96ac29fb37Schristos 	LINUX_SIGRTMIN + 12,	/* 45 */
97ac29fb37Schristos 	LINUX_SIGRTMIN + 13,	/* 46 */
98ac29fb37Schristos 	LINUX_SIGRTMIN + 14,	/* 47 */
99ac29fb37Schristos 	LINUX_SIGRTMIN + 15,	/* 48 */
100ac29fb37Schristos 	LINUX_SIGRTMIN + 16,	/* 49 */
101ac29fb37Schristos 	LINUX_SIGRTMIN + 17,	/* 50 */
102ac29fb37Schristos 	LINUX_SIGRTMIN + 18,	/* 51 */
103ac29fb37Schristos 	LINUX_SIGRTMIN + 19,	/* 52 */
104ac29fb37Schristos 	LINUX_SIGRTMIN + 20,	/* 53 */
105ac29fb37Schristos 	LINUX_SIGRTMIN + 21,	/* 54 */
106ac29fb37Schristos 	LINUX_SIGRTMIN + 22,	/* 55 */
107ac29fb37Schristos 	LINUX_SIGRTMIN + 23,	/* 56 */
108ac29fb37Schristos 	LINUX_SIGRTMIN + 24,	/* 57 */
109ac29fb37Schristos 	LINUX_SIGRTMIN + 25,	/* 58 */
110ac29fb37Schristos 	LINUX_SIGRTMIN + 26,	/* 59 */
111ac29fb37Schristos 	LINUX_SIGRTMIN + 27,	/* 60 */
112ac29fb37Schristos 	LINUX_SIGRTMIN + 28,	/* 61 */
113ac29fb37Schristos 	LINUX_SIGRTMIN + 29,	/* 62 */
114ac29fb37Schristos 	LINUX_SIGRTMIN + 30,	/* 63 */
115ac29fb37Schristos };
116cb483bd2Schristos #else
117cb483bd2Schristos const int native_to_linux_signo[NSIG];
118cb483bd2Schristos #endif
119840887afSchristos 
120840887afSchristos #if defined(__i386__)
121840887afSchristos #include <compat/linux/arch/i386/linux_sigarray.c>
122840887afSchristos #elif defined(__m68k__)
123840887afSchristos #include <compat/linux/arch/m68k/linux_sigarray.c>
124840887afSchristos #elif defined(__alpha__)
125840887afSchristos #include <compat/linux/arch/alpha/linux_sigarray.c>
126840887afSchristos #elif defined(__powerpc__)
127840887afSchristos #include <compat/linux/arch/powerpc/linux_sigarray.c>
128840887afSchristos #elif defined(__mips__)
129840887afSchristos #include <compat/linux/arch/mips/linux_sigarray.c>
130*abbc8a65Sryo #elif defined(__aarch64__)
131*abbc8a65Sryo #include <compat/linux/arch/aarch64/linux_sigarray.c>
132840887afSchristos #elif defined(__arm__)
133840887afSchristos #include <compat/linux/arch/arm/linux_sigarray.c>
13453fb6703Smanu #elif defined(__amd64__)
13553fb6703Smanu #include <compat/linux/arch/amd64/linux_sigarray.c>
136840887afSchristos #else
137840887afSchristos const int linux_to_native_signo[NSIG];
138840887afSchristos #endif
139