]>
Commit | Line | Data |
---|---|---|
8a1ab315 DH |
1 | #ifndef _UAPI_ASM_GENERIC_SIGINFO_H |
2 | #define _UAPI_ASM_GENERIC_SIGINFO_H | |
3 | ||
4 | #include <linux/compiler.h> | |
5 | #include <linux/types.h> | |
6 | ||
7 | typedef union sigval { | |
8 | int sival_int; | |
9 | void __user *sival_ptr; | |
10 | } sigval_t; | |
11 | ||
12 | /* | |
13 | * This is the size (including padding) of the part of the | |
14 | * struct siginfo that is before the union. | |
15 | */ | |
16 | #ifndef __ARCH_SI_PREAMBLE_SIZE | |
17 | #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) | |
18 | #endif | |
19 | ||
20 | #define SI_MAX_SIZE 128 | |
21 | #ifndef SI_PAD_SIZE | |
22 | #define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) | |
23 | #endif | |
24 | ||
25 | #ifndef __ARCH_SI_UID_T | |
26 | #define __ARCH_SI_UID_T __kernel_uid32_t | |
27 | #endif | |
28 | ||
29 | /* | |
30 | * The default "si_band" type is "long", as specified by POSIX. | |
31 | * However, some architectures want to override this to "int" | |
32 | * for historical compatibility reasons, so we allow that. | |
33 | */ | |
34 | #ifndef __ARCH_SI_BAND_T | |
35 | #define __ARCH_SI_BAND_T long | |
36 | #endif | |
37 | ||
38 | #ifndef __ARCH_SI_CLOCK_T | |
39 | #define __ARCH_SI_CLOCK_T __kernel_clock_t | |
40 | #endif | |
41 | ||
42 | #ifndef __ARCH_SI_ATTRIBUTES | |
43 | #define __ARCH_SI_ATTRIBUTES | |
44 | #endif | |
45 | ||
46 | #ifndef HAVE_ARCH_SIGINFO_T | |
47 | ||
48 | typedef struct siginfo { | |
49 | int si_signo; | |
50 | int si_errno; | |
51 | int si_code; | |
52 | ||
53 | union { | |
54 | int _pad[SI_PAD_SIZE]; | |
55 | ||
56 | /* kill() */ | |
57 | struct { | |
58 | __kernel_pid_t _pid; /* sender's pid */ | |
59 | __ARCH_SI_UID_T _uid; /* sender's uid */ | |
60 | } _kill; | |
61 | ||
62 | /* POSIX.1b timers */ | |
63 | struct { | |
64 | __kernel_timer_t _tid; /* timer id */ | |
65 | int _overrun; /* overrun count */ | |
66 | char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; | |
67 | sigval_t _sigval; /* same as below */ | |
68 | int _sys_private; /* not to be passed to user */ | |
69 | } _timer; | |
70 | ||
71 | /* POSIX.1b signals */ | |
72 | struct { | |
73 | __kernel_pid_t _pid; /* sender's pid */ | |
74 | __ARCH_SI_UID_T _uid; /* sender's uid */ | |
75 | sigval_t _sigval; | |
76 | } _rt; | |
77 | ||
78 | /* SIGCHLD */ | |
79 | struct { | |
80 | __kernel_pid_t _pid; /* which child */ | |
81 | __ARCH_SI_UID_T _uid; /* sender's uid */ | |
82 | int _status; /* exit code */ | |
83 | __ARCH_SI_CLOCK_T _utime; | |
84 | __ARCH_SI_CLOCK_T _stime; | |
85 | } _sigchld; | |
86 | ||
87 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | |
88 | struct { | |
89 | void __user *_addr; /* faulting insn/memory ref. */ | |
90 | #ifdef __ARCH_SI_TRAPNO | |
91 | int _trapno; /* TRAP # which caused the signal */ | |
92 | #endif | |
93 | short _addr_lsb; /* LSB of the reported address */ | |
cd0ea35f DH |
94 | union { |
95 | /* used when si_code=SEGV_BNDERR */ | |
96 | struct { | |
97 | void __user *_lower; | |
98 | void __user *_upper; | |
99 | } _addr_bnd; | |
100 | /* used when si_code=SEGV_PKUERR */ | |
49cd53bf | 101 | __u32 _pkey; |
cd0ea35f | 102 | }; |
8a1ab315 DH |
103 | } _sigfault; |
104 | ||
105 | /* SIGPOLL */ | |
106 | struct { | |
107 | __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | |
108 | int _fd; | |
109 | } _sigpoll; | |
110 | ||
111 | /* SIGSYS */ | |
112 | struct { | |
113 | void __user *_call_addr; /* calling user insn */ | |
114 | int _syscall; /* triggering system call number */ | |
115 | unsigned int _arch; /* AUDIT_ARCH_* of syscall */ | |
116 | } _sigsys; | |
117 | } _sifields; | |
118 | } __ARCH_SI_ATTRIBUTES siginfo_t; | |
119 | ||
120 | /* If the arch shares siginfo, then it has SIGSYS. */ | |
121 | #define __ARCH_SIGSYS | |
122 | #endif | |
123 | ||
124 | /* | |
125 | * How these fields are to be accessed. | |
126 | */ | |
127 | #define si_pid _sifields._kill._pid | |
128 | #define si_uid _sifields._kill._uid | |
129 | #define si_tid _sifields._timer._tid | |
130 | #define si_overrun _sifields._timer._overrun | |
131 | #define si_sys_private _sifields._timer._sys_private | |
132 | #define si_status _sifields._sigchld._status | |
133 | #define si_utime _sifields._sigchld._utime | |
134 | #define si_stime _sifields._sigchld._stime | |
135 | #define si_value _sifields._rt._sigval | |
136 | #define si_int _sifields._rt._sigval.sival_int | |
137 | #define si_ptr _sifields._rt._sigval.sival_ptr | |
138 | #define si_addr _sifields._sigfault._addr | |
139 | #ifdef __ARCH_SI_TRAPNO | |
140 | #define si_trapno _sifields._sigfault._trapno | |
141 | #endif | |
142 | #define si_addr_lsb _sifields._sigfault._addr_lsb | |
ee1b58d3 QR |
143 | #define si_lower _sifields._sigfault._addr_bnd._lower |
144 | #define si_upper _sifields._sigfault._addr_bnd._upper | |
cd0ea35f | 145 | #define si_pkey _sifields._sigfault._pkey |
8a1ab315 DH |
146 | #define si_band _sifields._sigpoll._band |
147 | #define si_fd _sifields._sigpoll._fd | |
148 | #ifdef __ARCH_SIGSYS | |
149 | #define si_call_addr _sifields._sigsys._call_addr | |
150 | #define si_syscall _sifields._sigsys._syscall | |
151 | #define si_arch _sifields._sigsys._arch | |
152 | #endif | |
153 | ||
8a1ab315 DH |
154 | /* |
155 | * si_code values | |
156 | * Digital reserves positive values for kernel-generated signals. | |
157 | */ | |
158 | #define SI_USER 0 /* sent by kill, sigsend, raise */ | |
159 | #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ | |
160 | #define SI_QUEUE -1 /* sent by sigqueue */ | |
cc731525 EB |
161 | #define SI_TIMER -2 /* sent by timer expiration */ |
162 | #define SI_MESGQ -3 /* sent by real time mesq state change */ | |
8a1ab315 | 163 | #define SI_ASYNCIO -4 /* sent by AIO completion */ |
cc731525 | 164 | #define SI_SIGIO -5 /* sent by queued SIGIO */ |
8a1ab315 DH |
165 | #define SI_TKILL -6 /* sent by tkill system call */ |
166 | #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ | |
167 | ||
168 | #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) | |
169 | #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) | |
170 | ||
171 | /* | |
172 | * SIGILL si_codes | |
173 | */ | |
cc731525 EB |
174 | #define ILL_ILLOPC 1 /* illegal opcode */ |
175 | #define ILL_ILLOPN 2 /* illegal operand */ | |
176 | #define ILL_ILLADR 3 /* illegal addressing mode */ | |
177 | #define ILL_ILLTRP 4 /* illegal trap */ | |
178 | #define ILL_PRVOPC 5 /* privileged opcode */ | |
179 | #define ILL_PRVREG 6 /* privileged register */ | |
180 | #define ILL_COPROC 7 /* coprocessor error */ | |
181 | #define ILL_BADSTK 8 /* internal stack error */ | |
8a1ab315 DH |
182 | #define NSIGILL 8 |
183 | ||
184 | /* | |
185 | * SIGFPE si_codes | |
186 | */ | |
cc731525 EB |
187 | #define FPE_INTDIV 1 /* integer divide by zero */ |
188 | #define FPE_INTOVF 2 /* integer overflow */ | |
189 | #define FPE_FLTDIV 3 /* floating point divide by zero */ | |
190 | #define FPE_FLTOVF 4 /* floating point overflow */ | |
191 | #define FPE_FLTUND 5 /* floating point underflow */ | |
192 | #define FPE_FLTRES 6 /* floating point inexact result */ | |
193 | #define FPE_FLTINV 7 /* floating point invalid operation */ | |
194 | #define FPE_FLTSUB 8 /* subscript out of range */ | |
8a1ab315 DH |
195 | #define NSIGFPE 8 |
196 | ||
197 | /* | |
198 | * SIGSEGV si_codes | |
199 | */ | |
cc731525 EB |
200 | #define SEGV_MAPERR 1 /* address not mapped to object */ |
201 | #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ | |
202 | #define SEGV_BNDERR 3 /* failed address bound checks */ | |
203 | #define SEGV_PKUERR 4 /* failed protection key checks */ | |
cd0ea35f | 204 | #define NSIGSEGV 4 |
8a1ab315 DH |
205 | |
206 | /* | |
207 | * SIGBUS si_codes | |
208 | */ | |
cc731525 EB |
209 | #define BUS_ADRALN 1 /* invalid address alignment */ |
210 | #define BUS_ADRERR 2 /* non-existent physical address */ | |
211 | #define BUS_OBJERR 3 /* object specific hardware error */ | |
8a1ab315 | 212 | /* hardware memory error consumed on a machine check: action required */ |
cc731525 | 213 | #define BUS_MCEERR_AR 4 |
8a1ab315 | 214 | /* hardware memory error detected in process but not consumed: action optional*/ |
cc731525 | 215 | #define BUS_MCEERR_AO 5 |
8a1ab315 DH |
216 | #define NSIGBUS 5 |
217 | ||
218 | /* | |
219 | * SIGTRAP si_codes | |
220 | */ | |
cc731525 EB |
221 | #define TRAP_BRKPT 1 /* process breakpoint */ |
222 | #define TRAP_TRACE 2 /* process trace trap */ | |
223 | #define TRAP_BRANCH 3 /* process taken branch trap */ | |
224 | #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ | |
8a1ab315 DH |
225 | #define NSIGTRAP 4 |
226 | ||
227 | /* | |
228 | * SIGCHLD si_codes | |
229 | */ | |
cc731525 EB |
230 | #define CLD_EXITED 1 /* child has exited */ |
231 | #define CLD_KILLED 2 /* child was killed */ | |
232 | #define CLD_DUMPED 3 /* child terminated abnormally */ | |
233 | #define CLD_TRAPPED 4 /* traced child has trapped */ | |
234 | #define CLD_STOPPED 5 /* child has stopped */ | |
235 | #define CLD_CONTINUED 6 /* stopped child has continued */ | |
8a1ab315 DH |
236 | #define NSIGCHLD 6 |
237 | ||
238 | /* | |
d08477aa | 239 | * SIGPOLL (or any other signal without signal specific si_codes) si_codes |
8a1ab315 | 240 | */ |
cc731525 EB |
241 | #define POLL_IN 1 /* data input available */ |
242 | #define POLL_OUT 2 /* output buffers available */ | |
243 | #define POLL_MSG 3 /* input message available */ | |
244 | #define POLL_ERR 4 /* i/o error */ | |
245 | #define POLL_PRI 5 /* high priority input available */ | |
246 | #define POLL_HUP 6 /* device disconnected */ | |
8a1ab315 DH |
247 | #define NSIGPOLL 6 |
248 | ||
249 | /* | |
250 | * SIGSYS si_codes | |
251 | */ | |
cc731525 EB |
252 | #define SYS_SECCOMP 1 /* seccomp triggered */ |
253 | #define NSIGSYS 1 | |
8a1ab315 DH |
254 | |
255 | /* | |
256 | * sigevent definitions | |
257 | * | |
258 | * It seems likely that SIGEV_THREAD will have to be handled from | |
259 | * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the | |
260 | * thread manager then catches and does the appropriate nonsense. | |
261 | * However, everything is written out here so as to not get lost. | |
262 | */ | |
263 | #define SIGEV_SIGNAL 0 /* notify via signal */ | |
264 | #define SIGEV_NONE 1 /* other notification: meaningless */ | |
265 | #define SIGEV_THREAD 2 /* deliver via thread creation */ | |
266 | #define SIGEV_THREAD_ID 4 /* deliver to thread */ | |
267 | ||
268 | /* | |
269 | * This works because the alignment is ok on all current architectures | |
270 | * but we leave open this being overridden in the future | |
271 | */ | |
272 | #ifndef __ARCH_SIGEV_PREAMBLE_SIZE | |
273 | #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) | |
274 | #endif | |
275 | ||
276 | #define SIGEV_MAX_SIZE 64 | |
277 | #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ | |
278 | / sizeof(int)) | |
279 | ||
280 | typedef struct sigevent { | |
281 | sigval_t sigev_value; | |
282 | int sigev_signo; | |
283 | int sigev_notify; | |
284 | union { | |
285 | int _pad[SIGEV_PAD_SIZE]; | |
286 | int _tid; | |
287 | ||
288 | struct { | |
289 | void (*_function)(sigval_t); | |
290 | void *_attribute; /* really pthread_attr_t */ | |
291 | } _sigev_thread; | |
292 | } _sigev_un; | |
293 | } sigevent_t; | |
294 | ||
295 | #define sigev_notify_function _sigev_un._sigev_thread._function | |
296 | #define sigev_notify_attributes _sigev_un._sigev_thread._attribute | |
297 | #define sigev_notify_thread_id _sigev_un._tid | |
298 | ||
299 | ||
300 | #endif /* _UAPI_ASM_GENERIC_SIGINFO_H */ |