1#ifndef __siginfo_t_defined
2#define __siginfo_t_defined 1
3
4#include <bits/wordsize.h>
5#include <bits/types.h>
6#include <bits/types/__sigval_t.h>
7
8#define __SI_MAX_SIZE 128
9#if __WORDSIZE == 64
10# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
11#else
12# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
13#endif
14
15/* Some fields of siginfo_t have architecture-specific variations. */
16#include <bits/siginfo-arch.h>
17#ifndef __SI_ALIGNMENT
18# define __SI_ALIGNMENT /* nothing */
19#endif
20#ifndef __SI_BAND_TYPE
21# define __SI_BAND_TYPE long int
22#endif
23#ifndef __SI_CLOCK_T
24# define __SI_CLOCK_T __clock_t
25#endif
26#ifndef __SI_ERRNO_THEN_CODE
27# define __SI_ERRNO_THEN_CODE 1
28#endif
29#ifndef __SI_HAVE_SIGSYS
30# define __SI_HAVE_SIGSYS 1
31#endif
32#ifndef __SI_SIGFAULT_ADDL
33# define __SI_SIGFAULT_ADDL /* nothing */
34#endif
35
36typedef struct
37 {
38 int si_signo; /* Signal number. */
39#if __SI_ERRNO_THEN_CODE
40 int si_errno; /* If non-zero, an errno value associated with
41 this signal, as defined in <errno.h>. */
42 int si_code; /* Signal code. */
43#else
44 int si_code;
45 int si_errno;
46#endif
47#if __WORDSIZE == 64
48 int __pad0; /* Explicit padding. */
49#endif
50
51 union
52 {
53 int _pad[__SI_PAD_SIZE];
54
55 /* kill(). */
56 struct
57 {
58 __pid_t si_pid; /* Sending process ID. */
59 __uid_t si_uid; /* Real user ID of sending process. */
60 } _kill;
61
62 /* POSIX.1b timers. */
63 struct
64 {
65 int si_tid; /* Timer ID. */
66 int si_overrun; /* Overrun count. */
67 __sigval_t si_sigval; /* Signal value. */
68 } _timer;
69
70 /* POSIX.1b signals. */
71 struct
72 {
73 __pid_t si_pid; /* Sending process ID. */
74 __uid_t si_uid; /* Real user ID of sending process. */
75 __sigval_t si_sigval; /* Signal value. */
76 } _rt;
77
78 /* SIGCHLD. */
79 struct
80 {
81 __pid_t si_pid; /* Which child. */
82 __uid_t si_uid; /* Real user ID of sending process. */
83 int si_status; /* Exit value or signal. */
84 __SI_CLOCK_T si_utime;
85 __SI_CLOCK_T si_stime;
86 } _sigchld;
87
88 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
89 struct
90 {
91 void *si_addr; /* Faulting insn/memory ref. */
92 __SI_SIGFAULT_ADDL
93 short int si_addr_lsb; /* Valid LSB of the reported address. */
94 union
95 {
96 /* used when si_code=SEGV_BNDERR */
97 struct
98 {
99 void *_lower;
100 void *_upper;
101 } _addr_bnd;
102 /* used when si_code=SEGV_PKUERR */
103 __uint32_t _pkey;
104 } _bounds;
105 } _sigfault;
106
107 /* SIGPOLL. */
108 struct
109 {
110 long int si_band; /* Band event for SIGPOLL. */
111 int si_fd;
112 } _sigpoll;
113
114 /* SIGSYS. */
115#if __SI_HAVE_SIGSYS
116 struct
117 {
118 void *_call_addr; /* Calling user insn. */
119 int _syscall; /* Triggering system call number. */
120 unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
121 } _sigsys;
122#endif
123 } _sifields;
124 } siginfo_t __SI_ALIGNMENT;
125
126
127/* X/Open requires some more fields with fixed names. */
128#define si_pid _sifields._kill.si_pid
129#define si_uid _sifields._kill.si_uid
130#define si_timerid _sifields._timer.si_tid
131#define si_overrun _sifields._timer.si_overrun
132#define si_status _sifields._sigchld.si_status
133#define si_utime _sifields._sigchld.si_utime
134#define si_stime _sifields._sigchld.si_stime
135#define si_value _sifields._rt.si_sigval
136#define si_int _sifields._rt.si_sigval.sival_int
137#define si_ptr _sifields._rt.si_sigval.sival_ptr
138#define si_addr _sifields._sigfault.si_addr
139#define si_addr_lsb _sifields._sigfault.si_addr_lsb
140#define si_lower _sifields._sigfault._bounds._addr_bnd._lower
141#define si_upper _sifields._sigfault._bounds._addr_bnd._upper
142#define si_pkey _sifields._sigfault._bounds._pkey
143#define si_band _sifields._sigpoll.si_band
144#define si_fd _sifields._sigpoll.si_fd
145#if __SI_HAVE_SIGSYS
146# define si_call_addr _sifields._sigsys._call_addr
147# define si_syscall _sifields._sigsys._syscall
148# define si_arch _sifields._sigsys._arch
149#endif
150
151#endif
152