4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #ifndef _SYS_SIGINFO_H
31 #define _SYS_SIGINFO_H
33 #include <sys/feature_tests.h>
34 #include <sys/types.h>
40 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
41 defined(__EXTENSIONS__)
44 * The union sigval is also defined in <time.h> as per X/Open and
50 int sival_int
; /* integer value */
51 void *sival_ptr
; /* pointer value */
55 #if defined(_SYSCALL32)
57 /* Kernel view of user ILP32 sigval */
60 int32_t sival_int
; /* integer value */
61 caddr32_t sival_ptr
; /* pointer value */
64 #endif /* _SYSCALL32 */
66 #else /* needed in siginfo_t structure */
69 int __sival_int
; /* integer value */
70 void *__sival_ptr
; /* pointer value */
73 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
75 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
76 defined(__EXTENSIONS__)
79 * The sigevent structure is also defined in <time.h> as per X/Open and
85 int sigev_notify
; /* notification mode */
86 int sigev_signo
; /* signal number */
87 union sigval sigev_value
; /* signal value */
88 void (*sigev_notify_function
)(union sigval
);
89 pthread_attr_t
*sigev_notify_attributes
;
92 #endif /* _SIGEVENT */
94 /* values of sigev_notify */
95 #define SIGEV_NONE 1 /* no notification */
96 #define SIGEV_SIGNAL 2 /* queued signal notification */
97 #define SIGEV_THREAD 3 /* call back from another thread */
98 #define SIGEV_PORT 4 /* use event port for notification */
100 #if defined(_SYSCALL32)
102 /* Kernel view of user ILP32 sigevent */
105 int32_t sigev_notify
; /* notification mode */
106 int32_t sigev_signo
; /* signal number */
107 union sigval32 sigev_value
; /* signal value */
108 caddr32_t sigev_notify_function
;
109 caddr32_t sigev_notify_attributes
;
110 int32_t __sigev_pad2
;
113 #endif /* _SYSCALL32 */
115 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
117 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
118 defined(__EXTENSIONS__)
120 * negative signal codes are reserved for future use for user generated
124 #define SI_FROMUSER(sip) ((sip)->si_code <= 0)
125 #define SI_FROMKERNEL(sip) ((sip)->si_code > 0)
127 #define SI_NOINFO 32767 /* no signal information */
128 #define SI_DTRACE 2050 /* kernel generated signal via DTrace action */
129 #define SI_RCTL 2049 /* kernel generated signal via rctl action */
130 #define SI_USER 0 /* user generated signal via kill() */
131 #define SI_LWP (-1) /* user generated signal via lwp_kill() */
132 #define SI_QUEUE (-2) /* user generated signal via sigqueue() */
133 #define SI_TIMER (-3) /* from timer expiration */
134 #define SI_ASYNCIO (-4) /* from asynchronous I/O completion */
135 #define SI_MESGQ (-5) /* from message arrival */
136 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
138 #if !defined(_POSIX_C_SOURCE) || defined(_XPG4_2) || defined(__EXTENSIONS__)
140 * Get the machine dependent signal codes (SIGILL, SIGFPE, SIGSEGV, and
141 * SIGBUS) from <sys/machsig.h>
144 #include <sys/machsig.h>
147 * SIGTRAP signal codes
150 #define TRAP_BRKPT 1 /* breakpoint trap */
151 #define TRAP_TRACE 2 /* trace trap */
152 #define TRAP_RWATCH 3 /* read access watchpoint trap */
153 #define TRAP_WWATCH 4 /* write access watchpoint trap */
154 #define TRAP_XWATCH 5 /* execute access watchpoint trap */
155 #define TRAP_DTRACE 6 /* problem with fasttrap DTrace provider */
156 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
158 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
161 * SIGCLD signal codes
164 #define CLD_EXITED 1 /* child has exited */
165 #define CLD_KILLED 2 /* child was killed */
166 #define CLD_DUMPED 3 /* child has coredumped */
167 #define CLD_TRAPPED 4 /* traced child has stopped */
168 #define CLD_STOPPED 5 /* child has stopped on signal */
169 #define CLD_CONTINUED 6 /* stopped child has continued */
171 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
173 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
176 * SIGPOLL signal codes
179 #define POLL_IN 1 /* input available */
180 #define POLL_OUT 2 /* output possible */
181 #define POLL_MSG 3 /* message available */
182 #define POLL_ERR 4 /* I/O error */
183 #define POLL_PRI 5 /* high priority input available */
184 #define POLL_HUP 6 /* device disconnected */
186 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
188 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
190 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XPG4_2) ... */
192 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
194 * SIGPROF signal codes
197 #define PROF_SIG 1 /* have to set code non-zero */
200 #endif /* !defined(__XOPEN_OR_POSIX) || defined (__EXTENSIONS__) */
202 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
203 defined(__EXTENSIONS__)
207 #define SI_PAD ((SI_MAXSZ / sizeof (int)) - 4)
210 #define SI_PAD ((SI_MAXSZ / sizeof (int)) - 3)
214 * Inclusion of <sys/time_impl.h> is needed for the declaration of
215 * timestruc_t. However, since inclusion of <sys/time_impl.h> results
216 * in X/Open and POSIX namespace pollution, the definition for
217 * timestruct_t has been duplicated in a standards namespace safe header
218 * <sys/time_std_impl.h>. In <sys/time_std_impl.h>, the structure
219 * name, tag, and member names, as well as the type itself, all have
220 * leading underscores to protect namespace.
222 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
223 #include <sys/time_impl.h>
225 #include <sys/time_std_impl.h>
226 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
229 * The inclusion of <sys/types.h> is needed for definitions of pid_t, etc.
230 * Placement here is due to a dependency in <sys/select.h> which is included
231 * by <sys/types.h> for the sigevent structure. Hence this inclusion must
232 * follow that definition.
234 #include <sys/types.h> /* for definitions of pid_t, etc. */
236 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
237 typedef struct siginfo
{ /* pollutes POSIX/XOPEN namespace */
241 int si_signo
; /* signal from signal.h */
242 int si_code
; /* code from above */
243 int si_errno
; /* error from errno.h */
245 int si_pad
; /* _LP64 union starts on an 8-byte boundary */
249 int __pad
[SI_PAD
]; /* for future growth */
251 struct { /* kill(), SIGCLD, siqqueue() */
252 pid_t __pid
; /* process ID */
256 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
257 defined(__EXTENSIONS__)
258 union sigval __value
;
260 union __sigval __value
;
269 ctid_t __ctid
; /* contract ID */
270 zoneid_t __zoneid
; /* zone ID */
273 struct { /* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
274 void *__addr
; /* faulting address */
275 int __trapno
; /* illegal trap number */
276 caddr_t __pc
; /* instruction address */
279 struct { /* SIGPOLL, SIGXFSZ */
280 /* fd not currently available for SIGPOLL */
281 int __fd
; /* file descriptor */
285 struct { /* SIGPROF */
286 caddr_t __faddr
; /* last fault address */
287 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
288 timestruc_t __tstamp
; /* real time stamp */
290 _timestruc_t __tstamp
; /* real time stamp */
292 short __syscall
; /* current syscall */
293 char __nsysarg
; /* number of arguments */
294 char __fault
; /* last fault type */
295 long __sysarg
[8]; /* syscall arguments */
296 int __mstate
[10]; /* see <sys/msacct.h> */
299 struct { /* SI_RCTL */
300 int32_t __entity
; /* type of entity exceeding */
306 #if defined(_SYSCALL32)
308 /* Kernel view of user ILP32 siginfo struct */
310 #define SI32_MAXSZ 128
311 #define SI32_PAD ((SI32_MAXSZ / sizeof (int32_t)) - 3)
313 typedef struct siginfo32
{
315 int32_t si_signo
; /* signal from signal.h */
316 int32_t si_code
; /* code from above */
317 int32_t si_errno
; /* error from errno.h */
321 int32_t __pad
[SI32_PAD
]; /* for future growth */
323 struct { /* kill(), SIGCLD, siqqueue() */
324 pid32_t __pid
; /* process ID */
328 union sigval32 __value
;
336 id32_t __ctid
; /* contract ID */
337 id32_t __zoneid
; /* zone ID */
340 struct { /* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
341 caddr32_t __addr
; /* faulting address */
342 int32_t __trapno
; /* illegal trap number */
343 caddr32_t __pc
; /* instruction address */
346 struct { /* SIGPOLL, SIGXFSZ */
347 /* fd not currently available for SIGPOLL */
348 int32_t __fd
; /* file descriptor */
352 struct { /* SIGPROF */
353 caddr32_t __faddr
; /* last fault address */
354 timestruc32_t __tstamp
; /* real time stamp */
355 int16_t __syscall
; /* current syscall */
356 int8_t __nsysarg
; /* number of arguments */
357 int8_t __fault
; /* last fault type */
358 int32_t __sysarg
[8]; /* syscall arguments */
359 int32_t __mstate
[10]; /* see <sys/msacct.h> */
362 struct { /* SI_RCTL */
363 int32_t __entity
; /* type of entity exceeding */
370 #endif /* _SYSCALL32 */
373 * XXX -- internal version is identical to siginfo_t but without the padding.
374 * This must be maintained in sync with it.
377 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
379 typedef struct k_siginfo
{
380 int si_signo
; /* signal from signal.h */
381 int si_code
; /* code from above */
382 int si_errno
; /* error from errno.h */
384 int si_pad
; /* _LP64 union starts on an 8-byte boundary */
387 struct { /* kill(), SIGCLD, siqqueue() */
388 pid_t __pid
; /* process ID */
392 union sigval __value
;
400 ctid_t __ctid
; /* contract ID */
401 zoneid_t __zoneid
; /* zone ID */
404 struct { /* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
405 void *__addr
; /* faulting address */
406 int __trapno
; /* illegal trap number */
407 caddr_t __pc
; /* instruction address */
410 struct { /* SIGPOLL, SIGXFSZ */
411 /* fd not currently available for SIGPOLL */
412 int __fd
; /* file descriptor */
416 struct { /* SIGPROF */
417 caddr_t __faddr
; /* last fault address */
419 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
420 timestruc_t __tstamp
; /* real time stamp */
422 _timestruc_t __tstamp
; /* real time stamp */
424 short __syscall
; /* current syscall */
425 char __nsysarg
; /* number of arguments */
426 char __fault
; /* last fault type */
427 /* these are omitted to keep k_siginfo_t small */
428 /* long __sysarg[8]; */
429 /* int __mstate[10]; */
432 struct { /* SI_RCTL */
433 int32_t __entity
; /* type of entity exceeding */
440 typedef struct sigqueue
{
441 struct sigqueue
*sq_next
;
443 void (*sq_func
)(struct sigqueue
*); /* destructor function */
444 void *sq_backptr
; /* pointer to the data structure */
445 /* associated by sq_func() */
446 int sq_external
; /* comes from outside the contract */
449 /* indication whether to queue the signal or not */
450 #define SI_CANQUEUE(c) ((c) <= SI_QUEUE)
452 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
454 #define si_pid __data.__proc.__pid
455 #define si_ctid __data.__proc.__ctid
456 #define si_zoneid __data.__proc.__zoneid
457 #define si_status __data.__proc.__pdata.__cld.__status
458 #define si_stime __data.__proc.__pdata.__cld.__stime
459 #define si_utime __data.__proc.__pdata.__cld.__utime
460 #define si_uid __data.__proc.__pdata.__kill.__uid
461 #define si_value __data.__proc.__pdata.__kill.__value
462 #define si_addr __data.__fault.__addr
463 #define si_trapno __data.__fault.__trapno
464 #define si_trapafter __data.__fault.__trapno
465 #define si_pc __data.__fault.__pc
466 #define si_fd __data.__file.__fd
467 #define si_band __data.__file.__band
468 #define si_tstamp __data.__prof.__tstamp
469 #define si_syscall __data.__prof.__syscall
470 #define si_nsysarg __data.__prof.__nsysarg
471 #define si_sysarg __data.__prof.__sysarg
472 #define si_fault __data.__prof.__fault
473 #define si_faddr __data.__prof.__faddr
474 #define si_mstate __data.__prof.__mstate
475 #define si_entity __data.__rctl.__entity
477 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) ... */
480 #if defined(_SYSCALL32_IMPL)
482 extern void siginfo_kto32(const k_siginfo_t
*, siginfo32_t
*);
483 extern void siginfo_32tok(const siginfo32_t
*, k_siginfo_t
*);
485 #endif /* _SYSCALL32_IMPL */
491 #endif /* _SYS_SIGINFO_H */