xref: /netbsd/sys/compat/linux/arch/i386/linux_signal.h (revision c4a72b64)
1 /* 	$NetBSD: linux_signal.h,v 1.12 2002/11/26 18:42:38 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Frank van der Linden and Eric Haszlakiewicz.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _I386_LINUX_SIGNAL_H
40 #define _I386_LINUX_SIGNAL_H
41 
42 #define LINUX_SIGHUP	 1
43 #define LINUX_SIGINT	 2
44 #define LINUX_SIGQUIT	 3
45 #define LINUX_SIGILL	 4
46 #define LINUX_SIGTRAP	 5
47 #define LINUX_SIGABRT	 6
48 #define LINUX_SIGIOT	 6
49 #define LINUX_SIGBUS	 7
50 #define LINUX_SIGFPE	 8
51 #define LINUX_SIGKILL	 9
52 #define LINUX_SIGUSR1	10
53 #define LINUX_SIGSEGV	11
54 #define LINUX_SIGUSR2	12
55 #define LINUX_SIGPIPE	13
56 #define LINUX_SIGALRM	14
57 #define LINUX_SIGTERM	15
58 #define LINUX_SIGSTKFLT	16
59 #define LINUX_SIGCHLD	17
60 #define LINUX_SIGCONT	18
61 #define LINUX_SIGSTOP	19
62 #define LINUX_SIGTSTP	20
63 #define LINUX_SIGTTIN	21
64 #define LINUX_SIGTTOU	22
65 #define LINUX_SIGURG	23
66 #define LINUX_SIGXCPU	24
67 #define LINUX_SIGXFSZ	25
68 #define LINUX_SIGVTALRM	26
69 #define LINUX_SIGPROF	27
70 #define LINUX_SIGWINCH	28
71 #define LINUX_SIGIO	29
72 #define LINUX_SIGPWR	30
73 #define LINUX_SIGSYS	31
74 #define LINUX_SIGUNUSED	31
75 #define LINUX_NSIG	32
76 
77 /* Min/max real-time linux signal */
78 #define LINUX_SIGRTMIN		32
79 #define LINUX_SIGRTMAX		(LINUX__NSIG - 1)
80 
81 #define LINUX__NSIG 		64
82 #define LINUX__NSIG_BPW		32
83 #define LINUX__NSIG_WORDS	(LINUX__NSIG / LINUX__NSIG_BPW)
84 
85 #define LINUX_SIG_BLOCK		0
86 #define LINUX_SIG_UNBLOCK	1
87 #define LINUX_SIG_SETMASK	2
88 
89 /* sa_flags */
90 #define LINUX_SA_NOCLDSTOP	0x00000001
91 #define LINUX_SA_NOCLDWAIT	0x00000002
92 #define LINUX_SA_SIGINFO	0x00000004
93 #define LINUX_SA_RESTORER	0x04000000
94 #define LINUX_SA_ONSTACK	0x08000000
95 #define LINUX_SA_RESTART	0x10000000
96 #define LINUX_SA_INTERRUPT	0x20000000
97 #define LINUX_SA_NOMASK		0x40000000
98 #define LINUX_SA_ONESHOT	0x80000000
99 #define LINUX_SA_ALLBITS	0xfc000007
100 
101 typedef void	(*linux_handler_t) __P((int));
102 
103 typedef unsigned long	linux_old_sigset_t;
104 typedef struct {
105 	unsigned long sig[LINUX__NSIG_WORDS];
106 } linux_sigset_t;
107 
108 struct linux_old_sigaction {
109 	linux_handler_t		linux_sa_handler;
110 	linux_old_sigset_t	linux_sa_mask;
111 	unsigned long		linux_sa_flags;
112 	void			(*linux_sa_restorer) __P((void));
113 };
114 
115 /* Used in rt_* calls */
116 struct linux_sigaction {
117 	linux_handler_t		linux_sa_handler;
118 	unsigned long		linux_sa_flags;
119 	void			(*linux_sa_restorer) __P((void));
120 	linux_sigset_t		linux_sa_mask;
121 };
122 
123 struct linux_k_sigaction {
124 	struct linux_sigaction sa;
125 #define k_sa_restorer	sa.linux_sa_restorer
126 };
127 
128 #define	LINUX_SS_ONSTACK	1
129 #define	LINUX_SS_DISABLE	2
130 
131 #define	LINUX_MINSIGSTKSZ	2048
132 #define	LINUX_SIGSTKSZ		8192
133 
134 struct linux_sigaltstack {
135 	void *ss_sp;
136 	int ss_flags;
137 	size_t ss_size;
138 };
139 
140 #endif /* !_I386_LINUX_SIGNAL_H */
141