1/* 	$NetBSD: linux_signal.h,v 1.15 2007/12/04 18:40:14 dsl 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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _I386_LINUX_SIGNAL_H
33#define _I386_LINUX_SIGNAL_H
34
35#define LINUX_SIGHUP	 1
36#define LINUX_SIGINT	 2
37#define LINUX_SIGQUIT	 3
38#define LINUX_SIGILL	 4
39#define LINUX_SIGTRAP	 5
40#define LINUX_SIGABRT	 6
41#define LINUX_SIGIOT	 6
42#define LINUX_SIGBUS	 7
43#define LINUX_SIGFPE	 8
44#define LINUX_SIGKILL	 9
45#define LINUX_SIGUSR1	10
46#define LINUX_SIGSEGV	11
47#define LINUX_SIGUSR2	12
48#define LINUX_SIGPIPE	13
49#define LINUX_SIGALRM	14
50#define LINUX_SIGTERM	15
51#define LINUX_SIGSTKFLT	16
52#define LINUX_SIGCHLD	17
53#define LINUX_SIGCONT	18
54#define LINUX_SIGSTOP	19
55#define LINUX_SIGTSTP	20
56#define LINUX_SIGTTIN	21
57#define LINUX_SIGTTOU	22
58#define LINUX_SIGURG	23
59#define LINUX_SIGXCPU	24
60#define LINUX_SIGXFSZ	25
61#define LINUX_SIGVTALRM	26
62#define LINUX_SIGPROF	27
63#define LINUX_SIGWINCH	28
64#define LINUX_SIGIO	29
65#define LINUX_SIGPWR	30
66#define LINUX_SIGSYS	31
67#define LINUX_SIGUNUSED	31
68#define LINUX_NSIG	32
69
70/* Min/max real-time linux signal */
71#define LINUX_SIGRTMIN		32
72#define LINUX_SIGRTMAX		(LINUX__NSIG - 1)
73
74#define LINUX__NSIG 		64
75#define LINUX__NSIG_BPW		32
76#define LINUX__NSIG_WORDS	(LINUX__NSIG / LINUX__NSIG_BPW)
77
78#define LINUX_SIG_BLOCK		0
79#define LINUX_SIG_UNBLOCK	1
80#define LINUX_SIG_SETMASK	2
81
82/* sa_flags */
83#define LINUX_SA_NOCLDSTOP	0x00000001
84#define LINUX_SA_NOCLDWAIT	0x00000002
85#define LINUX_SA_SIGINFO	0x00000004
86#define LINUX_SA_RESTORER	0x04000000
87#define LINUX_SA_ONSTACK	0x08000000
88#define LINUX_SA_RESTART	0x10000000
89#define LINUX_SA_INTERRUPT	0x20000000
90#define LINUX_SA_NOMASK		0x40000000
91#define LINUX_SA_ONESHOT	0x80000000
92#define LINUX_SA_ALLBITS	0xfc000007
93
94#define LINUX_MINSIGSTKSZ	2048
95
96typedef void	(*linux_handler_t)(int);
97
98typedef unsigned long	linux_old_sigset_t;
99typedef struct {
100	unsigned long sig[LINUX__NSIG_WORDS];
101} linux_sigset_t;
102
103struct linux_old_sigaction {
104	linux_handler_t		linux_sa_handler;
105	linux_old_sigset_t	linux_sa_mask;
106	unsigned long		linux_sa_flags;
107	void			(*linux_sa_restorer)(void);
108};
109
110/* Used in rt_* calls */
111struct linux_sigaction {
112	linux_handler_t		linux_sa_handler;
113	unsigned long		linux_sa_flags;
114	void			(*linux_sa_restorer)(void);
115	linux_sigset_t		linux_sa_mask;
116};
117
118struct linux_k_sigaction {
119	struct linux_sigaction sa;
120#define k_sa_restorer	sa.linux_sa_restorer
121};
122
123#define	LINUX_SS_ONSTACK	1
124#define	LINUX_SS_DISABLE	2
125
126#define	LINUX_MINSIGSTKSZ	2048
127#define	LINUX_SIGSTKSZ		8192
128
129struct linux_sigaltstack {
130	void *ss_sp;
131	int ss_flags;
132	size_t ss_size;
133};
134
135#endif /* !_I386_LINUX_SIGNAL_H */
136