1105109Smike/*-
21541Srgrimes * Copyright (c) 1982, 1986, 1989, 1991, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 4. Neither the name of the University nor the names of its contributors
191541Srgrimes *    may be used to endorse or promote products derived from this software
201541Srgrimes *    without specific prior written permission.
211541Srgrimes *
221541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321541Srgrimes * SUCH DAMAGE.
331541Srgrimes *
3414486Shsu *	@(#)signal.h	8.4 (Berkeley) 5/4/95
3550477Speter * $FreeBSD$
361541Srgrimes */
371541Srgrimes
38105109Smike#ifndef _SYS_SIGNAL_H_
391541Srgrimes#define	_SYS_SIGNAL_H_
401541Srgrimes
419343Sbde#include <sys/cdefs.h>
42107376Smike#include <sys/_types.h>
4398301Swollman#include <sys/_sigset.h>
449343Sbde
45149337Sstefanf#include <machine/_limits.h>	/* __MINSIGSTKSZ */
46105109Smike#include <machine/signal.h>	/* sig_atomic_t; trap codes; sigcontext */
47105109Smike
4851791Smarcel/*
4951942Smarcel * System defined signals.
5051791Smarcel */
51105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
5251942Smarcel#define	SIGHUP		1	/* hangup */
53105106Smike#endif
5451791Smarcel#define	SIGINT		2	/* interrupt */
55105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
5651791Smarcel#define	SIGQUIT		3	/* quit */
57105106Smike#endif
5851791Smarcel#define	SIGILL		4	/* illegal instr. (not reset when caught) */
59105106Smike#if __XSI_VISIBLE
6051791Smarcel#define	SIGTRAP		5	/* trace trap (not reset when caught) */
61105106Smike#endif
6251791Smarcel#define	SIGABRT		6	/* abort() */
63105106Smike#if __BSD_VISIBLE
6451791Smarcel#define	SIGIOT		SIGABRT	/* compatibility */
6551791Smarcel#define	SIGEMT		7	/* EMT instruction */
66105106Smike#endif
6751791Smarcel#define	SIGFPE		8	/* floating point exception */
68105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
6951791Smarcel#define	SIGKILL		9	/* kill (cannot be caught or ignored) */
70105106Smike#endif
71105106Smike#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
7251791Smarcel#define	SIGBUS		10	/* bus error */
73105106Smike#endif
7451791Smarcel#define	SIGSEGV		11	/* segmentation violation */
75175502Sdas#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
7651791Smarcel#define	SIGSYS		12	/* non-existent system call invoked */
77105106Smike#endif
78105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
7951791Smarcel#define	SIGPIPE		13	/* write on a pipe with no one to read it */
8051791Smarcel#define	SIGALRM		14	/* alarm clock */
81105106Smike#endif
8251791Smarcel#define	SIGTERM		15	/* software termination signal from kill */
83105106Smike#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
8451791Smarcel#define	SIGURG		16	/* urgent condition on IO channel */
85105106Smike#endif
86105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
8751791Smarcel#define	SIGSTOP		17	/* sendable stop signal not from tty */
8851791Smarcel#define	SIGTSTP		18	/* stop signal from tty */
8951791Smarcel#define	SIGCONT		19	/* continue a stopped process */
9051791Smarcel#define	SIGCHLD		20	/* to parent on child stop or exit */
9151791Smarcel#define	SIGTTIN		21	/* to readers pgrp upon background tty read */
9251791Smarcel#define	SIGTTOU		22	/* like TTIN if (tp->t_local&LTOSTOP) */
93105106Smike#endif
94105106Smike#if __BSD_VISIBLE
9551791Smarcel#define	SIGIO		23	/* input/output possible signal */
96105106Smike#endif
97105106Smike#if __XSI_VISIBLE
9851791Smarcel#define	SIGXCPU		24	/* exceeded CPU time limit */
9951791Smarcel#define	SIGXFSZ		25	/* exceeded file size limit */
10051791Smarcel#define	SIGVTALRM	26	/* virtual time alarm */
10151791Smarcel#define	SIGPROF		27	/* profiling time alarm */
102105106Smike#endif
103105106Smike#if __BSD_VISIBLE
10451942Smarcel#define	SIGWINCH	28	/* window size changes */
10551942Smarcel#define	SIGINFO		29	/* information request */
106105106Smike#endif
107105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
10851942Smarcel#define	SIGUSR1		30	/* user defined signal 1 */
10951942Smarcel#define	SIGUSR2		31	/* user defined signal 2 */
110105106Smike#endif
111112894Sjeff#if __BSD_VISIBLE
112151917Sdavidxu#define	SIGTHR		32	/* reserved by thread library. */
113152373Sdavidxu#define	SIGLWP		SIGTHR
114233519Srmh#define	SIGLIBRT	33	/* reserved by real-time library. */
115112894Sjeff#endif
1161541Srgrimes
117151306Sdavidxu#define	SIGRTMIN	65
118152973Sdavidxu#define	SIGRTMAX	126
119151306Sdavidxu
120105106Smike#define	SIG_DFL		((__sighandler_t *)0)
121105106Smike#define	SIG_IGN		((__sighandler_t *)1)
122105106Smike#define	SIG_ERR		((__sighandler_t *)-1)
123199827Skib/* #define	SIG_CATCH	((__sighandler_t *)2) See signalvar.h */
124199827Skib#define SIG_HOLD        ((__sighandler_t *)3)
125105106Smike
126210365Strasz/*
1279343Sbde * Type of a signal handling function.
1289343Sbde *
1299343Sbde * Language spec sez signal handlers take exactly one arg, even though we
1301541Srgrimes * actually supply three.  Ugh!
1319343Sbde *
1329343Sbde * We don't try to hide the difference by leaving out the args because
1339343Sbde * that would cause warnings about conformant programs.  Nonconformant
1349343Sbde * programs can avoid the warnings by casting to (__sighandler_t *) or
1359343Sbde * sig_t before calling signal() or assigning to sa_handler or sv_handler.
1369343Sbde *
1379343Sbde * The kernel should reverse the cast before calling the function.  It
1389343Sbde * has no way to do this, but on most machines 1-arg and 3-arg functions
1399343Sbde * have the same calling protocol so there is no problem in practice.
1409343Sbde * A bit in sa_flags could be used to specify the number of args.
1411541Srgrimes */
142105109Smiketypedef	void __sighandler_t(int);
1431541Srgrimes
144105015Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
145105015Smike#ifndef _SIGSET_T_DECLARED
146105015Smike#define	_SIGSET_T_DECLARED
147105015Smiketypedef	__sigset_t	sigset_t;
148105015Smike#endif
149105015Smike#endif
150105015Smike
151105015Smike#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500
15248621Scracauerunion sigval {
15348621Scracauer	/* Members as suggested by Annex C of POSIX 1003.1b. */
154152029Sdavidxu	int	sival_int;
155152029Sdavidxu	void	*sival_ptr;
156174003Sdavidxu	/* 6.0 compatibility */
157174003Sdavidxu	int     sigval_int;
158174003Sdavidxu	void    *sigval_ptr;
15948621Scracauer};
160105015Smike#endif
16148621Scracauer
162105015Smike#if __POSIX_VISIBLE >= 199309
16352308Smarcelstruct sigevent {
16452308Smarcel	int	sigev_notify;		/* Notification type */
165151867Sdavidxu	int	sigev_signo;		/* Signal number */
166151867Sdavidxu	union sigval sigev_value;	/* Signal value */
16769002Salc	union {
168151867Sdavidxu		__lwpid_t	_threadid;
169151867Sdavidxu		struct {
170152029Sdavidxu			void (*_function)(union sigval);
171151867Sdavidxu			void *_attribute; /* pthread_attr_t * */
172151867Sdavidxu		} _sigev_thread;
173230857Sdavidxu		unsigned short _kevent_flags;
174153154Sdavidxu		long __spare__[8];
175151867Sdavidxu	} _sigev_un;
17652308Smarcel};
177151867Sdavidxu
178105015Smike#if __BSD_VISIBLE
179151867Sdavidxu#define	sigev_notify_kqueue		sigev_signo
180230857Sdavidxu#define	sigev_notify_kevent_flags	_sigev_un._kevent_flags
181151867Sdavidxu#define	sigev_notify_thread_id		_sigev_un._threadid
182105015Smike#endif
183151867Sdavidxu#define	sigev_notify_function		_sigev_un._sigev_thread._function
184151867Sdavidxu#define	sigev_notify_attributes		_sigev_un._sigev_thread._attribute
18552308Smarcel
186151867Sdavidxu#define	SIGEV_NONE	0		/* No async notification. */
187151867Sdavidxu#define	SIGEV_SIGNAL	1		/* Generate a queued signal. */
188151867Sdavidxu#define	SIGEV_THREAD	2		/* Call back from another pthread. */
189105015Smike#if __BSD_VISIBLE
190151867Sdavidxu#define	SIGEV_KEVENT	3		/* Generate a kevent. */
191151867Sdavidxu#define	SIGEV_THREAD_ID	4		/* Send signal to a kernel thread. */
192105015Smike#endif
193105015Smike#endif /* __POSIX_VISIBLE >= 199309 */
19452308Smarcel
195105015Smike#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE
196105109Smiketypedef	struct __siginfo {
19751942Smarcel	int	si_signo;		/* signal number */
19851942Smarcel	int	si_errno;		/* errno association */
19952160Smarcel	/*
20048621Scracauer	 * Cause of signal, one of the SI_ macros or signal-specific
201105109Smike	 * values, i.e. one of the FPE_... values for SIGFPE.  This
20248621Scracauer	 * value is equivalent to the second argument to an old-style
20348621Scracauer	 * FreeBSD signal handler.
20448621Scracauer	 */
20551942Smarcel	int	si_code;		/* signal code */
206105015Smike	__pid_t	si_pid;			/* sending process */
207105015Smike	__uid_t	si_uid;			/* sender's ruid */
20851942Smarcel	int	si_status;		/* exit value */
20951942Smarcel	void	*si_addr;		/* faulting instruction */
21051942Smarcel	union sigval si_value;		/* signal value */
211151306Sdavidxu	union	{
212151306Sdavidxu		struct {
213151306Sdavidxu			int	_trapno;/* machine specific trap code */
214151306Sdavidxu		} _fault;
215151574Sdavidxu		struct {
216151574Sdavidxu			int	_timerid;
217151574Sdavidxu			int	_overrun;
218151574Sdavidxu		} _timer;
219153154Sdavidxu		struct {
220153154Sdavidxu			int	_mqd;
221153154Sdavidxu		} _mesgq;
222153154Sdavidxu		struct {
223153154Sdavidxu			long	_band;		/* band event for SIGPOLL */
224153154Sdavidxu		} _poll;			/* was this ever used ? */
225153154Sdavidxu		struct {
226153154Sdavidxu			long	__spare1__;
227153154Sdavidxu			int	__spare2__[7];
228153154Sdavidxu		} __spare__;
229151306Sdavidxu	} _reason;
23051791Smarcel} siginfo_t;
231151306Sdavidxu
232151306Sdavidxu#define si_trapno	_reason._fault._trapno
233151574Sdavidxu#define si_timerid	_reason._timer._timerid
234151574Sdavidxu#define si_overrun	_reason._timer._overrun
235153154Sdavidxu#define si_mqd		_reason._mesgq._mqd
236153154Sdavidxu#define si_band		_reason._poll._band
237151306Sdavidxu
238151306Sdavidxu/** si_code **/
239151306Sdavidxu/* codes for SIGILL */
240151306Sdavidxu#define ILL_ILLOPC 	1	/* Illegal opcode.			*/
241151306Sdavidxu#define ILL_ILLOPN 	2	/* Illegal operand.			*/
242151306Sdavidxu#define ILL_ILLADR 	3	/* Illegal addressing mode.		*/
243151306Sdavidxu#define ILL_ILLTRP 	4	/* Illegal trap.			*/
244151306Sdavidxu#define ILL_PRVOPC 	5	/* Privileged opcode.			*/
245151306Sdavidxu#define ILL_PRVREG 	6	/* Privileged register.			*/
246151306Sdavidxu#define ILL_COPROC 	7	/* Coprocessor error.			*/
247151306Sdavidxu#define ILL_BADSTK 	8	/* Internal stack error.		*/
248151306Sdavidxu
249151306Sdavidxu/* codes for SIGBUS */
250151306Sdavidxu#define BUS_ADRALN	1	/* Invalid address alignment.		*/
251151306Sdavidxu#define BUS_ADRERR	2	/* Nonexistent physical address.	*/
252151306Sdavidxu#define BUS_OBJERR	3	/* Object-specific hardware error.	*/
253151306Sdavidxu
254151306Sdavidxu/* codes for SIGSEGV */
255151306Sdavidxu#define SEGV_MAPERR	1	/* Address not mapped to object.	*/
256151306Sdavidxu#define SEGV_ACCERR	2	/* Invalid permissions for mapped	*/
257151306Sdavidxu				/* object.				*/
258151306Sdavidxu
259151306Sdavidxu/* codes for SIGFPE */
260151306Sdavidxu#define FPE_INTOVF	1	/* Integer overflow.			*/
261151306Sdavidxu#define FPE_INTDIV	2	/* Integer divide by zero.		*/
262151306Sdavidxu#define FPE_FLTDIV	3	/* Floating point divide by zero.	*/
263151306Sdavidxu#define FPE_FLTOVF	4	/* Floating point overflow.		*/
264151306Sdavidxu#define FPE_FLTUND	5	/* Floating point underflow.		*/
265151306Sdavidxu#define FPE_FLTRES	6	/* Floating point inexact result.	*/
266151306Sdavidxu#define FPE_FLTINV	7	/* Invalid floating point operation.	*/
267151306Sdavidxu#define FPE_FLTSUB	8	/* Subscript out of range.		*/
268151306Sdavidxu
269151306Sdavidxu/* codes for SIGTRAP */
270151306Sdavidxu#define TRAP_BRKPT	1	/* Process breakpoint.			*/
271151306Sdavidxu#define TRAP_TRACE	2	/* Process trace trap.			*/
272211751Srpaulo#define	TRAP_DTRACE	3	/* DTrace induced trap.			*/
273151306Sdavidxu
274151306Sdavidxu/* codes for SIGCHLD */
275151306Sdavidxu#define CLD_EXITED	1	/* Child has exited			*/
276151306Sdavidxu#define CLD_KILLED	2	/* Child has terminated abnormally but	*/
277151306Sdavidxu				/* did not create a core file		*/
278151306Sdavidxu#define CLD_DUMPED	3	/* Child has terminated abnormally and	*/
279151306Sdavidxu				/* created a core file			*/
280151306Sdavidxu#define CLD_TRAPPED	4	/* Traced child has trapped		*/
281151306Sdavidxu#define CLD_STOPPED	5	/* Child has stopped			*/
282151306Sdavidxu#define CLD_CONTINUED	6	/* Stopped child has continued		*/
283151306Sdavidxu
284151306Sdavidxu/* codes for SIGPOLL */
285151306Sdavidxu#define POLL_IN		1	/* Data input available			*/
286151306Sdavidxu#define POLL_OUT	2	/* Output buffers available		*/
287151306Sdavidxu#define POLL_MSG	3	/* Input message available		*/
288151306Sdavidxu#define POLL_ERR	4	/* I/O Error				*/
289151306Sdavidxu#define POLL_PRI	5	/* High priority input available	*/
290215183Sjilles#define POLL_HUP	6	/* Device disconnected			*/
291151306Sdavidxu
292105015Smike#endif
29348621Scracauer
294105106Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
29551942Smarcelstruct __siginfo;
29651942Smarcel
2971541Srgrimes/*
2981541Srgrimes * Signal vector "template" used in sigaction call.
2991541Srgrimes */
30083045Sobrienstruct sigaction {
30148621Scracauer	union {
30292719Salfred		void    (*__sa_handler)(int);
30392719Salfred		void    (*__sa_sigaction)(int, struct __siginfo *, void *);
30448621Scracauer	} __sigaction_u;		/* signal handler */
30551942Smarcel	int	sa_flags;		/* see signal options below */
30651942Smarcel	sigset_t sa_mask;		/* signal mask to apply */
3071541Srgrimes};
308108382Smike
309108382Smike#define	sa_handler	__sigaction_u.__sa_handler
310105015Smike#endif
31151791Smarcel
312105015Smike#if __XSI_VISIBLE
313108402Smike/* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */
314105015Smike#define	sa_sigaction	__sigaction_u.__sa_sigaction
315105015Smike#endif
31651791Smarcel
317105015Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
318105109Smike#define	SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */
319105015Smike#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */
32051791Smarcel
321105015Smike#if __XSI_VISIBLE
322105109Smike#define	SA_ONSTACK	0x0001	/* take signal on signal stack */
323105109Smike#define	SA_RESTART	0x0002	/* restart system call on signal return */
32414331Speter#define	SA_RESETHAND	0x0004	/* reset to SIG_DFL when taking signal */
32514331Speter#define	SA_NODEFER	0x0010	/* don't mask the signal we're delivering */
32629340Sjoerg#define	SA_NOCLDWAIT	0x0020	/* don't keep zombies around */
32748621Scracauer#define	SA_SIGINFO	0x0040	/* signal handler with SA_SIGINFO args */
328105015Smike#endif
3291541Srgrimes
330105015Smike#if __BSD_VISIBLE
331105109Smike#define	NSIG		32	/* number of old signals (counting 0) */
332105015Smike#endif
3331541Srgrimes
334105015Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
335153228Sdavidxu#define	SI_NOINFO	0		/* No signal info besides si_signo. */
336151306Sdavidxu#define	SI_USER		0x10001		/* Signal sent by kill(). */
337151306Sdavidxu#define	SI_QUEUE	0x10002		/* Signal sent by the sigqueue(). */
338151306Sdavidxu#define	SI_TIMER	0x10003		/* Signal generated by expiration of */
339151306Sdavidxu					/* a timer set by timer_settime(). */
340151306Sdavidxu#define	SI_ASYNCIO	0x10004		/* Signal generated by completion of */
341151306Sdavidxu					/* an asynchronous I/O request.*/
342151306Sdavidxu#define	SI_MESGQ	0x10005		/* Signal generated by arrival of a */
343151306Sdavidxu					/* message on an empty message queue. */
344199355Skib#define	SI_KERNEL	0x10006
345211732Sdavidxu#define	SI_LWP		0x10007		/* Signal sent by thr_kill */
346105015Smike#endif
347105015Smike#if __BSD_VISIBLE
348105109Smike#define	SI_UNDEFINED	0
349105015Smike#endif
35051791Smarcel
351105106Smike#if __BSD_VISIBLE
3529343Sbdetypedef	__sighandler_t	*sig_t;	/* type of pointer to a signal function */
353105106Smiketypedef	void __siginfohandler_t(int, struct __siginfo *, void *);
354105106Smike#endif
3551541Srgrimes
356105015Smike#if __XSI_VISIBLE
3571541Srgrimes/*
35851942Smarcel * Structure used in sigaltstack call.
3591541Srgrimes */
360105015Smike#if __BSD_VISIBLE
361105015Smiketypedef	struct sigaltstack {
362105015Smike#else
363105015Smiketypedef	struct {
364105015Smike#endif
36551942Smarcel	char	*ss_sp;			/* signal stack base */
366105015Smike	__size_t ss_size;		/* signal stack length */
36751942Smarcel	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
36851791Smarcel} stack_t;
36951791Smarcel
37014331Speter#define	SS_ONSTACK	0x0001	/* take signal on alternate stack */
37114331Speter#define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */
372149337Sstefanf#define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */
3731541Srgrimes#define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */
374105015Smike#endif
3751541Srgrimes
376105015Smike#if __BSD_VISIBLE
37751791Smarcel/*
3781541Srgrimes * 4.3 compatibility:
3791541Srgrimes * Signal vector "template" used in sigvec call.
3801541Srgrimes */
38183045Sobrienstruct sigvec {
38251942Smarcel	__sighandler_t *sv_handler;	/* signal handler */
38351942Smarcel	int	sv_mask;		/* signal mask to apply */
38451942Smarcel	int	sv_flags;		/* see signal options below */
3851541Srgrimes};
3861541Srgrimes
387105109Smike#define	SV_ONSTACK	SA_ONSTACK
388105109Smike#define	SV_INTERRUPT	SA_RESTART	/* same bit, opposite sense */
389105109Smike#define	SV_RESETHAND	SA_RESETHAND
390105109Smike#define	SV_NODEFER	SA_NODEFER
391105109Smike#define	SV_NOCLDSTOP	SA_NOCLDSTOP
392105109Smike#define	SV_SIGINFO	SA_SIGINFO
393105109Smike#define	sv_onstack	sv_flags	/* isn't compatibility wonderful! */
394105015Smike#endif
3951541Srgrimes
396105950Speter/* Keep this in one place only */
397105950Speter#if defined(_KERNEL) && defined(COMPAT_43) && \
398158471Sjhb    !defined(__i386__)
399105950Speterstruct osigcontext {
400105950Speter	int _not_used;
401105950Speter};
402105950Speter#endif
403105950Speter
404105015Smike#if __XSI_VISIBLE
4051541Srgrimes/*
4061541Srgrimes * Structure used in sigstack call.
4071541Srgrimes */
40883045Sobrienstruct sigstack {
409105015Smike	/* XXX ss_sp's type should be `void *'. */
41051942Smarcel	char	*ss_sp;			/* signal stack pointer */
41151942Smarcel	int	ss_onstack;		/* current status */
4121541Srgrimes};
413105015Smike#endif
4141541Srgrimes
415105015Smike#if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112
4161541Srgrimes/*
4171541Srgrimes * Macro for converting signal number to a mask suitable for
4181541Srgrimes * sigblock().
4191541Srgrimes */
420105109Smike#define	sigmask(m)	(1 << ((m)-1))
421105015Smike#endif
4221541Srgrimes
423105015Smike#if __BSD_VISIBLE
4241541Srgrimes#define	BADSIG		SIG_ERR
425105015Smike#endif
4261541Srgrimes
427105015Smike#if __POSIX_VISIBLE || __XSI_VISIBLE
42851791Smarcel/*
42951791Smarcel * Flags for sigprocmask:
43051791Smarcel */
43151791Smarcel#define	SIG_BLOCK	1	/* block specified signal set */
43251791Smarcel#define	SIG_UNBLOCK	2	/* unblock specified signal set */
43351791Smarcel#define	SIG_SETMASK	3	/* set specified signal set */
434105015Smike#endif
43534925Sdufault
4361541Srgrimes/*
4371541Srgrimes * For historical reasons; programs expect signal's return value to be
4381541Srgrimes * defined by <sys/signal.h>.
4391541Srgrimes */
4401541Srgrimes__BEGIN_DECLS
44192719Salfred__sighandler_t *signal(int, __sighandler_t *);
4421541Srgrimes__END_DECLS
4439343Sbde
444105109Smike#endif /* !_SYS_SIGNAL_H_ */
445