1 #ifndef _ASMAXP_SIGNAL_H
2 #define _ASMAXP_SIGNAL_H
3 
4 #include <linux/types.h>
5 
6 /* Avoid too many header ordering problems.  */
7 struct siginfo;
8 
9 #ifdef __KERNEL__
10 /* Digital Unix defines 64 signals.  Most things should be clean enough
11    to redefine this at will, if care is taken to make libc match.  */
12 
13 #define _NSIG		64
14 #define _NSIG_BPW	64
15 #define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
16 
17 typedef unsigned long old_sigset_t;		/* at least 32 bits */
18 
19 typedef struct {
20 	unsigned long sig[_NSIG_WORDS];
21 } sigset_t;
22 
23 #else
24 /* Here we must cater to libcs that poke about in kernel headers.  */
25 
26 #define NSIG		32
27 typedef unsigned long sigset_t;
28 
29 #endif /* __KERNEL__ */
30 
31 
32 /*
33  * Linux/AXP has different signal numbers that Linux/i386: I'm trying
34  * to make it OSF/1 binary compatible, at least for normal binaries.
35  */
36 #define SIGHUP		 1
37 #define SIGINT		 2
38 #define SIGQUIT		 3
39 #define SIGILL		 4
40 #define SIGTRAP		 5
41 #define SIGABRT		 6
42 #define SIGEMT		 7
43 #define SIGFPE		 8
44 #define SIGKILL		 9
45 #define SIGBUS		10
46 #define SIGSEGV		11
47 #define SIGSYS		12
48 #define SIGPIPE		13
49 #define SIGALRM		14
50 #define SIGTERM		15
51 #define SIGURG		16
52 #define SIGSTOP		17
53 #define SIGTSTP		18
54 #define SIGCONT		19
55 #define SIGCHLD		20
56 #define SIGTTIN		21
57 #define SIGTTOU		22
58 #define SIGIO		23
59 #define SIGXCPU		24
60 #define SIGXFSZ		25
61 #define SIGVTALRM	26
62 #define SIGPROF		27
63 #define SIGWINCH	28
64 #define SIGINFO		29
65 #define SIGUSR1		30
66 #define SIGUSR2		31
67 
68 #define SIGPOLL	SIGIO
69 #define SIGPWR	SIGINFO
70 #define SIGIOT	SIGABRT
71 
72 /* These should not be considered constants from userland.  */
73 #define SIGRTMIN	32
74 #define SIGRTMAX	(_NSIG-1)
75 
76 /*
77  * SA_FLAGS values:
78  *
79  * SA_ONSTACK indicates that a registered stack_t will be used.
80  * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
81  * SA_RESTART flag to get restarting signals (which were the default long ago)
82  * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
83  * SA_RESETHAND clears the handler when the signal is delivered.
84  * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
85  * SA_NODEFER prevents the current signal from being masked in the handler.
86  *
87  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
88  * Unix names RESETHAND and NODEFER respectively.
89  */
90 
91 #define SA_ONSTACK	0x00000001
92 #define SA_RESTART	0x00000002
93 #define SA_NOCLDSTOP	0x00000004
94 #define SA_NODEFER	0x00000008
95 #define SA_RESETHAND	0x00000010
96 #define SA_NOCLDWAIT	0x00000020 /* not supported yet */
97 #define SA_SIGINFO	0x00000040
98 
99 #define SA_ONESHOT	SA_RESETHAND
100 #define SA_NOMASK	SA_NODEFER
101 #define SA_INTERRUPT	0x20000000 /* dummy -- ignored */
102 
103 /*
104  * sigaltstack controls
105  */
106 #define SS_ONSTACK	1
107 #define SS_DISABLE	2
108 
109 #define MINSIGSTKSZ	4096
110 #define SIGSTKSZ	16384
111 
112 
113 #ifdef __KERNEL__
114 /*
115  * These values of sa_flags are used only by the kernel as part of the
116  * irq handling routines.
117  *
118  * SA_INTERRUPT is also used by the irq handling routines.
119  * SA_SHIRQ is for shared interrupt support on PCI and EISA.
120  */
121 #define SA_PROBE		SA_ONESHOT
122 #define SA_SAMPLE_RANDOM	SA_RESTART
123 #define SA_SHIRQ		0x40000000
124 #endif
125 
126 #define SIG_BLOCK          1	/* for blocking signals */
127 #define SIG_UNBLOCK        2	/* for unblocking signals */
128 #define SIG_SETMASK        3	/* for setting the signal mask */
129 
130 /* Type of a signal handler.  */
131 typedef void (*__sighandler_t)(int);
132 
133 #define SIG_DFL	((__sighandler_t)0)	/* default signal handling */
134 #define SIG_IGN	((__sighandler_t)1)	/* ignore signal */
135 #define SIG_ERR	((__sighandler_t)-1)	/* error return from signal */
136 
137 #ifdef __KERNEL__
138 struct osf_sigaction {
139 	__sighandler_t	sa_handler;
140 	old_sigset_t	sa_mask;
141 	int		sa_flags;
142 };
143 
144 struct sigaction {
145 	__sighandler_t	sa_handler;
146 	unsigned long	sa_flags;
147 	sigset_t	sa_mask;	/* mask last for extensibility */
148 };
149 
150 struct k_sigaction {
151 	struct sigaction sa;
152 	void (*ka_restorer)(void);
153 };
154 #else
155 /* Here we must cater to libcs that poke about in kernel headers.  */
156 
157 struct sigaction {
158 	union {
159 	  __sighandler_t	_sa_handler;
160 	  void (*_sa_sigaction)(int, struct siginfo *, void *);
161 	} _u;
162 	sigset_t	sa_mask;
163 	int		sa_flags;
164 };
165 
166 #define sa_handler	_u._sa_handler
167 #define sa_sigaction	_u._sa_sigaction
168 
169 #endif /* __KERNEL__ */
170 
171 typedef struct sigaltstack {
172 	void *ss_sp;
173 	int ss_flags;
174 	size_t ss_size;
175 } stack_t;
176 
177 /* sigstack(2) is deprecated, and will be withdrawn in a future version
178    of the X/Open CAE Specification.  Use sigaltstack instead.  It is only
179    implemented here for OSF/1 compatibility.  */
180 
181 struct sigstack {
182 	void *ss_sp;
183 	int ss_onstack;
184 };
185 
186 #ifdef __KERNEL__
187 #include <asm/sigcontext.h>
188 #endif
189 
190 #endif
191