1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
use super::types::*;
use core::mem::size_of;
#[repr(C)]
#[derive(Clone, Copy)]
pub union sigval_t {
sival_int: i32,
sival_ptr: usize,
}
pub const SI_MAX_SIZE: usize = 128;
pub type arch_si_band_t = isize;
pub type arch_si_clock_t = clock_t;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_kill_t {
pub pid: pid_t,
pub uid: uid_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_timer_t {
pub tid: timer_t,
pub overrun: i32,
pub sigval: sigval_t,
sys_private: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_rt_t {
pub pid: pid_t,
pub uid: uid_t,
pub sigval: sigval_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_sigchld_t {
pub pid: pid_t,
pub uid: uid_t,
pub status: i32,
pub utime: arch_si_clock_t,
pub stime: arch_si_clock_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_sigpoll_t {
pub band: arch_si_band_t,
pub fd: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct si_sigsys_t {
pub call_addr: usize,
pub syscall: i32,
pub arch: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union sifields_t {
pub kill: si_kill_t,
pub timer: si_timer_t,
pub rt: si_rt_t,
pub sigchld: si_sigchld_t,
pub sigpoll: si_sigpoll_t,
pub sigsys: si_sigsys_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct siginfo_intern_t {
pub si_signo: i32,
pub si_errno: i32,
pub si_code: i32,
pub sifields: sifields_t,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union siginfo_t {
pub siginfo: siginfo_intern_t,
si_pad: [u8; SI_MAX_SIZE / size_of::<i32>()],
}
pub const SI_USER: i32 = 0;
pub const SI_KERNEL: i32 = 0x80;
pub const SI_QUEUE: i32 = -1;
pub const SI_TIMER: i32 = -2;
pub const SI_MESGQ: i32 = -3;
pub const SI_ASYNCIO: i32 = -4;
pub const SI_SIGIO: i32 = -5;
pub const SI_TKILL: i32 = -6;
pub const SI_DETHREAD: i32 = -7;
pub const SI_ASYNCNL: i32 = -60;
pub const ILL_ILLOPC: i32 = 1;
pub const ILL_ILLOPN: i32 = 2;
pub const ILL_ILLADR: i32 = 3;
pub const ILL_ILLTRP: i32 = 4;
pub const ILL_PRVOPC: i32 = 5;
pub const ILL_PRVREG: i32 = 6;
pub const ILL_COPROC: i32 = 7;
pub const ILL_BADSTK: i32 = 8;
pub const ILL_BADIADDR: i32 = 9;
pub const __ILL_BREAK: i32 = 10;
pub const __ILL_BNDMOD: i32 = 11;
pub const NSIGILL: i32 = 11;
pub const FPE_INTDIV: i32 = 1;
pub const FPE_INTOVF: i32 = 2;
pub const FPE_FLTDIV: i32 = 3;
pub const FPE_FLTOVF: i32 = 4;
pub const FPE_FLTUND: i32 = 5;
pub const FPE_FLTRES: i32 = 6;
pub const FPE_FLTINV: i32 = 7;
pub const FPE_FLTSUB: i32 = 8;
pub const __FPE_DECOVF: i32 = 9;
pub const __FPE_DECDIV: i32 = 10;
pub const __FPE_DECERR: i32 = 11;
pub const __FPE_INVASC: i32 = 12;
pub const __FPE_INVDEC: i32 = 13;
pub const FPE_FLTUNK: i32 = 14;
pub const FPE_CONDTRAP: i32 = 15;
pub const NSIGFPE: i32 = 15;
pub const SEGV_MAPERR: i32 = 1;
pub const SEGV_ACCERR: i32 = 2;
pub const SEGV_BNDERR: i32 = 3;
pub const SEGV_PKUERR: i32 = 4;
pub const SEGV_ACCADI: i32 = 5;
pub const SEGV_ADIDERR: i32 = 6;
pub const SEGV_ADIPERR: i32 = 7;
pub const NSIGSEGV: i32 = 7;
pub const BUS_ADRALN: i32 = 1;
pub const BUS_ADRERR: i32 = 2;
pub const BUS_OBJERR: i32 = 3;
pub const BUS_MCEERR_AR: i32 = 4;
pub const BUS_MCEERR_AO: i32 = 5;
pub const NSIGBUS: i32 = 5;
pub const TRAP_BRKPT: i32 = 1;
pub const TRAP_TRACE: i32 = 2;
pub const TRAP_BRANCH: i32 = 3;
pub const TRAP_HWBKPT: i32 = 4;
pub const TRAP_UNK: i32 = 5;
pub const NSIGTRAP: i32 = 5;
pub const CLD_EXITED: i32 = 1;
pub const CLD_KILLED: i32 = 2;
pub const CLD_DUMPED: i32 = 3;
pub const CLD_TRAPPED: i32 = 4;
pub const CLD_STOPPED: i32 = 5;
pub const CLD_CONTINUED: i32 = 6;
pub const NSIGCHLD: i32 = 6;
pub const POLL_IN: i32 = 1;
pub const POLL_OUT: i32 = 2;
pub const POLL_MSG: i32 = 3;
pub const POLL_ERR: i32 = 4;
pub const POLL_PRI: i32 = 5;
pub const POLL_HUP: i32 = 6;
pub const NSIGPOLL: i32 = 6;
pub const SYS_SECCOMP: i32 = 1;
pub const NSIGSYS: i32 = 1;
pub const EMT_TAGOVF: i32 = 1;
pub const NSIGEMT: i32 = 1;
pub const SIGEV_SIGNAL: i32 = 0;
pub const SIGEV_NONE: i32 = 1;
pub const SIGEV_THREAD: i32 = 2;
pub const SIGEV_THREAD_ID: i32 = 4;
const ARCH_SIGEV_PREAMBLE_SIZE: usize = (size_of::<i32>() * 2 + size_of::<sigval_t>());
pub const SIGEV_MAX_SIZE: usize = 64;
pub const SIGEV_PAD_SIZE: usize = ((SIGEV_MAX_SIZE - ARCH_SIGEV_PREAMBLE_SIZE) / size_of::<i32>());
#[repr(C)]
#[derive(Clone, Copy)]
pub struct sigev_thread_t {
pub function: usize,
pub attribute: usize,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union sigev_un_t {
pad: [i32; SIGEV_PAD_SIZE],
pub tid: i32,
pub sigev_thread: sigev_thread_t,
}
#[repr(C)]
pub struct sigevent_t {
pub sigev_value: sigval_t,
pub sigev_signo: i32,
pub sigev_notify: i32,
pub sigev_un: sigev_un_t,
}