xref: /illumos-gate/usr/src/uts/common/sys/signal.h (revision 7c478bd95313f5f23a4c958a745db2134aa0324)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifndef _SYS_SIGNAL_H
41*7c478bd9Sstevel@tonic-gate #define	_SYS_SIGNAL_H
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
46*7c478bd9Sstevel@tonic-gate #include <sys/iso/signal_iso.h>
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
49*7c478bd9Sstevel@tonic-gate extern "C" {
50*7c478bd9Sstevel@tonic-gate #endif
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || !defined(_STRICT_STDC) || \
53*7c478bd9Sstevel@tonic-gate 	defined(__XOPEN_OR_POSIX)
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
56*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
57*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
58*7c478bd9Sstevel@tonic-gate /*
59*7c478bd9Sstevel@tonic-gate  * We need <sys/siginfo.h> for the declaration of siginfo_t.
60*7c478bd9Sstevel@tonic-gate  */
61*7c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
62*7c478bd9Sstevel@tonic-gate #endif
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate /* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements */
65*7c478bd9Sstevel@tonic-gate #ifndef	_SIGSET_T
66*7c478bd9Sstevel@tonic-gate #define	_SIGSET_T
67*7c478bd9Sstevel@tonic-gate typedef struct {		/* signal set type */
68*7c478bd9Sstevel@tonic-gate 	unsigned int	__sigbits[4];
69*7c478bd9Sstevel@tonic-gate } sigset_t;
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate /* Kernel view of the ILP32 user sigset_t structure */
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate typedef struct {
76*7c478bd9Sstevel@tonic-gate 	uint32_t	__sigbits[4];
77*7c478bd9Sstevel@tonic-gate } sigset32_t;
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #endif	/* _SIGSET_T */
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate typedef	struct {
84*7c478bd9Sstevel@tonic-gate 	unsigned int	__sigbits[2];
85*7c478bd9Sstevel@tonic-gate } k_sigset_t;
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate /*
88*7c478bd9Sstevel@tonic-gate  * The signal handler routine can have either one or three arguments.
89*7c478bd9Sstevel@tonic-gate  * Existing C code has used either form so not specifing the arguments
90*7c478bd9Sstevel@tonic-gate  * neatly finesses the problem.  C++ doesn't accept this.  To C++
91*7c478bd9Sstevel@tonic-gate  * "(*sa_handler)()" indicates a routine with no arguments (ANSI C would
92*7c478bd9Sstevel@tonic-gate  * specify this as "(*sa_handler)(void)").  One or the other form must be
93*7c478bd9Sstevel@tonic-gate  * used for C++ and the only logical choice is "(*sa_handler)(int)" to allow
94*7c478bd9Sstevel@tonic-gate  * the SIG_* defines to work.  "(*sa_sigaction)(int, siginfo_t *, void *)"
95*7c478bd9Sstevel@tonic-gate  * can be used for the three argument form.
96*7c478bd9Sstevel@tonic-gate  */
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate /*
99*7c478bd9Sstevel@tonic-gate  * Note: storage overlap by sa_handler and sa_sigaction
100*7c478bd9Sstevel@tonic-gate  */
101*7c478bd9Sstevel@tonic-gate struct sigaction {
102*7c478bd9Sstevel@tonic-gate 	int sa_flags;
103*7c478bd9Sstevel@tonic-gate 	union {
104*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
105*7c478bd9Sstevel@tonic-gate 		void (*_handler)(int);
106*7c478bd9Sstevel@tonic-gate #else
107*7c478bd9Sstevel@tonic-gate 		void (*_handler)();
108*7c478bd9Sstevel@tonic-gate #endif
109*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
110*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
111*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
112*7c478bd9Sstevel@tonic-gate 		void (*_sigaction)(int, siginfo_t *, void *);
113*7c478bd9Sstevel@tonic-gate #endif
114*7c478bd9Sstevel@tonic-gate 	}	_funcptr;
115*7c478bd9Sstevel@tonic-gate 	sigset_t sa_mask;
116*7c478bd9Sstevel@tonic-gate #ifndef _LP64
117*7c478bd9Sstevel@tonic-gate 	int sa_resv[2];
118*7c478bd9Sstevel@tonic-gate #endif
119*7c478bd9Sstevel@tonic-gate };
120*7c478bd9Sstevel@tonic-gate #define	sa_handler	_funcptr._handler
121*7c478bd9Sstevel@tonic-gate #define	sa_sigaction	_funcptr._sigaction
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate /* Kernel view of the ILP32 user sigaction structure */
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate struct sigaction32 {
128*7c478bd9Sstevel@tonic-gate 	int32_t		sa_flags;
129*7c478bd9Sstevel@tonic-gate 	union {
130*7c478bd9Sstevel@tonic-gate 		caddr32_t	_handler;
131*7c478bd9Sstevel@tonic-gate 		caddr32_t	_sigaction;
132*7c478bd9Sstevel@tonic-gate 	}	_funcptr;
133*7c478bd9Sstevel@tonic-gate 	sigset32_t	sa_mask;
134*7c478bd9Sstevel@tonic-gate 	int32_t		sa_resv[2];
135*7c478bd9Sstevel@tonic-gate };
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
140*7c478bd9Sstevel@tonic-gate #define	SA_NOCLDSTOP	0x00020000	/* don't send job control SIGCLD's */
141*7c478bd9Sstevel@tonic-gate #endif
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
144*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
145*7c478bd9Sstevel@tonic-gate 	defined(_XPG4_2)
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate 			/* non-conformant ANSI compilation	*/
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate /* definitions for the sa_flags field */
150*7c478bd9Sstevel@tonic-gate #define	SA_ONSTACK	0x00000001
151*7c478bd9Sstevel@tonic-gate #define	SA_RESETHAND	0x00000002
152*7c478bd9Sstevel@tonic-gate #define	SA_RESTART	0x00000004
153*7c478bd9Sstevel@tonic-gate #endif
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
156*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
157*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
158*7c478bd9Sstevel@tonic-gate #define	SA_SIGINFO	0x00000008
159*7c478bd9Sstevel@tonic-gate #endif
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
162*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
163*7c478bd9Sstevel@tonic-gate 	defined(_XPG4_2)
164*7c478bd9Sstevel@tonic-gate #define	SA_NODEFER	0x00000010
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
167*7c478bd9Sstevel@tonic-gate #define	SA_NOCLDWAIT	0x00010000	/* don't save zombie children	 */
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_XPG4_2)
170*7c478bd9Sstevel@tonic-gate /*
171*7c478bd9Sstevel@tonic-gate  * use of these symbols by applications is injurious
172*7c478bd9Sstevel@tonic-gate  *	to binary compatibility
173*7c478bd9Sstevel@tonic-gate  */
174*7c478bd9Sstevel@tonic-gate #define	NSIG	49	/* valid signals range from 1 to NSIG-1 */
175*7c478bd9Sstevel@tonic-gate #define	MAXSIG	48	/* size of u_signal[], NSIG-1 <= MAXSIG */
176*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_XPG4_2) */
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate #define	MINSIGSTKSZ	2048
179*7c478bd9Sstevel@tonic-gate #define	SIGSTKSZ	8192
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate #define	SS_ONSTACK	0x00000001
182*7c478bd9Sstevel@tonic-gate #define	SS_DISABLE	0x00000002
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate /* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements. */
185*7c478bd9Sstevel@tonic-gate #ifndef	_STACK_T
186*7c478bd9Sstevel@tonic-gate #define	_STACK_T
187*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_XPG4_2)
188*7c478bd9Sstevel@tonic-gate typedef struct sigaltstack {
189*7c478bd9Sstevel@tonic-gate #else
190*7c478bd9Sstevel@tonic-gate typedef struct {
191*7c478bd9Sstevel@tonic-gate #endif
192*7c478bd9Sstevel@tonic-gate 	void	*ss_sp;
193*7c478bd9Sstevel@tonic-gate 	size_t	ss_size;
194*7c478bd9Sstevel@tonic-gate 	int	ss_flags;
195*7c478bd9Sstevel@tonic-gate } stack_t;
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate /* Kernel view of the ILP32 user sigaltstack structure */
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate typedef struct sigaltstack32 {
202*7c478bd9Sstevel@tonic-gate 	caddr32_t	ss_sp;
203*7c478bd9Sstevel@tonic-gate 	size32_t	ss_size;
204*7c478bd9Sstevel@tonic-gate 	int32_t		ss_flags;
205*7c478bd9Sstevel@tonic-gate } stack32_t;
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate #endif /* _STACK_T */
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
214*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate /* signotify id used only by librt for mq_notify()/aio_notify() */
217*7c478bd9Sstevel@tonic-gate typedef struct signotify_id {		/* signotify id struct		*/
218*7c478bd9Sstevel@tonic-gate 	pid_t	sn_pid;			/* pid of proc to be notified	*/
219*7c478bd9Sstevel@tonic-gate 	int	sn_index;		/* index in preallocated pool	*/
220*7c478bd9Sstevel@tonic-gate 	int	sn_pad;			/* reserved			*/
221*7c478bd9Sstevel@tonic-gate } signotify_id_t;
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
224*7c478bd9Sstevel@tonic-gate 
225*7c478bd9Sstevel@tonic-gate /* Kernel view of the ILP32 user signotify_id structure */
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate typedef struct signotify32_id {
228*7c478bd9Sstevel@tonic-gate 	pid32_t	sn_pid;			/* pid of proc to be notified */
229*7c478bd9Sstevel@tonic-gate 	int32_t	sn_index;		/* index in preallocated pool */
230*7c478bd9Sstevel@tonic-gate 	int32_t	sn_pad;			/* reserved */
231*7c478bd9Sstevel@tonic-gate } signotify32_id_t;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
234*7c478bd9Sstevel@tonic-gate 
235*7c478bd9Sstevel@tonic-gate /* Command codes for sig_notify call */
236*7c478bd9Sstevel@tonic-gate 
237*7c478bd9Sstevel@tonic-gate #define	SN_PROC		1		/* queue signotify for process	*/
238*7c478bd9Sstevel@tonic-gate #define	SN_CANCEL	2		/* cancel the queued signotify	*/
239*7c478bd9Sstevel@tonic-gate #define	SN_SEND		3		/* send the notified signal	*/
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate /* Added as per XPG4v2 */
244*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
245*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
246*7c478bd9Sstevel@tonic-gate 	defined(_XPG4_2)
247*7c478bd9Sstevel@tonic-gate struct sigstack {
248*7c478bd9Sstevel@tonic-gate 	void	*ss_sp;
249*7c478bd9Sstevel@tonic-gate 	int	ss_onstack;
250*7c478bd9Sstevel@tonic-gate };
251*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate /*
254*7c478bd9Sstevel@tonic-gate  * For definition of ucontext_t; must follow struct definition
255*7c478bd9Sstevel@tonic-gate  * for  sigset_t
256*7c478bd9Sstevel@tonic-gate  */
257*7c478bd9Sstevel@tonic-gate #if defined(_XPG4_2)
258*7c478bd9Sstevel@tonic-gate #include <sys/ucontext.h>
259*7c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) */
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL
262*7c478bd9Sstevel@tonic-gate #include <sys/t_lock.h>
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate extern k_sigset_t
265*7c478bd9Sstevel@tonic-gate 	nullsmask,		/* a null signal mask */
266*7c478bd9Sstevel@tonic-gate 	fillset,		/* valid signals, guaranteed contiguous */
267*7c478bd9Sstevel@tonic-gate 	holdvfork,		/* held while doing vfork */
268*7c478bd9Sstevel@tonic-gate 	cantmask,		/* cannot be caught or ignored */
269*7c478bd9Sstevel@tonic-gate 	cantreset,		/* cannot be reset after catching */
270*7c478bd9Sstevel@tonic-gate 	ignoredefault,		/* ignored by default */
271*7c478bd9Sstevel@tonic-gate 	stopdefault,		/* stop by default */
272*7c478bd9Sstevel@tonic-gate 	coredefault;		/* dumps core by default */
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate #define	sigmask(n)		((unsigned int)1 << (((n) - 1) & (32 - 1)))
275*7c478bd9Sstevel@tonic-gate #define	sigword(n)		(((unsigned int)((n) - 1))>>5)
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate #if	((MAXSIG > 32) && (MAXSIG <= 64))
278*7c478bd9Sstevel@tonic-gate #define	FILLSET0	0xffffffffu
279*7c478bd9Sstevel@tonic-gate #define	FILLSET1	((1u << (MAXSIG - 32)) - 1)
280*7c478bd9Sstevel@tonic-gate #else
281*7c478bd9Sstevel@tonic-gate #error "fix me: MAXSIG out of bounds"
282*7c478bd9Sstevel@tonic-gate #endif
283*7c478bd9Sstevel@tonic-gate 
284*7c478bd9Sstevel@tonic-gate #define	CANTMASK0	(sigmask(SIGKILL)|sigmask(SIGSTOP))
285*7c478bd9Sstevel@tonic-gate #define	CANTMASK1	0
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate #define	sigemptyset(s)		(*(s) = nullsmask)
288*7c478bd9Sstevel@tonic-gate #define	sigfillset(s)		(*(s) = fillset)
289*7c478bd9Sstevel@tonic-gate #define	sigaddset(s, n)		((s)->__sigbits[sigword(n)] |= sigmask(n))
290*7c478bd9Sstevel@tonic-gate #define	sigdelset(s, n)		((s)->__sigbits[sigword(n)] &= ~sigmask(n))
291*7c478bd9Sstevel@tonic-gate #define	sigismember(s, n)	(sigmask(n) & (s)->__sigbits[sigword(n)])
292*7c478bd9Sstevel@tonic-gate #define	sigisempty(s)		(!(((s)->__sigbits[0]) | ((s)->__sigbits[1])))
293*7c478bd9Sstevel@tonic-gate #define	sigutok(us, ks)		\
294*7c478bd9Sstevel@tonic-gate 	((ks)->__sigbits[0] = (us)->__sigbits[0] & (FILLSET0 & ~CANTMASK0), \
295*7c478bd9Sstevel@tonic-gate 	    (ks)->__sigbits[1] = (us)->__sigbits[1] & (FILLSET1 & ~CANTMASK1))
296*7c478bd9Sstevel@tonic-gate #define	sigktou(ks, us)		((us)->__sigbits[0] = (ks)->__sigbits[0], \
297*7c478bd9Sstevel@tonic-gate 				    (us)->__sigbits[1] = (ks)->__sigbits[1], \
298*7c478bd9Sstevel@tonic-gate 				    (us)->__sigbits[2] = 0, \
299*7c478bd9Sstevel@tonic-gate 				    (us)->__sigbits[3] = 0)
300*7c478bd9Sstevel@tonic-gate typedef struct {
301*7c478bd9Sstevel@tonic-gate 	int	sig;				/* signal no.		*/
302*7c478bd9Sstevel@tonic-gate 	int	perm;				/* flag for EPERM	*/
303*7c478bd9Sstevel@tonic-gate 	int	checkperm;			/* check perm or not	*/
304*7c478bd9Sstevel@tonic-gate 	int	sicode;				/* has siginfo.si_code	*/
305*7c478bd9Sstevel@tonic-gate 	union sigval value;			/* user specified value	*/
306*7c478bd9Sstevel@tonic-gate } sigsend_t;
307*7c478bd9Sstevel@tonic-gate 
308*7c478bd9Sstevel@tonic-gate typedef struct {
309*7c478bd9Sstevel@tonic-gate 	sigqueue_t	sn_sigq;	/* sigq struct for notification */
310*7c478bd9Sstevel@tonic-gate 	u_longlong_t	sn_snid;	/* unique id for notification	*/
311*7c478bd9Sstevel@tonic-gate } signotifyq_t;
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate typedef struct sigqhdr {		/* sigqueue pool header		*/
315*7c478bd9Sstevel@tonic-gate 	sigqueue_t	*sqb_free;	/* free sigq struct list	*/
316*7c478bd9Sstevel@tonic-gate 	uchar_t		sqb_count;	/* sigq free count		*/
317*7c478bd9Sstevel@tonic-gate 	uchar_t		sqb_maxcount;	/* sigq max free count		*/
318*7c478bd9Sstevel@tonic-gate 	ushort_t	sqb_size;	/* size of header+free structs	*/
319*7c478bd9Sstevel@tonic-gate 	uchar_t		sqb_pexited;	/* process has exited		*/
320*7c478bd9Sstevel@tonic-gate 	uchar_t		sqb_sent;	/* number of sigq sent		*/
321*7c478bd9Sstevel@tonic-gate 	kmutex_t	sqb_lock;	/* lock for sigq pool		*/
322*7c478bd9Sstevel@tonic-gate } sigqhdr_t;
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate #define	_SIGQUEUE_MAX	32
325*7c478bd9Sstevel@tonic-gate #define	_SIGNOTIFY_MAX	32
326*7c478bd9Sstevel@tonic-gate 
327*7c478bd9Sstevel@tonic-gate extern	void	setsigact(int, void (*)(int), k_sigset_t, int);
328*7c478bd9Sstevel@tonic-gate extern	void	sigorset(k_sigset_t *, k_sigset_t *);
329*7c478bd9Sstevel@tonic-gate extern	void	sigandset(k_sigset_t *, k_sigset_t *);
330*7c478bd9Sstevel@tonic-gate extern	void	sigdiffset(k_sigset_t *, k_sigset_t *);
331*7c478bd9Sstevel@tonic-gate extern	void	sigintr(k_sigset_t *, int);
332*7c478bd9Sstevel@tonic-gate extern	void	sigunintr(k_sigset_t *);
333*7c478bd9Sstevel@tonic-gate extern	void	sigreplace(k_sigset_t *, k_sigset_t *);
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate extern	int	kill(pid_t, int);
336*7c478bd9Sstevel@tonic-gate 
337*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
338*7c478bd9Sstevel@tonic-gate 
339*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
340*7c478bd9Sstevel@tonic-gate }
341*7c478bd9Sstevel@tonic-gate #endif
342*7c478bd9Sstevel@tonic-gate 
343*7c478bd9Sstevel@tonic-gate #endif /* _SYS_SIGNAL_H */
344