1 |
13 |
serginhofr |
#ifndef _ASM_GENERIC_SIGINFO_H
|
2 |
|
|
#define _ASM_GENERIC_SIGINFO_H
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
#include <linux/types.h>
|
6 |
|
|
|
7 |
|
|
typedef union sigval {
|
8 |
|
|
int sival_int;
|
9 |
|
|
void *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 *_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 */
|
94 |
|
|
} _sigfault;
|
95 |
|
|
|
96 |
|
|
/* SIGPOLL */
|
97 |
|
|
struct {
|
98 |
|
|
__ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
99 |
|
|
int _fd;
|
100 |
|
|
} _sigpoll;
|
101 |
|
|
|
102 |
|
|
/* SIGSYS */
|
103 |
|
|
struct {
|
104 |
|
|
void *_call_addr; /* calling user insn */
|
105 |
|
|
int _syscall; /* triggering system call number */
|
106 |
|
|
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
|
107 |
|
|
} _sigsys;
|
108 |
|
|
} _sifields;
|
109 |
|
|
} __ARCH_SI_ATTRIBUTES siginfo_t;
|
110 |
|
|
|
111 |
|
|
/* If the arch shares siginfo, then it has SIGSYS. */
|
112 |
|
|
#define __ARCH_SIGSYS
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
/*
|
116 |
|
|
* How these fields are to be accessed.
|
117 |
|
|
*/
|
118 |
|
|
#define si_pid _sifields._kill._pid
|
119 |
|
|
#define si_uid _sifields._kill._uid
|
120 |
|
|
#define si_tid _sifields._timer._tid
|
121 |
|
|
#define si_overrun _sifields._timer._overrun
|
122 |
|
|
#define si_sys_private _sifields._timer._sys_private
|
123 |
|
|
#define si_status _sifields._sigchld._status
|
124 |
|
|
#define si_utime _sifields._sigchld._utime
|
125 |
|
|
#define si_stime _sifields._sigchld._stime
|
126 |
|
|
#define si_value _sifields._rt._sigval
|
127 |
|
|
#define si_int _sifields._rt._sigval.sival_int
|
128 |
|
|
#define si_ptr _sifields._rt._sigval.sival_ptr
|
129 |
|
|
#define si_addr _sifields._sigfault._addr
|
130 |
|
|
#ifdef __ARCH_SI_TRAPNO
|
131 |
|
|
#define si_trapno _sifields._sigfault._trapno
|
132 |
|
|
#endif
|
133 |
|
|
#define si_addr_lsb _sifields._sigfault._addr_lsb
|
134 |
|
|
#define si_band _sifields._sigpoll._band
|
135 |
|
|
#define si_fd _sifields._sigpoll._fd
|
136 |
|
|
#ifdef __ARCH_SIGSYS
|
137 |
|
|
#define si_call_addr _sifields._sigsys._call_addr
|
138 |
|
|
#define si_syscall _sifields._sigsys._syscall
|
139 |
|
|
#define si_arch _sifields._sigsys._arch
|
140 |
|
|
#endif
|
141 |
|
|
|
142 |
|
|
#define __SI_KILL 0
|
143 |
|
|
#define __SI_TIMER 0
|
144 |
|
|
#define __SI_POLL 0
|
145 |
|
|
#define __SI_FAULT 0
|
146 |
|
|
#define __SI_CHLD 0
|
147 |
|
|
#define __SI_RT 0
|
148 |
|
|
#define __SI_MESGQ 0
|
149 |
|
|
#define __SI_SYS 0
|
150 |
|
|
#define __SI_CODE(T,N) (N)
|
151 |
|
|
|
152 |
|
|
/*
|
153 |
|
|
* si_code values
|
154 |
|
|
* Digital reserves positive values for kernel-generated signals.
|
155 |
|
|
*/
|
156 |
|
|
#define SI_USER 0 /* sent by kill, sigsend, raise */
|
157 |
|
|
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
|
158 |
|
|
#define SI_QUEUE -1 /* sent by sigqueue */
|
159 |
|
|
#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
|
160 |
|
|
#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
|
161 |
|
|
#define SI_ASYNCIO -4 /* sent by AIO completion */
|
162 |
|
|
#define SI_SIGIO -5 /* sent by queued SIGIO */
|
163 |
|
|
#define SI_TKILL -6 /* sent by tkill system call */
|
164 |
|
|
#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
|
165 |
|
|
|
166 |
|
|
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
|
167 |
|
|
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
|
168 |
|
|
|
169 |
|
|
/*
|
170 |
|
|
* SIGILL si_codes
|
171 |
|
|
*/
|
172 |
|
|
#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
|
173 |
|
|
#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
|
174 |
|
|
#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
|
175 |
|
|
#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
|
176 |
|
|
#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
|
177 |
|
|
#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
|
178 |
|
|
#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
|
179 |
|
|
#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
|
180 |
|
|
#define NSIGILL 8
|
181 |
|
|
|
182 |
|
|
/*
|
183 |
|
|
* SIGFPE si_codes
|
184 |
|
|
*/
|
185 |
|
|
#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
|
186 |
|
|
#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
|
187 |
|
|
#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
|
188 |
|
|
#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
|
189 |
|
|
#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
|
190 |
|
|
#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
|
191 |
|
|
#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
|
192 |
|
|
#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
|
193 |
|
|
#define NSIGFPE 8
|
194 |
|
|
|
195 |
|
|
/*
|
196 |
|
|
* SIGSEGV si_codes
|
197 |
|
|
*/
|
198 |
|
|
#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
|
199 |
|
|
#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
|
200 |
|
|
#define NSIGSEGV 2
|
201 |
|
|
|
202 |
|
|
/*
|
203 |
|
|
* SIGBUS si_codes
|
204 |
|
|
*/
|
205 |
|
|
#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
|
206 |
|
|
#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
|
207 |
|
|
#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
|
208 |
|
|
/* hardware memory error consumed on a machine check: action required */
|
209 |
|
|
#define BUS_MCEERR_AR (__SI_FAULT|4)
|
210 |
|
|
/* hardware memory error detected in process but not consumed: action optional*/
|
211 |
|
|
#define BUS_MCEERR_AO (__SI_FAULT|5)
|
212 |
|
|
#define NSIGBUS 5
|
213 |
|
|
|
214 |
|
|
/*
|
215 |
|
|
* SIGTRAP si_codes
|
216 |
|
|
*/
|
217 |
|
|
#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
|
218 |
|
|
#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
|
219 |
|
|
#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
|
220 |
|
|
#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
|
221 |
|
|
#define NSIGTRAP 4
|
222 |
|
|
|
223 |
|
|
/*
|
224 |
|
|
* SIGCHLD si_codes
|
225 |
|
|
*/
|
226 |
|
|
#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
|
227 |
|
|
#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
|
228 |
|
|
#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
|
229 |
|
|
#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
|
230 |
|
|
#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
|
231 |
|
|
#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
|
232 |
|
|
#define NSIGCHLD 6
|
233 |
|
|
|
234 |
|
|
/*
|
235 |
|
|
* SIGPOLL si_codes
|
236 |
|
|
*/
|
237 |
|
|
#define POLL_IN (__SI_POLL|1) /* data input available */
|
238 |
|
|
#define POLL_OUT (__SI_POLL|2) /* output buffers available */
|
239 |
|
|
#define POLL_MSG (__SI_POLL|3) /* input message available */
|
240 |
|
|
#define POLL_ERR (__SI_POLL|4) /* i/o error */
|
241 |
|
|
#define POLL_PRI (__SI_POLL|5) /* high priority input available */
|
242 |
|
|
#define POLL_HUP (__SI_POLL|6) /* device disconnected */
|
243 |
|
|
#define NSIGPOLL 6
|
244 |
|
|
|
245 |
|
|
/*
|
246 |
|
|
* SIGSYS si_codes
|
247 |
|
|
*/
|
248 |
|
|
#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
|
249 |
|
|
#define NSIGSYS 1
|
250 |
|
|
|
251 |
|
|
/*
|
252 |
|
|
* sigevent definitions
|
253 |
|
|
*
|
254 |
|
|
* It seems likely that SIGEV_THREAD will have to be handled from
|
255 |
|
|
* userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
|
256 |
|
|
* thread manager then catches and does the appropriate nonsense.
|
257 |
|
|
* However, everything is written out here so as to not get lost.
|
258 |
|
|
*/
|
259 |
|
|
#define SIGEV_SIGNAL 0 /* notify via signal */
|
260 |
|
|
#define SIGEV_NONE 1 /* other notification: meaningless */
|
261 |
|
|
#define SIGEV_THREAD 2 /* deliver via thread creation */
|
262 |
|
|
#define SIGEV_THREAD_ID 4 /* deliver to thread */
|
263 |
|
|
|
264 |
|
|
/*
|
265 |
|
|
* This works because the alignment is ok on all current architectures
|
266 |
|
|
* but we leave open this being overridden in the future
|
267 |
|
|
*/
|
268 |
|
|
#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
|
269 |
|
|
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
|
270 |
|
|
#endif
|
271 |
|
|
|
272 |
|
|
#define SIGEV_MAX_SIZE 64
|
273 |
|
|
#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
|
274 |
|
|
/ sizeof(int))
|
275 |
|
|
|
276 |
|
|
typedef struct sigevent {
|
277 |
|
|
sigval_t sigev_value;
|
278 |
|
|
int sigev_signo;
|
279 |
|
|
int sigev_notify;
|
280 |
|
|
union {
|
281 |
|
|
int _pad[SIGEV_PAD_SIZE];
|
282 |
|
|
int _tid;
|
283 |
|
|
|
284 |
|
|
struct {
|
285 |
|
|
void (*_function)(sigval_t);
|
286 |
|
|
void *_attribute; /* really pthread_attr_t */
|
287 |
|
|
} _sigev_thread;
|
288 |
|
|
} _sigev_un;
|
289 |
|
|
} sigevent_t;
|
290 |
|
|
|
291 |
|
|
#define sigev_notify_function _sigev_un._sigev_thread._function
|
292 |
|
|
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
|
293 |
|
|
#define sigev_notify_thread_id _sigev_un._tid
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
#endif /* _ASM_GENERIC_SIGINFO_H */
|