1199767fToomas Soome/*-
2199767fToomas Soome * Copyright (c) 1982, 1986, 1989, 1991, 1993
3199767fToomas Soome *	The Regents of the University of California.  All rights reserved.
4199767fToomas Soome * (c) UNIX System Laboratories, Inc.
5199767fToomas Soome * All or some portions of this file are derived from material licensed
6199767fToomas Soome * to the University of California by American Telephone and Telegraph
7199767fToomas Soome * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8199767fToomas Soome * the permission of UNIX System Laboratories, Inc.
9199767fToomas Soome *
10199767fToomas Soome * Redistribution and use in source and binary forms, with or without
11199767fToomas Soome * modification, are permitted provided that the following conditions
12199767fToomas Soome * are met:
13199767fToomas Soome * 1. Redistributions of source code must retain the above copyright
14199767fToomas Soome *    notice, this list of conditions and the following disclaimer.
15199767fToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
16199767fToomas Soome *    notice, this list of conditions and the following disclaimer in the
17199767fToomas Soome *    documentation and/or other materials provided with the distribution.
18199767fToomas Soome * 4. Neither the name of the University nor the names of its contributors
19199767fToomas Soome *    may be used to endorse or promote products derived from this software
20199767fToomas Soome *    without specific prior written permission.
21199767fToomas Soome *
22199767fToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23199767fToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24199767fToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25199767fToomas Soome * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26199767fToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27199767fToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28199767fToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29199767fToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30199767fToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31199767fToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32199767fToomas Soome * SUCH DAMAGE.
33199767fToomas Soome *
34199767fToomas Soome *	@(#)signal.h	8.4 (Berkeley) 5/4/95
35199767fToomas Soome * $FreeBSD$
36199767fToomas Soome */
37199767fToomas Soome
38199767fToomas Soome#ifndef _SYS_SIGNAL_H_
39199767fToomas Soome#define	_SYS_SIGNAL_H_
40199767fToomas Soome
41199767fToomas Soome#include <sys/cdefs.h>
42199767fToomas Soome#include <sys/_types.h>
43199767fToomas Soome#include <sys/_sigset.h>
44199767fToomas Soome
45199767fToomas Soome#include <machine/_limits.h>	/* __MINSIGSTKSZ */
46199767fToomas Soome#include <machine/signal.h>	/* sig_atomic_t; trap codes; sigcontext */
47199767fToomas Soome
48199767fToomas Soome/*
49199767fToomas Soome * System defined signals.
50199767fToomas Soome */
51199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
52199767fToomas Soome#define	SIGHUP		1	/* hangup */
53199767fToomas Soome#endif
54199767fToomas Soome#define	SIGINT		2	/* interrupt */
55199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
56199767fToomas Soome#define	SIGQUIT		3	/* quit */
57199767fToomas Soome#endif
58199767fToomas Soome#define	SIGILL		4	/* illegal instr. (not reset when caught) */
59199767fToomas Soome#if __XSI_VISIBLE
60199767fToomas Soome#define	SIGTRAP		5	/* trace trap (not reset when caught) */
61199767fToomas Soome#endif
62199767fToomas Soome#define	SIGABRT		6	/* abort() */
63199767fToomas Soome#if __BSD_VISIBLE
64199767fToomas Soome#define	SIGIOT		SIGABRT	/* compatibility */
65199767fToomas Soome#define	SIGEMT		7	/* EMT instruction */
66199767fToomas Soome#endif
67199767fToomas Soome#define	SIGFPE		8	/* floating point exception */
68199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
69199767fToomas Soome#define	SIGKILL		9	/* kill (cannot be caught or ignored) */
70199767fToomas Soome#endif
71199767fToomas Soome#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
72199767fToomas Soome#define	SIGBUS		10	/* bus error */
73199767fToomas Soome#endif
74199767fToomas Soome#define	SIGSEGV		11	/* segmentation violation */
75199767fToomas Soome#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
76199767fToomas Soome#define	SIGSYS		12	/* non-existent system call invoked */
77199767fToomas Soome#endif
78199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
79199767fToomas Soome#define	SIGPIPE		13	/* write on a pipe with no one to read it */
80199767fToomas Soome#define	SIGALRM		14	/* alarm clock */
81199767fToomas Soome#endif
82199767fToomas Soome#define	SIGTERM		15	/* software termination signal from kill */
83199767fToomas Soome#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
84199767fToomas Soome#define	SIGURG		16	/* urgent condition on IO channel */
85199767fToomas Soome#endif
86199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
87199767fToomas Soome#define	SIGSTOP		17	/* sendable stop signal not from tty */
88199767fToomas Soome#define	SIGTSTP		18	/* stop signal from tty */
89199767fToomas Soome#define	SIGCONT		19	/* continue a stopped process */
90199767fToomas Soome#define	SIGCHLD		20	/* to parent on child stop or exit */
91199767fToomas Soome#define	SIGTTIN		21	/* to readers pgrp upon background tty read */
92199767fToomas Soome#define	SIGTTOU		22	/* like TTIN if (tp->t_local&LTOSTOP) */
93199767fToomas Soome#endif
94199767fToomas Soome#if __BSD_VISIBLE
95199767fToomas Soome#define	SIGIO		23	/* input/output possible signal */
96199767fToomas Soome#endif
97199767fToomas Soome#if __XSI_VISIBLE
98199767fToomas Soome#define	SIGXCPU		24	/* exceeded CPU time limit */
99199767fToomas Soome#define	SIGXFSZ		25	/* exceeded file size limit */
100199767fToomas Soome#define	SIGVTALRM	26	/* virtual time alarm */
101199767fToomas Soome#define	SIGPROF		27	/* profiling time alarm */
102199767fToomas Soome#endif
103199767fToomas Soome#if __BSD_VISIBLE
104199767fToomas Soome#define	SIGWINCH	28	/* window size changes */
105199767fToomas Soome#define	SIGINFO		29	/* information request */
106199767fToomas Soome#endif
107199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
108199767fToomas Soome#define	SIGUSR1		30	/* user defined signal 1 */
109199767fToomas Soome#define	SIGUSR2		31	/* user defined signal 2 */
110199767fToomas Soome#endif
111199767fToomas Soome#if __BSD_VISIBLE
112199767fToomas Soome#define	SIGTHR		32	/* reserved by thread library. */
113199767fToomas Soome#define	SIGLWP		SIGTHR
114199767fToomas Soome#define	SIGLIBRT	33	/* reserved by real-time library. */
115199767fToomas Soome#endif
116199767fToomas Soome
117199767fToomas Soome#define	SIGRTMIN	65
118199767fToomas Soome#define	SIGRTMAX	126
119199767fToomas Soome
120199767fToomas Soome#define	SIG_DFL		((__sighandler_t *)0)
121199767fToomas Soome#define	SIG_IGN		((__sighandler_t *)1)
122199767fToomas Soome#define	SIG_ERR		((__sighandler_t *)-1)
123199767fToomas Soome/* #define	SIG_CATCH	((__sighandler_t *)2) See signalvar.h */
124199767fToomas Soome#define SIG_HOLD        ((__sighandler_t *)3)
125199767fToomas Soome
126199767fToomas Soome/*
127199767fToomas Soome * Type of a signal handling function.
128199767fToomas Soome *
129199767fToomas Soome * Language spec sez signal handlers take exactly one arg, even though we
130199767fToomas Soome * actually supply three.  Ugh!
131199767fToomas Soome *
132199767fToomas Soome * We don't try to hide the difference by leaving out the args because
133199767fToomas Soome * that would cause warnings about conformant programs.  Nonconformant
134199767fToomas Soome * programs can avoid the warnings by casting to (__sighandler_t *) or
135199767fToomas Soome * sig_t before calling signal() or assigning to sa_handler or sv_handler.
136199767fToomas Soome *
137199767fToomas Soome * The kernel should reverse the cast before calling the function.  It
138199767fToomas Soome * has no way to do this, but on most machines 1-arg and 3-arg functions
139199767fToomas Soome * have the same calling protocol so there is no problem in practice.
140199767fToomas Soome * A bit in sa_flags could be used to specify the number of args.
141199767fToomas Soome */
142199767fToomas Soometypedef	void __sighandler_t(int);
143199767fToomas Soome
144199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
145199767fToomas Soome#ifndef _SIGSET_T_DECLARED
146199767fToomas Soome#define	_SIGSET_T_DECLARED
147199767fToomas Soometypedef	__sigset_t	sigset_t;
148199767fToomas Soome#endif
149199767fToomas Soome#endif
150199767fToomas Soome
151199767fToomas Soome#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500
152199767fToomas Soomeunion sigval {
153199767fToomas Soome	/* Members as suggested by Annex C of POSIX 1003.1b. */
154199767fToomas Soome	int	sival_int;
155199767fToomas Soome	void	*sival_ptr;
156199767fToomas Soome	/* 6.0 compatibility */
157199767fToomas Soome	int     sigval_int;
158199767fToomas Soome	void    *sigval_ptr;
159199767fToomas Soome};
160199767fToomas Soome#endif
161199767fToomas Soome
162199767fToomas Soome#if __POSIX_VISIBLE >= 199309
163199767fToomas Soomestruct sigevent {
164199767fToomas Soome	int	sigev_notify;		/* Notification type */
165199767fToomas Soome	int	sigev_signo;		/* Signal number */
166199767fToomas Soome	union sigval sigev_value;	/* Signal value */
167199767fToomas Soome	union {
168199767fToomas Soome		__lwpid_t	_threadid;
169199767fToomas Soome		struct {
170199767fToomas Soome			void (*_function)(union sigval);
171199767fToomas Soome			void *_attribute; /* pthread_attr_t * */
172199767fToomas Soome		} _sigev_thread;
173199767fToomas Soome		unsigned short _kevent_flags;
174199767fToomas Soome		long __spare__[8];
175199767fToomas Soome	} _sigev_un;
176199767fToomas Soome};
177199767fToomas Soome
178199767fToomas Soome#if __BSD_VISIBLE
179199767fToomas Soome#define	sigev_notify_kqueue		sigev_signo
180199767fToomas Soome#define	sigev_notify_kevent_flags	_sigev_un._kevent_flags
181199767fToomas Soome#define	sigev_notify_thread_id		_sigev_un._threadid
182199767fToomas Soome#endif
183199767fToomas Soome#define	sigev_notify_function		_sigev_un._sigev_thread._function
184199767fToomas Soome#define	sigev_notify_attributes		_sigev_un._sigev_thread._attribute
185199767fToomas Soome
186199767fToomas Soome#define	SIGEV_NONE	0		/* No async notification. */
187199767fToomas Soome#define	SIGEV_SIGNAL	1		/* Generate a queued signal. */
188199767fToomas Soome#define	SIGEV_THREAD	2		/* Call back from another pthread. */
189199767fToomas Soome#if __BSD_VISIBLE
190199767fToomas Soome#define	SIGEV_KEVENT	3		/* Generate a kevent. */
191199767fToomas Soome#define	SIGEV_THREAD_ID	4		/* Send signal to a kernel thread. */
192199767fToomas Soome#endif
193199767fToomas Soome#endif /* __POSIX_VISIBLE >= 199309 */
194199767fToomas Soome
195199767fToomas Soome#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE
196199767fToomas Soometypedef	struct __siginfo {
197199767fToomas Soome	int	si_signo;		/* signal number */
198199767fToomas Soome	int	si_errno;		/* errno association */
199199767fToomas Soome	/*
200199767fToomas Soome	 * Cause of signal, one of the SI_ macros or signal-specific
201199767fToomas Soome	 * values, i.e. one of the FPE_... values for SIGFPE.  This
202199767fToomas Soome	 * value is equivalent to the second argument to an old-style
203199767fToomas Soome	 * FreeBSD signal handler.
204199767fToomas Soome	 */
205199767fToomas Soome	int	si_code;		/* signal code */
206199767fToomas Soome	__pid_t	si_pid;			/* sending process */
207199767fToomas Soome	__uid_t	si_uid;			/* sender's ruid */
208199767fToomas Soome	int	si_status;		/* exit value */
209199767fToomas Soome	void	*si_addr;		/* faulting instruction */
210199767fToomas Soome	union sigval si_value;		/* signal value */
211199767fToomas Soome	union	{
212199767fToomas Soome		struct {
213199767fToomas Soome			int	_trapno;/* machine specific trap code */
214199767fToomas Soome		} _fault;
215199767fToomas Soome		struct {
216199767fToomas Soome			int	_timerid;
217199767fToomas Soome			int	_overrun;
218199767fToomas Soome		} _timer;
219199767fToomas Soome		struct {
220199767fToomas Soome			int	_mqd;
221199767fToomas Soome		} _mesgq;
222199767fToomas Soome		struct {
223199767fToomas Soome			long	_band;		/* band event for SIGPOLL */
224199767fToomas Soome		} _poll;			/* was this ever used ? */
225199767fToomas Soome		struct {
226199767fToomas Soome			long	__spare1__;
227199767fToomas Soome			int	__spare2__[7];
228199767fToomas Soome		} __spare__;
229199767fToomas Soome	} _reason;
230199767fToomas Soome} siginfo_t;
231199767fToomas Soome
232199767fToomas Soome#define si_trapno	_reason._fault._trapno
233199767fToomas Soome#define si_timerid	_reason._timer._timerid
234199767fToomas Soome#define si_overrun	_reason._timer._overrun
235199767fToomas Soome#define si_mqd		_reason._mesgq._mqd
236199767fToomas Soome#define si_band		_reason._poll._band
237199767fToomas Soome
238199767fToomas Soome/** si_code **/
239199767fToomas Soome/* codes for SIGILL */
240199767fToomas Soome#define ILL_ILLOPC 	1	/* Illegal opcode.			*/
241199767fToomas Soome#define ILL_ILLOPN 	2	/* Illegal operand.			*/
242199767fToomas Soome#define ILL_ILLADR 	3	/* Illegal addressing mode.		*/
243199767fToomas Soome#define ILL_ILLTRP 	4	/* Illegal trap.			*/
244199767fToomas Soome#define ILL_PRVOPC 	5	/* Privileged opcode.			*/
245199767fToomas Soome#define ILL_PRVREG 	6	/* Privileged register.			*/
246199767fToomas Soome#define ILL_COPROC 	7	/* Coprocessor error.			*/
247199767fToomas Soome#define ILL_BADSTK 	8	/* Internal stack error.		*/
248199767fToomas Soome
249199767fToomas Soome/* codes for SIGBUS */
250199767fToomas Soome#define BUS_ADRALN	1	/* Invalid address alignment.		*/
251199767fToomas Soome#define BUS_ADRERR	2	/* Nonexistent physical address.	*/
252199767fToomas Soome#define BUS_OBJERR	3	/* Object-specific hardware error.	*/
253199767fToomas Soome
254199767fToomas Soome/* codes for SIGSEGV */
255199767fToomas Soome#define SEGV_MAPERR	1	/* Address not mapped to object.	*/
256199767fToomas Soome#define SEGV_ACCERR	2	/* Invalid permissions for mapped	*/
257199767fToomas Soome				/* object.				*/
258199767fToomas Soome
259199767fToomas Soome/* codes for SIGFPE */
260199767fToomas Soome#define FPE_INTOVF	1	/* Integer overflow.			*/
261199767fToomas Soome#define FPE_INTDIV	2	/* Integer divide by zero.		*/
262199767fToomas Soome#define FPE_FLTDIV	3	/* Floating point divide by zero.	*/
263199767fToomas Soome#define FPE_FLTOVF	4	/* Floating point overflow.		*/
264199767fToomas Soome#define FPE_FLTUND	5	/* Floating point underflow.		*/
265199767fToomas Soome#define FPE_FLTRES	6	/* Floating point inexact result.	*/
266199767fToomas Soome#define FPE_FLTINV	7	/* Invalid floating point operation.	*/
267199767fToomas Soome#define FPE_FLTSUB	8	/* Subscript out of range.		*/
268199767fToomas Soome
269199767fToomas Soome/* codes for SIGTRAP */
270199767fToomas Soome#define TRAP_BRKPT	1	/* Process breakpoint.			*/
271199767fToomas Soome#define TRAP_TRACE	2	/* Process trace trap.			*/
272199767fToomas Soome#define	TRAP_DTRACE	3	/* DTrace induced trap.			*/
273199767fToomas Soome
274199767fToomas Soome/* codes for SIGCHLD */
275199767fToomas Soome#define CLD_EXITED	1	/* Child has exited			*/
276199767fToomas Soome#define CLD_KILLED	2	/* Child has terminated abnormally but	*/
277199767fToomas Soome				/* did not create a core file		*/
278199767fToomas Soome#define CLD_DUMPED	3	/* Child has terminated abnormally and	*/
279199767fToomas Soome				/* created a core file			*/
280199767fToomas Soome#define CLD_TRAPPED	4	/* Traced child has trapped		*/
281199767fToomas Soome#define CLD_STOPPED	5	/* Child has stopped			*/
282199767fToomas Soome#define CLD_CONTINUED	6	/* Stopped child has continued		*/
283199767fToomas Soome
284199767fToomas Soome/* codes for SIGPOLL */
285199767fToomas Soome#define POLL_IN		1	/* Data input available			*/
286199767fToomas Soome#define POLL_OUT	2	/* Output buffers available		*/
287199767fToomas Soome#define POLL_MSG	3	/* Input message available		*/
288199767fToomas Soome#define POLL_ERR	4	/* I/O Error				*/
289199767fToomas Soome#define POLL_PRI	5	/* High priority input available	*/
290199767fToomas Soome#define POLL_HUP	6	/* Device disconnected			*/
291199767fToomas Soome
292199767fToomas Soome#endif
293199767fToomas Soome
294199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
295199767fToomas Soomestruct __siginfo;
296199767fToomas Soome
297199767fToomas Soome/*
298199767fToomas Soome * Signal vector "template" used in sigaction call.
299199767fToomas Soome */
300199767fToomas Soomestruct sigaction {
301199767fToomas Soome	union {
302199767fToomas Soome		void    (*__sa_handler)(int);
303199767fToomas Soome		void    (*__sa_sigaction)(int, struct __siginfo *, void *);
304199767fToomas Soome	} __sigaction_u;		/* signal handler */
305199767fToomas Soome	int	sa_flags;		/* see signal options below */
306199767fToomas Soome	sigset_t sa_mask;		/* signal mask to apply */
307199767fToomas Soome};
308199767fToomas Soome
309199767fToomas Soome#define	sa_handler	__sigaction_u.__sa_handler
310199767fToomas Soome#endif
311199767fToomas Soome
312199767fToomas Soome#if __XSI_VISIBLE
313199767fToomas Soome/* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */
314199767fToomas Soome#define	sa_sigaction	__sigaction_u.__sa_sigaction
315199767fToomas Soome#endif
316199767fToomas Soome
317199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
318199767fToomas Soome#define	SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */
319199767fToomas Soome#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */
320199767fToomas Soome
321199767fToomas Soome#if __XSI_VISIBLE
322199767fToomas Soome#define	SA_ONSTACK	0x0001	/* take signal on signal stack */
323199767fToomas Soome#define	SA_RESTART	0x0002	/* restart system call on signal return */
324199767fToomas Soome#define	SA_RESETHAND	0x0004	/* reset to SIG_DFL when taking signal */
325199767fToomas Soome#define	SA_NODEFER	0x0010	/* don't mask the signal we're delivering */
326199767fToomas Soome#define	SA_NOCLDWAIT	0x0020	/* don't keep zombies around */
327199767fToomas Soome#define	SA_SIGINFO	0x0040	/* signal handler with SA_SIGINFO args */
328199767fToomas Soome#endif
329199767fToomas Soome
330199767fToomas Soome#if __BSD_VISIBLE
331199767fToomas Soome#define	NSIG		32	/* number of old signals (counting 0) */
332199767fToomas Soome#endif
333199767fToomas Soome
334199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
335199767fToomas Soome#define	SI_NOINFO	0		/* No signal info besides si_signo. */
336199767fToomas Soome#define	SI_USER		0x10001		/* Signal sent by kill(). */
337199767fToomas Soome#define	SI_QUEUE	0x10002		/* Signal sent by the sigqueue(). */
338199767fToomas Soome#define	SI_TIMER	0x10003		/* Signal generated by expiration of */
339199767fToomas Soome					/* a timer set by timer_settime(). */
340199767fToomas Soome#define	SI_ASYNCIO	0x10004		/* Signal generated by completion of */
341199767fToomas Soome					/* an asynchronous I/O request.*/
342199767fToomas Soome#define	SI_MESGQ	0x10005		/* Signal generated by arrival of a */
343199767fToomas Soome					/* message on an empty message queue. */
344199767fToomas Soome#define	SI_KERNEL	0x10006
345199767fToomas Soome#define	SI_LWP		0x10007		/* Signal sent by thr_kill */
346199767fToomas Soome#endif
347199767fToomas Soome#if __BSD_VISIBLE
348199767fToomas Soome#define	SI_UNDEFINED	0
349199767fToomas Soome#endif
350199767fToomas Soome
351199767fToomas Soome#if __BSD_VISIBLE
352199767fToomas Soometypedef	__sighandler_t	*sig_t;	/* type of pointer to a signal function */
353199767fToomas Soometypedef	void __siginfohandler_t(int, struct __siginfo *, void *);
354199767fToomas Soome#endif
355199767fToomas Soome
356199767fToomas Soome#if __XSI_VISIBLE
357199767fToomas Soome/*
358199767fToomas Soome * Structure used in sigaltstack call.
359199767fToomas Soome */
360199767fToomas Soome#if __BSD_VISIBLE
361199767fToomas Soometypedef	struct sigaltstack {
362199767fToomas Soome#else
363199767fToomas Soometypedef	struct {
364199767fToomas Soome#endif
365199767fToomas Soome	void	*ss_sp;			/* signal stack base */
366199767fToomas Soome	__size_t ss_size;		/* signal stack length */
367199767fToomas Soome	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
368199767fToomas Soome} stack_t;
369199767fToomas Soome
370199767fToomas Soome#define	SS_ONSTACK	0x0001	/* take signal on alternate stack */
371199767fToomas Soome#define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */
372199767fToomas Soome#define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */
373199767fToomas Soome#define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */
374199767fToomas Soome#endif
375199767fToomas Soome
376199767fToomas Soome#if __BSD_VISIBLE
377199767fToomas Soome/*
378199767fToomas Soome * 4.3 compatibility:
379199767fToomas Soome * Signal vector "template" used in sigvec call.
380199767fToomas Soome */
381199767fToomas Soomestruct sigvec {
382199767fToomas Soome	__sighandler_t *sv_handler;	/* signal handler */
383199767fToomas Soome	int	sv_mask;		/* signal mask to apply */
384199767fToomas Soome	int	sv_flags;		/* see signal options below */
385199767fToomas Soome};
386199767fToomas Soome
387199767fToomas Soome#define	SV_ONSTACK	SA_ONSTACK
388199767fToomas Soome#define	SV_INTERRUPT	SA_RESTART	/* same bit, opposite sense */
389199767fToomas Soome#define	SV_RESETHAND	SA_RESETHAND
390199767fToomas Soome#define	SV_NODEFER	SA_NODEFER
391199767fToomas Soome#define	SV_NOCLDSTOP	SA_NOCLDSTOP
392199767fToomas Soome#define	SV_SIGINFO	SA_SIGINFO
393199767fToomas Soome#define	sv_onstack	sv_flags	/* isn't compatibility wonderful! */
394199767fToomas Soome#endif
395199767fToomas Soome
396199767fToomas Soome/* Keep this in one place only */
397199767fToomas Soome#if defined(_KERNEL) && defined(COMPAT_43) && \
398199767fToomas Soome    !defined(__i386__)
399199767fToomas Soomestruct osigcontext {
400199767fToomas Soome	int _not_used;
401199767fToomas Soome};
402199767fToomas Soome#endif
403199767fToomas Soome
404199767fToomas Soome#if __XSI_VISIBLE
405199767fToomas Soome/*
406199767fToomas Soome * Structure used in sigstack call.
407199767fToomas Soome */
408199767fToomas Soomestruct sigstack {
409199767fToomas Soome	void	*ss_sp;			/* signal stack pointer */
410199767fToomas Soome	int	ss_onstack;		/* current status */
411199767fToomas Soome};
412199767fToomas Soome#endif
413199767fToomas Soome
414199767fToomas Soome#if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112
415199767fToomas Soome/*
416199767fToomas Soome * Macro for converting signal number to a mask suitable for
417199767fToomas Soome * sigblock().
418199767fToomas Soome */
419199767fToomas Soome#define	sigmask(m)	(1 << ((m)-1))
420199767fToomas Soome#endif
421199767fToomas Soome
422199767fToomas Soome#if __BSD_VISIBLE
423199767fToomas Soome#define	BADSIG		SIG_ERR
424199767fToomas Soome#endif
425199767fToomas Soome
426199767fToomas Soome#if __POSIX_VISIBLE || __XSI_VISIBLE
427199767fToomas Soome/*
428199767fToomas Soome * Flags for sigprocmask:
429199767fToomas Soome */
430199767fToomas Soome#define	SIG_BLOCK	1	/* block specified signal set */
431199767fToomas Soome#define	SIG_UNBLOCK	2	/* unblock specified signal set */
432199767fToomas Soome#define	SIG_SETMASK	3	/* set specified signal set */
433199767fToomas Soome#endif
434199767fToomas Soome
435199767fToomas Soome/*
436199767fToomas Soome * For historical reasons; programs expect signal's return value to be
437199767fToomas Soome * defined by <sys/signal.h>.
438199767fToomas Soome */
439199767fToomas Soome__BEGIN_DECLS
440199767fToomas Soome__sighandler_t *signal(int, __sighandler_t *);
441199767fToomas Soome__END_DECLS
442199767fToomas Soome
443199767fToomas Soome#endif /* !_SYS_SIGNAL_H_ */
444