1#ifndef _ASM_GENERIC_SIGINFO_H
2#define _ASM_GENERIC_SIGINFO_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12
13
14
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
31
32
33
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef HAVE_ARCH_SIGINFO_T
39
40typedef struct siginfo {
41 int si_signo;
42 int si_errno;
43 int si_code;
44
45 union {
46 int _pad[SI_PAD_SIZE];
47
48
49 struct {
50 __kernel_pid_t _pid;
51 __ARCH_SI_UID_T _uid;
52 } _kill;
53
54
55 struct {
56 __kernel_timer_t _tid;
57 int _overrun;
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval;
60 int _sys_private;
61 } _timer;
62
63
64 struct {
65 __kernel_pid_t _pid;
66 __ARCH_SI_UID_T _uid;
67 sigval_t _sigval;
68 } _rt;
69
70
71 struct {
72 __kernel_pid_t _pid;
73 __ARCH_SI_UID_T _uid;
74 int _status;
75 __kernel_clock_t _utime;
76 __kernel_clock_t _stime;
77 } _sigchld;
78
79
80 struct {
81 void __user *_addr;
82#ifdef __ARCH_SI_TRAPNO
83 int _trapno;
84#endif
85 short _addr_lsb;
86 } _sigfault;
87
88
89 struct {
90 __ARCH_SI_BAND_T _band;
91 int _fd;
92 } _sigpoll;
93 } _sifields;
94} siginfo_t;
95
96#endif
97
98
99
100
101#define si_pid _sifields._kill._pid
102#define si_uid _sifields._kill._uid
103#define si_tid _sifields._timer._tid
104#define si_overrun _sifields._timer._overrun
105#define si_sys_private _sifields._timer._sys_private
106#define si_status _sifields._sigchld._status
107#define si_utime _sifields._sigchld._utime
108#define si_stime _sifields._sigchld._stime
109#define si_value _sifields._rt._sigval
110#define si_int _sifields._rt._sigval.sival_int
111#define si_ptr _sifields._rt._sigval.sival_ptr
112#define si_addr _sifields._sigfault._addr
113#ifdef __ARCH_SI_TRAPNO
114#define si_trapno _sifields._sigfault._trapno
115#endif
116#define si_addr_lsb _sifields._sigfault._addr_lsb
117#define si_band _sifields._sigpoll._band
118#define si_fd _sifields._sigpoll._fd
119
120#ifdef __KERNEL__
121#define __SI_MASK 0xffff0000u
122#define __SI_KILL (0 << 16)
123#define __SI_TIMER (1 << 16)
124#define __SI_POLL (2 << 16)
125#define __SI_FAULT (3 << 16)
126#define __SI_CHLD (4 << 16)
127#define __SI_RT (5 << 16)
128#define __SI_MESGQ (6 << 16)
129#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
130#else
131#define __SI_KILL 0
132#define __SI_TIMER 0
133#define __SI_POLL 0
134#define __SI_FAULT 0
135#define __SI_CHLD 0
136#define __SI_RT 0
137#define __SI_MESGQ 0
138#define __SI_CODE(T,N) (N)
139#endif
140
141
142
143
144
145#define SI_USER 0
146#define SI_KERNEL 0x80
147#define SI_QUEUE -1
148#define SI_TIMER __SI_CODE(__SI_TIMER,-2)
149#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3)
150#define SI_ASYNCIO -4
151#define SI_SIGIO -5
152#define SI_TKILL -6
153#define SI_DETHREAD -7
154
155#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
156#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
157
158
159
160
161#define ILL_ILLOPC (__SI_FAULT|1)
162#define ILL_ILLOPN (__SI_FAULT|2)
163#define ILL_ILLADR (__SI_FAULT|3)
164#define ILL_ILLTRP (__SI_FAULT|4)
165#define ILL_PRVOPC (__SI_FAULT|5)
166#define ILL_PRVREG (__SI_FAULT|6)
167#define ILL_COPROC (__SI_FAULT|7)
168#define ILL_BADSTK (__SI_FAULT|8)
169#define NSIGILL 8
170
171
172
173
174#define FPE_INTDIV (__SI_FAULT|1)
175#define FPE_INTOVF (__SI_FAULT|2)
176#define FPE_FLTDIV (__SI_FAULT|3)
177#define FPE_FLTOVF (__SI_FAULT|4)
178#define FPE_FLTUND (__SI_FAULT|5)
179#define FPE_FLTRES (__SI_FAULT|6)
180#define FPE_FLTINV (__SI_FAULT|7)
181#define FPE_FLTSUB (__SI_FAULT|8)
182#define NSIGFPE 8
183
184
185
186
187#define SEGV_MAPERR (__SI_FAULT|1)
188#define SEGV_ACCERR (__SI_FAULT|2)
189#define NSIGSEGV 2
190
191
192
193
194#define BUS_ADRALN (__SI_FAULT|1)
195#define BUS_ADRERR (__SI_FAULT|2)
196#define BUS_OBJERR (__SI_FAULT|3)
197
198#define BUS_MCEERR_AR (__SI_FAULT|4)
199
200#define BUS_MCEERR_AO (__SI_FAULT|5)
201#define NSIGBUS 5
202
203
204
205
206#define TRAP_BRKPT (__SI_FAULT|1)
207#define TRAP_TRACE (__SI_FAULT|2)
208#define TRAP_BRANCH (__SI_FAULT|3)
209#define TRAP_HWBKPT (__SI_FAULT|4)
210#define NSIGTRAP 4
211
212
213
214
215#define CLD_EXITED (__SI_CHLD|1)
216#define CLD_KILLED (__SI_CHLD|2)
217#define CLD_DUMPED (__SI_CHLD|3)
218#define CLD_TRAPPED (__SI_CHLD|4)
219#define CLD_STOPPED (__SI_CHLD|5)
220#define CLD_CONTINUED (__SI_CHLD|6)
221#define NSIGCHLD 6
222
223
224
225
226#define POLL_IN (__SI_POLL|1)
227#define POLL_OUT (__SI_POLL|2)
228#define POLL_MSG (__SI_POLL|3)
229#define POLL_ERR (__SI_POLL|4)
230#define POLL_PRI (__SI_POLL|5)
231#define POLL_HUP (__SI_POLL|6)
232#define NSIGPOLL 6
233
234
235
236
237
238
239
240
241
242#define SIGEV_SIGNAL 0
243#define SIGEV_NONE 1
244#define SIGEV_THREAD 2
245#define SIGEV_THREAD_ID 4
246
247
248
249
250
251#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
252#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
253#endif
254
255#define SIGEV_MAX_SIZE 64
256#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
257 / sizeof(int))
258
259typedef struct sigevent {
260 sigval_t sigev_value;
261 int sigev_signo;
262 int sigev_notify;
263 union {
264 int _pad[SIGEV_PAD_SIZE];
265 int _tid;
266
267 struct {
268 void (*_function)(sigval_t);
269 void *_attribute;
270 } _sigev_thread;
271 } _sigev_un;
272} sigevent_t;
273
274#define sigev_notify_function _sigev_un._sigev_thread._function
275#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
276#define sigev_notify_thread_id _sigev_un._tid
277
278#ifdef __KERNEL__
279
280struct siginfo;
281void do_schedule_next_timer(struct siginfo *info);
282
283#ifndef HAVE_ARCH_COPY_SIGINFO
284
285#include <linux/string.h>
286
287static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
288{
289 if (from->si_code < 0)
290 memcpy(to, from, sizeof(*to));
291 else
292
293 memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
294}
295
296#endif
297
298extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
299
300#endif
301
302#endif
303