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