xref: /illumos-gate/usr/src/uts/common/sys/siginfo.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 #ifndef _SYS_SIGINFO_H
31*7c478bd9Sstevel@tonic-gate #define	_SYS_SIGINFO_H
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
39*7c478bd9Sstevel@tonic-gate extern "C" {
40*7c478bd9Sstevel@tonic-gate #endif
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
43*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate /*
46*7c478bd9Sstevel@tonic-gate  * The union sigval is also defined in <time.h> as per X/Open and
47*7c478bd9Sstevel@tonic-gate  * POSIX requirements.
48*7c478bd9Sstevel@tonic-gate  */
49*7c478bd9Sstevel@tonic-gate #ifndef	_SIGVAL
50*7c478bd9Sstevel@tonic-gate #define	_SIGVAL
51*7c478bd9Sstevel@tonic-gate union sigval {
52*7c478bd9Sstevel@tonic-gate 	int	sival_int;	/* integer value */
53*7c478bd9Sstevel@tonic-gate 	void	*sival_ptr;	/* pointer value */
54*7c478bd9Sstevel@tonic-gate };
55*7c478bd9Sstevel@tonic-gate #endif /* _SIGVAL */
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate /* Kernel view of user ILP32 sigval */
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate union sigval32 {
62*7c478bd9Sstevel@tonic-gate 	int32_t	sival_int;	/* integer value */
63*7c478bd9Sstevel@tonic-gate 	caddr32_t sival_ptr;	/* pointer value */
64*7c478bd9Sstevel@tonic-gate };
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #else 				/* needed in siginfo_t structure */
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate union __sigval {
71*7c478bd9Sstevel@tonic-gate 	int	__sival_int;	/* integer value */
72*7c478bd9Sstevel@tonic-gate 	void	*__sival_ptr;	/* pointer value */
73*7c478bd9Sstevel@tonic-gate };
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
78*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * The sigevent structure is also defined in <time.h> as per X/Open and
82*7c478bd9Sstevel@tonic-gate  * POSIX requirements.
83*7c478bd9Sstevel@tonic-gate  */
84*7c478bd9Sstevel@tonic-gate #ifndef	_SIGEVENT
85*7c478bd9Sstevel@tonic-gate #define	_SIGEVENT
86*7c478bd9Sstevel@tonic-gate struct sigevent {
87*7c478bd9Sstevel@tonic-gate 	int		sigev_notify;	/* notification mode */
88*7c478bd9Sstevel@tonic-gate 	int		sigev_signo;	/* signal number */
89*7c478bd9Sstevel@tonic-gate 	union sigval	sigev_value;	/* signal value */
90*7c478bd9Sstevel@tonic-gate 	void		(*sigev_notify_function)(union sigval);
91*7c478bd9Sstevel@tonic-gate 	pthread_attr_t	*sigev_notify_attributes;
92*7c478bd9Sstevel@tonic-gate 	int		__sigev_pad2;
93*7c478bd9Sstevel@tonic-gate };
94*7c478bd9Sstevel@tonic-gate #endif	/* _SIGEVENT */
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /* values of sigev_notify */
97*7c478bd9Sstevel@tonic-gate #define	SIGEV_NONE	1		/* no notification */
98*7c478bd9Sstevel@tonic-gate #define	SIGEV_SIGNAL	2		/* queued signal notification */
99*7c478bd9Sstevel@tonic-gate #define	SIGEV_THREAD	3		/* call back from another thread */
100*7c478bd9Sstevel@tonic-gate #define	SIGEV_PORT	4		/* use event port for notification */
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /* Kernel view of user ILP32 sigevent */
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate struct sigevent32 {
107*7c478bd9Sstevel@tonic-gate 	int32_t		sigev_notify;	/* notification mode */
108*7c478bd9Sstevel@tonic-gate 	int32_t		sigev_signo;	/* signal number */
109*7c478bd9Sstevel@tonic-gate 	union sigval32	sigev_value;	/* signal value */
110*7c478bd9Sstevel@tonic-gate 	caddr32_t	sigev_notify_function;
111*7c478bd9Sstevel@tonic-gate 	caddr32_t	sigev_notify_attributes;
112*7c478bd9Sstevel@tonic-gate 	int32_t		__sigev_pad2;
113*7c478bd9Sstevel@tonic-gate };
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
120*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
121*7c478bd9Sstevel@tonic-gate /*
122*7c478bd9Sstevel@tonic-gate  * negative signal codes are reserved for future use for user generated
123*7c478bd9Sstevel@tonic-gate  * signals
124*7c478bd9Sstevel@tonic-gate  */
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #define	SI_FROMUSER(sip)	((sip)->si_code <= 0)
127*7c478bd9Sstevel@tonic-gate #define	SI_FROMKERNEL(sip)	((sip)->si_code > 0)
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	SI_NOINFO	32767	/* no signal information */
130*7c478bd9Sstevel@tonic-gate #define	SI_DTRACE	2050	/* kernel generated signal via DTrace action */
131*7c478bd9Sstevel@tonic-gate #define	SI_RCTL		2049	/* kernel generated signal via rctl action */
132*7c478bd9Sstevel@tonic-gate #define	SI_USER		0	/* user generated signal via kill() */
133*7c478bd9Sstevel@tonic-gate #define	SI_LWP		(-1)	/* user generated signal via lwp_kill() */
134*7c478bd9Sstevel@tonic-gate #define	SI_QUEUE	(-2)	/* user generated signal via sigqueue() */
135*7c478bd9Sstevel@tonic-gate #define	SI_TIMER	(-3)	/* from timer expiration */
136*7c478bd9Sstevel@tonic-gate #define	SI_ASYNCIO	(-4)	/* from asynchronous I/O completion */
137*7c478bd9Sstevel@tonic-gate #define	SI_MESGQ	(-5)	/* from message arrival */
138*7c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || defined(_XPG4_2) || defined(__EXTENSIONS__)
141*7c478bd9Sstevel@tonic-gate /*
142*7c478bd9Sstevel@tonic-gate  * Get the machine dependent signal codes (SIGILL, SIGFPE, SIGSEGV, and
143*7c478bd9Sstevel@tonic-gate  * SIGBUS) from <sys/machsig.h>
144*7c478bd9Sstevel@tonic-gate  */
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #include <sys/machsig.h>
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate /*
149*7c478bd9Sstevel@tonic-gate  * SIGTRAP signal codes
150*7c478bd9Sstevel@tonic-gate  */
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate #define	TRAP_BRKPT	1	/* breakpoint trap */
153*7c478bd9Sstevel@tonic-gate #define	TRAP_TRACE	2	/* trace trap */
154*7c478bd9Sstevel@tonic-gate #define	TRAP_RWATCH	3	/* read access watchpoint trap */
155*7c478bd9Sstevel@tonic-gate #define	TRAP_WWATCH	4	/* write access watchpoint trap */
156*7c478bd9Sstevel@tonic-gate #define	TRAP_XWATCH	5	/* execute access watchpoint trap */
157*7c478bd9Sstevel@tonic-gate #define	TRAP_DTRACE	6	/* problem with fasttrap DTrace provider */
158*7c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
159*7c478bd9Sstevel@tonic-gate #define	NSIGTRAP	6
160*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /*
163*7c478bd9Sstevel@tonic-gate  * SIGCLD signal codes
164*7c478bd9Sstevel@tonic-gate  */
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate #define	CLD_EXITED	1	/* child has exited */
167*7c478bd9Sstevel@tonic-gate #define	CLD_KILLED	2	/* child was killed */
168*7c478bd9Sstevel@tonic-gate #define	CLD_DUMPED	3	/* child has coredumped */
169*7c478bd9Sstevel@tonic-gate #define	CLD_TRAPPED	4	/* traced child has stopped */
170*7c478bd9Sstevel@tonic-gate #define	CLD_STOPPED	5	/* child has stopped on signal */
171*7c478bd9Sstevel@tonic-gate #define	CLD_CONTINUED	6	/* stopped child has continued */
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
174*7c478bd9Sstevel@tonic-gate #define	NSIGCLD		6
175*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate /*
178*7c478bd9Sstevel@tonic-gate  * SIGPOLL signal codes
179*7c478bd9Sstevel@tonic-gate  */
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate #define	POLL_IN		1	/* input available */
182*7c478bd9Sstevel@tonic-gate #define	POLL_OUT	2	/* output possible */
183*7c478bd9Sstevel@tonic-gate #define	POLL_MSG	3	/* message available */
184*7c478bd9Sstevel@tonic-gate #define	POLL_ERR	4	/* I/O error */
185*7c478bd9Sstevel@tonic-gate #define	POLL_PRI	5	/* high priority input available */
186*7c478bd9Sstevel@tonic-gate #define	POLL_HUP	6	/* device disconnected */
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
189*7c478bd9Sstevel@tonic-gate #define	NSIGPOLL	6
190*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || defined(_XPG4_2) ... */
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
195*7c478bd9Sstevel@tonic-gate /*
196*7c478bd9Sstevel@tonic-gate  * SIGPROF signal codes
197*7c478bd9Sstevel@tonic-gate  */
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate #define	PROF_SIG	1	/* have to set code non-zero */
200*7c478bd9Sstevel@tonic-gate #define	NSIGPROF	1
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined (__EXTENSIONS__) */
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
205*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #ifdef _LP64
208*7c478bd9Sstevel@tonic-gate #define	SI_MAXSZ	256
209*7c478bd9Sstevel@tonic-gate #define	SI_PAD		((SI_MAXSZ / sizeof (int)) - 4)
210*7c478bd9Sstevel@tonic-gate #else
211*7c478bd9Sstevel@tonic-gate #define	SI_MAXSZ	128
212*7c478bd9Sstevel@tonic-gate #define	SI_PAD		((SI_MAXSZ / sizeof (int)) - 3)
213*7c478bd9Sstevel@tonic-gate #endif
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate /*
216*7c478bd9Sstevel@tonic-gate  * Inclusion of <sys/time_impl.h> is needed for the declaration of
217*7c478bd9Sstevel@tonic-gate  * timestruc_t.  However, since inclusion of <sys/time_impl.h> results
218*7c478bd9Sstevel@tonic-gate  * in X/Open and POSIX namespace pollution, the definition for
219*7c478bd9Sstevel@tonic-gate  * timestruct_t has been duplicated in a standards namespace safe header
220*7c478bd9Sstevel@tonic-gate  * <sys/time_std_impl.h>.  In <sys/time_std_impl.h>, the structure
221*7c478bd9Sstevel@tonic-gate  * name, tag, and member names, as well as the type itself, all have
222*7c478bd9Sstevel@tonic-gate  * leading underscores to protect namespace.
223*7c478bd9Sstevel@tonic-gate  */
224*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
225*7c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
226*7c478bd9Sstevel@tonic-gate #else
227*7c478bd9Sstevel@tonic-gate #include <sys/time_std_impl.h>
228*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate /*
231*7c478bd9Sstevel@tonic-gate  * The inclusion of <sys/types.h> is needed for definitions of pid_t, etc.
232*7c478bd9Sstevel@tonic-gate  * Placement here is due to a dependency in <sys/select.h> which is included
233*7c478bd9Sstevel@tonic-gate  * by <sys/types.h> for the sigevent structure.  Hence this inclusion must
234*7c478bd9Sstevel@tonic-gate  * follow that definition.
235*7c478bd9Sstevel@tonic-gate  */
236*7c478bd9Sstevel@tonic-gate #include <sys/types.h>		/* for definitions of pid_t, etc. */
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
239*7c478bd9Sstevel@tonic-gate typedef struct siginfo { 		/* pollutes POSIX/XOPEN namespace */
240*7c478bd9Sstevel@tonic-gate #else
241*7c478bd9Sstevel@tonic-gate typedef struct {
242*7c478bd9Sstevel@tonic-gate #endif
243*7c478bd9Sstevel@tonic-gate 	int	si_signo;			/* signal from signal.h	*/
244*7c478bd9Sstevel@tonic-gate 	int 	si_code;			/* code from above	*/
245*7c478bd9Sstevel@tonic-gate 	int	si_errno;			/* error from errno.h	*/
246*7c478bd9Sstevel@tonic-gate #ifdef _LP64
247*7c478bd9Sstevel@tonic-gate 	int	si_pad;		/* _LP64 union starts on an 8-byte boundary */
248*7c478bd9Sstevel@tonic-gate #endif
249*7c478bd9Sstevel@tonic-gate 	union {
250*7c478bd9Sstevel@tonic-gate 
251*7c478bd9Sstevel@tonic-gate 		int	__pad[SI_PAD];		/* for future growth	*/
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 		struct {			/* kill(), SIGCLD, siqqueue() */
254*7c478bd9Sstevel@tonic-gate 			pid_t	__pid;		/* process ID		*/
255*7c478bd9Sstevel@tonic-gate 			union {
256*7c478bd9Sstevel@tonic-gate 				struct {
257*7c478bd9Sstevel@tonic-gate 					uid_t	__uid;
258*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
259*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
260*7c478bd9Sstevel@tonic-gate 					union sigval	__value;
261*7c478bd9Sstevel@tonic-gate #else
262*7c478bd9Sstevel@tonic-gate 					union __sigval	__value;
263*7c478bd9Sstevel@tonic-gate #endif
264*7c478bd9Sstevel@tonic-gate 				} __kill;
265*7c478bd9Sstevel@tonic-gate 				struct {
266*7c478bd9Sstevel@tonic-gate 					clock_t __utime;
267*7c478bd9Sstevel@tonic-gate 					int	__status;
268*7c478bd9Sstevel@tonic-gate 					clock_t __stime;
269*7c478bd9Sstevel@tonic-gate 				} __cld;
270*7c478bd9Sstevel@tonic-gate 			} __pdata;
271*7c478bd9Sstevel@tonic-gate 			ctid_t	__ctid;		/* contract ID		*/
272*7c478bd9Sstevel@tonic-gate 			zoneid_t __zoneid;	/* zone ID		*/
273*7c478bd9Sstevel@tonic-gate 		} __proc;
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate 		struct {	/* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
276*7c478bd9Sstevel@tonic-gate 			void 	*__addr;	/* faulting address	*/
277*7c478bd9Sstevel@tonic-gate 			int	__trapno;	/* illegal trap number	*/
278*7c478bd9Sstevel@tonic-gate 			caddr_t	__pc;		/* instruction address	*/
279*7c478bd9Sstevel@tonic-gate 		} __fault;
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPOLL, SIGXFSZ	*/
282*7c478bd9Sstevel@tonic-gate 		/* fd not currently available for SIGPOLL */
283*7c478bd9Sstevel@tonic-gate 			int	__fd;		/* file descriptor	*/
284*7c478bd9Sstevel@tonic-gate 			long	__band;
285*7c478bd9Sstevel@tonic-gate 		} __file;
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPROF */
288*7c478bd9Sstevel@tonic-gate 			caddr_t	__faddr;	/* last fault address	*/
289*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
290*7c478bd9Sstevel@tonic-gate 			timestruc_t __tstamp;	/* real time stamp	*/
291*7c478bd9Sstevel@tonic-gate #else
292*7c478bd9Sstevel@tonic-gate 			_timestruc_t __tstamp;	/* real time stamp	*/
293*7c478bd9Sstevel@tonic-gate #endif
294*7c478bd9Sstevel@tonic-gate 			short	__syscall;	/* current syscall	*/
295*7c478bd9Sstevel@tonic-gate 			char	__nsysarg;	/* number of arguments	*/
296*7c478bd9Sstevel@tonic-gate 			char	__fault;	/* last fault type	*/
297*7c478bd9Sstevel@tonic-gate 			long	__sysarg[8];	/* syscall arguments	*/
298*7c478bd9Sstevel@tonic-gate 			int	__mstate[10];	/* see <sys/msacct.h>	*/
299*7c478bd9Sstevel@tonic-gate 		} __prof;
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate 		struct {			/* SI_RCTL */
302*7c478bd9Sstevel@tonic-gate 			int32_t	__entity;	/* type of entity exceeding */
303*7c478bd9Sstevel@tonic-gate 		} __rctl;
304*7c478bd9Sstevel@tonic-gate 	} __data;
305*7c478bd9Sstevel@tonic-gate 
306*7c478bd9Sstevel@tonic-gate } siginfo_t;
307*7c478bd9Sstevel@tonic-gate 
308*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate /* Kernel view of user ILP32 siginfo struct */
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate #define	SI32_MAXSZ	128
313*7c478bd9Sstevel@tonic-gate #define	SI32_PAD	((SI32_MAXSZ / sizeof (int32_t)) - 3)
314*7c478bd9Sstevel@tonic-gate 
315*7c478bd9Sstevel@tonic-gate typedef struct siginfo32 {
316*7c478bd9Sstevel@tonic-gate 
317*7c478bd9Sstevel@tonic-gate 	int32_t	si_signo;			/* signal from signal.h	*/
318*7c478bd9Sstevel@tonic-gate 	int32_t	si_code;			/* code from above	*/
319*7c478bd9Sstevel@tonic-gate 	int32_t	si_errno;			/* error from errno.h	*/
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate 	union {
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate 		int32_t	__pad[SI32_PAD];	/* for future growth	*/
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate 		struct {			/* kill(), SIGCLD, siqqueue() */
326*7c478bd9Sstevel@tonic-gate 			pid32_t	__pid;		/* process ID		*/
327*7c478bd9Sstevel@tonic-gate 			union {
328*7c478bd9Sstevel@tonic-gate 				struct {
329*7c478bd9Sstevel@tonic-gate 					uid32_t	__uid;
330*7c478bd9Sstevel@tonic-gate 					union sigval32	__value;
331*7c478bd9Sstevel@tonic-gate 				} __kill;
332*7c478bd9Sstevel@tonic-gate 				struct {
333*7c478bd9Sstevel@tonic-gate 					clock32_t __utime;
334*7c478bd9Sstevel@tonic-gate 					int32_t	__status;
335*7c478bd9Sstevel@tonic-gate 					clock32_t __stime;
336*7c478bd9Sstevel@tonic-gate 				} __cld;
337*7c478bd9Sstevel@tonic-gate 			} __pdata;
338*7c478bd9Sstevel@tonic-gate 			id32_t	__ctid;		/* contract ID		*/
339*7c478bd9Sstevel@tonic-gate 			id32_t __zoneid;	/* zone ID		*/
340*7c478bd9Sstevel@tonic-gate 		} __proc;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate 		struct {	/* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
343*7c478bd9Sstevel@tonic-gate 			caddr32_t __addr;	/* faulting address	*/
344*7c478bd9Sstevel@tonic-gate 			int32_t	__trapno;	/* illegal trap number	*/
345*7c478bd9Sstevel@tonic-gate 			caddr32_t __pc;		/* instruction address	*/
346*7c478bd9Sstevel@tonic-gate 		} __fault;
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPOLL, SIGXFSZ	*/
349*7c478bd9Sstevel@tonic-gate 		/* fd not currently available for SIGPOLL */
350*7c478bd9Sstevel@tonic-gate 			int32_t	__fd;		/* file descriptor	*/
351*7c478bd9Sstevel@tonic-gate 			int32_t	__band;
352*7c478bd9Sstevel@tonic-gate 		} __file;
353*7c478bd9Sstevel@tonic-gate 
354*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPROF */
355*7c478bd9Sstevel@tonic-gate 			caddr32_t __faddr;	/* last fault address	*/
356*7c478bd9Sstevel@tonic-gate 			timestruc32_t __tstamp; /* real time stamp	*/
357*7c478bd9Sstevel@tonic-gate 			int16_t	__syscall;	/* current syscall	*/
358*7c478bd9Sstevel@tonic-gate 			int8_t	__nsysarg;	/* number of arguments	*/
359*7c478bd9Sstevel@tonic-gate 			int8_t	__fault;	/* last fault type	*/
360*7c478bd9Sstevel@tonic-gate 			int32_t	__sysarg[8];	/* syscall arguments	*/
361*7c478bd9Sstevel@tonic-gate 			int32_t	__mstate[10];	/* see <sys/msacct.h>	*/
362*7c478bd9Sstevel@tonic-gate 		} __prof;
363*7c478bd9Sstevel@tonic-gate 
364*7c478bd9Sstevel@tonic-gate 		struct {			/* SI_RCTL */
365*7c478bd9Sstevel@tonic-gate 			int32_t	__entity;	/* type of entity exceeding */
366*7c478bd9Sstevel@tonic-gate 		} __rctl;
367*7c478bd9Sstevel@tonic-gate 
368*7c478bd9Sstevel@tonic-gate 	} __data;
369*7c478bd9Sstevel@tonic-gate 
370*7c478bd9Sstevel@tonic-gate } siginfo32_t;
371*7c478bd9Sstevel@tonic-gate 
372*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
373*7c478bd9Sstevel@tonic-gate 
374*7c478bd9Sstevel@tonic-gate /*
375*7c478bd9Sstevel@tonic-gate  * XXX -- internal version is identical to siginfo_t but without the padding.
376*7c478bd9Sstevel@tonic-gate  * This must be maintained in sync with it.
377*7c478bd9Sstevel@tonic-gate  */
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
380*7c478bd9Sstevel@tonic-gate 
381*7c478bd9Sstevel@tonic-gate typedef struct k_siginfo {
382*7c478bd9Sstevel@tonic-gate 	int	si_signo;			/* signal from signal.h	*/
383*7c478bd9Sstevel@tonic-gate 	int 	si_code;			/* code from above	*/
384*7c478bd9Sstevel@tonic-gate 	int	si_errno;			/* error from errno.h	*/
385*7c478bd9Sstevel@tonic-gate #ifdef _LP64
386*7c478bd9Sstevel@tonic-gate 	int	si_pad;		/* _LP64 union starts on an 8-byte boundary */
387*7c478bd9Sstevel@tonic-gate #endif
388*7c478bd9Sstevel@tonic-gate 	union {
389*7c478bd9Sstevel@tonic-gate 		struct {			/* kill(), SIGCLD, siqqueue() */
390*7c478bd9Sstevel@tonic-gate 			pid_t	__pid;		/* process ID		*/
391*7c478bd9Sstevel@tonic-gate 			union {
392*7c478bd9Sstevel@tonic-gate 				struct {
393*7c478bd9Sstevel@tonic-gate 					uid_t	__uid;
394*7c478bd9Sstevel@tonic-gate 					union sigval	__value;
395*7c478bd9Sstevel@tonic-gate 				} __kill;
396*7c478bd9Sstevel@tonic-gate 				struct {
397*7c478bd9Sstevel@tonic-gate 					clock_t __utime;
398*7c478bd9Sstevel@tonic-gate 					int	__status;
399*7c478bd9Sstevel@tonic-gate 					clock_t __stime;
400*7c478bd9Sstevel@tonic-gate 				} __cld;
401*7c478bd9Sstevel@tonic-gate 			} __pdata;
402*7c478bd9Sstevel@tonic-gate 			ctid_t	__ctid;		/* contract ID		*/
403*7c478bd9Sstevel@tonic-gate 			zoneid_t __zoneid;	/* zone ID		*/
404*7c478bd9Sstevel@tonic-gate 		} __proc;
405*7c478bd9Sstevel@tonic-gate 
406*7c478bd9Sstevel@tonic-gate 		struct {	/* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
407*7c478bd9Sstevel@tonic-gate 			void 	*__addr;	/* faulting address	*/
408*7c478bd9Sstevel@tonic-gate 			int	__trapno;	/* illegal trap number	*/
409*7c478bd9Sstevel@tonic-gate 			caddr_t	__pc;		/* instruction address	*/
410*7c478bd9Sstevel@tonic-gate 		} __fault;
411*7c478bd9Sstevel@tonic-gate 
412*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPOLL, SIGXFSZ	*/
413*7c478bd9Sstevel@tonic-gate 		/* fd not currently available for SIGPOLL */
414*7c478bd9Sstevel@tonic-gate 			int	__fd;		/* file descriptor	*/
415*7c478bd9Sstevel@tonic-gate 			long	__band;
416*7c478bd9Sstevel@tonic-gate 		} __file;
417*7c478bd9Sstevel@tonic-gate 
418*7c478bd9Sstevel@tonic-gate 		struct {			/* SIGPROF */
419*7c478bd9Sstevel@tonic-gate 			caddr_t	__faddr;	/* last fault address	*/
420*7c478bd9Sstevel@tonic-gate 
421*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
422*7c478bd9Sstevel@tonic-gate 			timestruc_t __tstamp;	/* real time stamp	*/
423*7c478bd9Sstevel@tonic-gate #else
424*7c478bd9Sstevel@tonic-gate 			_timestruc_t __tstamp;	/* real time stamp	*/
425*7c478bd9Sstevel@tonic-gate #endif
426*7c478bd9Sstevel@tonic-gate 			short	__syscall;	/* current syscall	*/
427*7c478bd9Sstevel@tonic-gate 			char	__nsysarg;	/* number of arguments	*/
428*7c478bd9Sstevel@tonic-gate 			char	__fault;	/* last fault type	*/
429*7c478bd9Sstevel@tonic-gate 			/* these are omitted to keep k_siginfo_t small	*/
430*7c478bd9Sstevel@tonic-gate 			/* long	__sysarg[8]; */
431*7c478bd9Sstevel@tonic-gate 			/* int	__mstate[10]; */
432*7c478bd9Sstevel@tonic-gate 		} __prof;
433*7c478bd9Sstevel@tonic-gate 
434*7c478bd9Sstevel@tonic-gate 		struct {			/* SI_RCTL */
435*7c478bd9Sstevel@tonic-gate 			int32_t	__entity;	/* type of entity exceeding */
436*7c478bd9Sstevel@tonic-gate 		} __rctl;
437*7c478bd9Sstevel@tonic-gate 
438*7c478bd9Sstevel@tonic-gate 	} __data;
439*7c478bd9Sstevel@tonic-gate 
440*7c478bd9Sstevel@tonic-gate } k_siginfo_t;
441*7c478bd9Sstevel@tonic-gate 
442*7c478bd9Sstevel@tonic-gate typedef struct sigqueue {
443*7c478bd9Sstevel@tonic-gate 	struct sigqueue	*sq_next;
444*7c478bd9Sstevel@tonic-gate 	k_siginfo_t	sq_info;
445*7c478bd9Sstevel@tonic-gate 	void		(*sq_func)(struct sigqueue *); /* destructor function */
446*7c478bd9Sstevel@tonic-gate 	void		*sq_backptr;	/* pointer to the data structure */
447*7c478bd9Sstevel@tonic-gate 					/* associated by sq_func()	*/
448*7c478bd9Sstevel@tonic-gate 	int		sq_external;	/* comes from outside the contract */
449*7c478bd9Sstevel@tonic-gate } sigqueue_t;
450*7c478bd9Sstevel@tonic-gate 
451*7c478bd9Sstevel@tonic-gate /*  indication whether to queue the signal or not */
452*7c478bd9Sstevel@tonic-gate #define	SI_CANQUEUE(c)	((c) <= SI_QUEUE)
453*7c478bd9Sstevel@tonic-gate 
454*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
455*7c478bd9Sstevel@tonic-gate 
456*7c478bd9Sstevel@tonic-gate #define	si_pid		__data.__proc.__pid
457*7c478bd9Sstevel@tonic-gate #define	si_ctid		__data.__proc.__ctid
458*7c478bd9Sstevel@tonic-gate #define	si_zoneid	__data.__proc.__zoneid
459*7c478bd9Sstevel@tonic-gate #define	si_status	__data.__proc.__pdata.__cld.__status
460*7c478bd9Sstevel@tonic-gate #define	si_stime	__data.__proc.__pdata.__cld.__stime
461*7c478bd9Sstevel@tonic-gate #define	si_utime	__data.__proc.__pdata.__cld.__utime
462*7c478bd9Sstevel@tonic-gate #define	si_uid		__data.__proc.__pdata.__kill.__uid
463*7c478bd9Sstevel@tonic-gate #define	si_value	__data.__proc.__pdata.__kill.__value
464*7c478bd9Sstevel@tonic-gate #define	si_addr		__data.__fault.__addr
465*7c478bd9Sstevel@tonic-gate #define	si_trapno	__data.__fault.__trapno
466*7c478bd9Sstevel@tonic-gate #define	si_trapafter	__data.__fault.__trapno
467*7c478bd9Sstevel@tonic-gate #define	si_pc		__data.__fault.__pc
468*7c478bd9Sstevel@tonic-gate #define	si_fd		__data.__file.__fd
469*7c478bd9Sstevel@tonic-gate #define	si_band		__data.__file.__band
470*7c478bd9Sstevel@tonic-gate #define	si_tstamp	__data.__prof.__tstamp
471*7c478bd9Sstevel@tonic-gate #define	si_syscall	__data.__prof.__syscall
472*7c478bd9Sstevel@tonic-gate #define	si_nsysarg	__data.__prof.__nsysarg
473*7c478bd9Sstevel@tonic-gate #define	si_sysarg	__data.__prof.__sysarg
474*7c478bd9Sstevel@tonic-gate #define	si_fault	__data.__prof.__fault
475*7c478bd9Sstevel@tonic-gate #define	si_faddr	__data.__prof.__faddr
476*7c478bd9Sstevel@tonic-gate #define	si_mstate	__data.__prof.__mstate
477*7c478bd9Sstevel@tonic-gate #define	si_entity	__data.__rctl.__entity
478*7c478bd9Sstevel@tonic-gate 
479*7c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) ... */
480*7c478bd9Sstevel@tonic-gate 
481*7c478bd9Sstevel@tonic-gate 
482*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL)
483*7c478bd9Sstevel@tonic-gate 
484*7c478bd9Sstevel@tonic-gate extern void siginfo_kto32(const k_siginfo_t *, siginfo32_t *);
485*7c478bd9Sstevel@tonic-gate extern void siginfo_32tok(const siginfo32_t *, k_siginfo_t *);
486*7c478bd9Sstevel@tonic-gate 
487*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32_IMPL */
488*7c478bd9Sstevel@tonic-gate 
489*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
490*7c478bd9Sstevel@tonic-gate }
491*7c478bd9Sstevel@tonic-gate #endif
492*7c478bd9Sstevel@tonic-gate 
493*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_SIGINFO_H */
494