]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / vendor / libc / src / unix / linux_like / linux / gnu / b64 / x86_64 / mod.rs
CommitLineData
476ff2be
SL
1//! x86_64-specific definitions for 64-bit linux-like values
2
3pub type c_char = i8;
4pub type wchar_t = i32;
5pub type nlink_t = u64;
6pub type blksize_t = i64;
7pub type greg_t = i64;
8bb4bdeb 8pub type suseconds_t = i64;
041b39d2 9pub type __u64 = ::c_ulonglong;
5099ac24 10pub type __s64 = ::c_longlong;
476ff2be
SL
11
12s! {
416331ca
XL
13 pub struct sigaction {
14 pub sa_sigaction: ::sighandler_t,
15 pub sa_mask: ::sigset_t,
16 #[cfg(target_arch = "sparc64")]
17 __reserved0: ::c_int,
18 pub sa_flags: ::c_int,
19 pub sa_restorer: ::Option<extern fn()>,
20 }
21
22 pub struct statfs {
23 pub f_type: ::__fsword_t,
24 pub f_bsize: ::__fsword_t,
25 pub f_blocks: ::fsblkcnt_t,
26 pub f_bfree: ::fsblkcnt_t,
27 pub f_bavail: ::fsblkcnt_t,
28
29 pub f_files: ::fsfilcnt_t,
30 pub f_ffree: ::fsfilcnt_t,
31 pub f_fsid: ::fsid_t,
32
33 pub f_namelen: ::__fsword_t,
34 pub f_frsize: ::__fsword_t,
35 f_spare: [::__fsword_t; 5],
36 }
37
38 pub struct flock {
39 pub l_type: ::c_short,
40 pub l_whence: ::c_short,
41 pub l_start: ::off_t,
42 pub l_len: ::off_t,
43 pub l_pid: ::pid_t,
44 }
45
dfeec247
XL
46 pub struct flock64 {
47 pub l_type: ::c_short,
48 pub l_whence: ::c_short,
49 pub l_start: ::off64_t,
50 pub l_len: ::off64_t,
51 pub l_pid: ::pid_t,
52 }
53
416331ca
XL
54 pub struct siginfo_t {
55 pub si_signo: ::c_int,
56 pub si_errno: ::c_int,
57 pub si_code: ::c_int,
58 #[doc(hidden)]
59 #[deprecated(
60 since="0.2.54",
61 note="Please leave a comment on \
62 https://github.com/rust-lang/libc/pull/1316 if you're using \
63 this field"
64 )]
65 pub _pad: [::c_int; 29],
66 _align: [u64; 0],
67 }
68
69 pub struct stack_t {
70 pub ss_sp: *mut ::c_void,
71 pub ss_flags: ::c_int,
72 pub ss_size: ::size_t
73 }
74
476ff2be
SL
75 pub struct stat {
76 pub st_dev: ::dev_t,
77 pub st_ino: ::ino_t,
78 pub st_nlink: ::nlink_t,
79 pub st_mode: ::mode_t,
80 pub st_uid: ::uid_t,
81 pub st_gid: ::gid_t,
82 __pad0: ::c_int,
83 pub st_rdev: ::dev_t,
84 pub st_size: ::off_t,
85 pub st_blksize: ::blksize_t,
86 pub st_blocks: ::blkcnt_t,
87 pub st_atime: ::time_t,
abe05a73 88 pub st_atime_nsec: i64,
476ff2be 89 pub st_mtime: ::time_t,
abe05a73 90 pub st_mtime_nsec: i64,
476ff2be 91 pub st_ctime: ::time_t,
abe05a73
XL
92 pub st_ctime_nsec: i64,
93 __unused: [i64; 3],
476ff2be
SL
94 }
95
96 pub struct stat64 {
97 pub st_dev: ::dev_t,
98 pub st_ino: ::ino64_t,
99 pub st_nlink: ::nlink_t,
100 pub st_mode: ::mode_t,
101 pub st_uid: ::uid_t,
102 pub st_gid: ::gid_t,
103 __pad0: ::c_int,
104 pub st_rdev: ::dev_t,
105 pub st_size: ::off_t,
106 pub st_blksize: ::blksize_t,
107 pub st_blocks: ::blkcnt64_t,
108 pub st_atime: ::time_t,
abe05a73 109 pub st_atime_nsec: i64,
476ff2be 110 pub st_mtime: ::time_t,
abe05a73 111 pub st_mtime_nsec: i64,
476ff2be 112 pub st_ctime: ::time_t,
abe05a73
XL
113 pub st_ctime_nsec: i64,
114 __reserved: [i64; 3],
476ff2be
SL
115 }
116
ea8adc8c
XL
117 pub struct statfs64 {
118 pub f_type: ::__fsword_t,
119 pub f_bsize: ::__fsword_t,
120 pub f_blocks: u64,
121 pub f_bfree: u64,
122 pub f_bavail: u64,
123 pub f_files: u64,
124 pub f_ffree: u64,
125 pub f_fsid: ::fsid_t,
126 pub f_namelen: ::__fsword_t,
127 pub f_frsize: ::__fsword_t,
128 pub f_flags: ::__fsword_t,
129 pub f_spare: [::__fsword_t; 4],
130 }
131
132 pub struct statvfs64 {
133 pub f_bsize: ::c_ulong,
134 pub f_frsize: ::c_ulong,
135 pub f_blocks: u64,
136 pub f_bfree: u64,
137 pub f_bavail: u64,
138 pub f_files: u64,
139 pub f_ffree: u64,
140 pub f_favail: u64,
141 pub f_fsid: ::c_ulong,
142 pub f_flag: ::c_ulong,
143 pub f_namemax: ::c_ulong,
144 __f_spare: [::c_int; 6],
145 }
146
476ff2be 147 pub struct pthread_attr_t {
abe05a73
XL
148 #[cfg(target_pointer_width = "32")]
149 __size: [u32; 8],
150 #[cfg(target_pointer_width = "64")]
476ff2be
SL
151 __size: [u64; 7]
152 }
153
154 pub struct _libc_fpxreg {
155 pub significand: [u16; 4],
156 pub exponent: u16,
157 __private: [u16; 3],
158 }
159
160 pub struct _libc_xmmreg {
161 pub element: [u32; 4],
162 }
163
164 pub struct _libc_fpstate {
165 pub cwd: u16,
166 pub swd: u16,
167 pub ftw: u16,
168 pub fop: u16,
169 pub rip: u64,
170 pub rdp: u64,
171 pub mxcsr: u32,
172 pub mxcr_mask: u32,
173 pub _st: [_libc_fpxreg; 8],
174 pub _xmm: [_libc_xmmreg; 16],
175 __private: [u64; 12],
176 }
177
041b39d2
XL
178 pub struct user_regs_struct {
179 pub r15: ::c_ulonglong,
180 pub r14: ::c_ulonglong,
181 pub r13: ::c_ulonglong,
182 pub r12: ::c_ulonglong,
183 pub rbp: ::c_ulonglong,
184 pub rbx: ::c_ulonglong,
185 pub r11: ::c_ulonglong,
186 pub r10: ::c_ulonglong,
187 pub r9: ::c_ulonglong,
188 pub r8: ::c_ulonglong,
189 pub rax: ::c_ulonglong,
190 pub rcx: ::c_ulonglong,
191 pub rdx: ::c_ulonglong,
192 pub rsi: ::c_ulonglong,
193 pub rdi: ::c_ulonglong,
194 pub orig_rax: ::c_ulonglong,
195 pub rip: ::c_ulonglong,
196 pub cs: ::c_ulonglong,
197 pub eflags: ::c_ulonglong,
198 pub rsp: ::c_ulonglong,
199 pub ss: ::c_ulonglong,
200 pub fs_base: ::c_ulonglong,
201 pub gs_base: ::c_ulonglong,
202 pub ds: ::c_ulonglong,
203 pub es: ::c_ulonglong,
204 pub fs: ::c_ulonglong,
205 pub gs: ::c_ulonglong,
206 }
207
208 pub struct user {
209 pub regs: user_regs_struct,
210 pub u_fpvalid: ::c_int,
211 pub i387: user_fpregs_struct,
212 pub u_tsize: ::c_ulonglong,
213 pub u_dsize: ::c_ulonglong,
214 pub u_ssize: ::c_ulonglong,
215 pub start_code: ::c_ulonglong,
216 pub start_stack: ::c_ulonglong,
217 pub signal: ::c_longlong,
218 __reserved: ::c_int,
abe05a73
XL
219 #[cfg(target_pointer_width = "32")]
220 __pad1: u32,
041b39d2 221 pub u_ar0: *mut user_regs_struct,
abe05a73
XL
222 #[cfg(target_pointer_width = "32")]
223 __pad2: u32,
041b39d2
XL
224 pub u_fpstate: *mut user_fpregs_struct,
225 pub magic: ::c_ulonglong,
226 pub u_comm: [::c_char; 32],
227 pub u_debugreg: [::c_ulonglong; 8],
228 }
229
476ff2be
SL
230 pub struct mcontext_t {
231 pub gregs: [greg_t; 23],
232 pub fpregs: *mut _libc_fpstate,
233 __private: [u64; 8],
234 }
235
476ff2be
SL
236 pub struct ipc_perm {
237 pub __key: ::key_t,
238 pub uid: ::uid_t,
239 pub gid: ::gid_t,
240 pub cuid: ::uid_t,
241 pub cgid: ::gid_t,
242 pub mode: ::c_ushort,
243 __pad1: ::c_ushort,
244 pub __seq: ::c_ushort,
245 __pad2: ::c_ushort,
abe05a73
XL
246 __unused1: u64,
247 __unused2: u64
476ff2be
SL
248 }
249
250 pub struct shmid_ds {
251 pub shm_perm: ::ipc_perm,
252 pub shm_segsz: ::size_t,
253 pub shm_atime: ::time_t,
254 pub shm_dtime: ::time_t,
255 pub shm_ctime: ::time_t,
256 pub shm_cpid: ::pid_t,
257 pub shm_lpid: ::pid_t,
258 pub shm_nattch: ::shmatt_t,
abe05a73
XL
259 __unused4: u64,
260 __unused5: u64
261 }
262
5099ac24
FG
263 pub struct seccomp_notif_sizes {
264 pub seccomp_notif: ::__u16,
265 pub seccomp_notif_resp: ::__u16,
266 pub seccomp_data: ::__u16,
dfeec247 267 }
476ff2be
SL
268}
269
532ac7d7
XL
270s_no_extra_traits! {
271 pub struct user_fpregs_struct {
272 pub cwd: ::c_ushort,
273 pub swd: ::c_ushort,
274 pub ftw: ::c_ushort,
275 pub fop: ::c_ushort,
276 pub rip: ::c_ulonglong,
277 pub rdp: ::c_ulonglong,
278 pub mxcsr: ::c_uint,
279 pub mxcr_mask: ::c_uint,
280 pub st_space: [::c_uint; 32],
281 pub xmm_space: [::c_uint; 64],
282 padding: [::c_uint; 24],
283 }
284
285 pub struct ucontext_t {
286 pub uc_flags: ::c_ulong,
287 pub uc_link: *mut ucontext_t,
288 pub uc_stack: ::stack_t,
289 pub uc_mcontext: mcontext_t,
290 pub uc_sigmask: ::sigset_t,
291 __private: [u8; 512],
416331ca
XL
292 // FIXME: the shadow stack field requires glibc >= 2.28.
293 // Re-add once we drop compatibility with glibc versions older than
294 // 2.28.
295 //
296 // __ssp: [::c_ulonglong; 4],
532ac7d7
XL
297 }
298}
299
300cfg_if! {
301 if #[cfg(feature = "extra_traits")] {
302 impl PartialEq for user_fpregs_struct {
303 fn eq(&self, other: &user_fpregs_struct) -> bool {
304 self.cwd == other.cwd
305 && self.swd == other.swd
306 && self.ftw == other.ftw
307 && self.fop == other.fop
308 && self.rip == other.rip
309 && self.rdp == other.rdp
310 && self.mxcsr == other.mxcsr
311 && self.mxcr_mask == other.mxcr_mask
312 && self.st_space == other.st_space
313 && self
314 .xmm_space
315 .iter()
316 .zip(other.xmm_space.iter())
317 .all(|(a,b)| a == b)
318 // Ignore padding field
319 }
320 }
321
322 impl Eq for user_fpregs_struct {}
323
324 impl ::fmt::Debug for user_fpregs_struct {
325 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
326 f.debug_struct("user_fpregs_struct")
327 .field("cwd", &self.cwd)
328 .field("ftw", &self.ftw)
329 .field("fop", &self.fop)
330 .field("rip", &self.rip)
331 .field("rdp", &self.rdp)
332 .field("mxcsr", &self.mxcsr)
333 .field("mxcr_mask", &self.mxcr_mask)
334 .field("st_space", &self.st_space)
335 // FIXME: .field("xmm_space", &self.xmm_space)
336 // Ignore padding field
337 .finish()
338 }
339 }
340
341 impl ::hash::Hash for user_fpregs_struct {
342 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
343 self.cwd.hash(state);
344 self.ftw.hash(state);
345 self.fop.hash(state);
346 self.rip.hash(state);
347 self.rdp.hash(state);
348 self.mxcsr.hash(state);
349 self.mxcr_mask.hash(state);
350 self.st_space.hash(state);
351 self.xmm_space.hash(state);
352 // Ignore padding field
353 }
354 }
355
356 impl PartialEq for ucontext_t {
357 fn eq(&self, other: &ucontext_t) -> bool {
358 self.uc_flags == other.uc_flags
359 && self.uc_link == other.uc_link
360 && self.uc_stack == other.uc_stack
361 && self.uc_mcontext == other.uc_mcontext
362 && self.uc_sigmask == other.uc_sigmask
363 // Ignore __private field
364 }
365 }
366
367 impl Eq for ucontext_t {}
368
369 impl ::fmt::Debug for ucontext_t {
370 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
371 f.debug_struct("ucontext_t")
372 .field("uc_flags", &self.uc_flags)
373 .field("uc_link", &self.uc_link)
374 .field("uc_stack", &self.uc_stack)
375 .field("uc_mcontext", &self.uc_mcontext)
376 .field("uc_sigmask", &self.uc_sigmask)
377 // Ignore __private field
378 .finish()
379 }
380 }
381
382 impl ::hash::Hash for ucontext_t {
383 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
384 self.uc_flags.hash(state);
385 self.uc_link.hash(state);
386 self.uc_stack.hash(state);
387 self.uc_mcontext.hash(state);
388 self.uc_sigmask.hash(state);
389 // Ignore __private field
390 }
391 }
392 }
393}
394
416331ca
XL
395pub const POSIX_FADV_DONTNEED: ::c_int = 4;
396pub const POSIX_FADV_NOREUSE: ::c_int = 5;
397
398pub const VEOF: usize = 4;
399pub const RTLD_DEEPBIND: ::c_int = 0x8;
400pub const RTLD_GLOBAL: ::c_int = 0x100;
401pub const RTLD_NOLOAD: ::c_int = 0x4;
8bb4bdeb 402
8bb4bdeb
XL
403pub const O_APPEND: ::c_int = 1024;
404pub const O_CREAT: ::c_int = 64;
405pub const O_EXCL: ::c_int = 128;
406pub const O_NOCTTY: ::c_int = 256;
407pub const O_NONBLOCK: ::c_int = 2048;
408pub const O_SYNC: ::c_int = 1052672;
409pub const O_RSYNC: ::c_int = 1052672;
410pub const O_DSYNC: ::c_int = 4096;
411pub const O_FSYNC: ::c_int = 0x101000;
3b2f2976
XL
412pub const O_NOATIME: ::c_int = 0o1000000;
413pub const O_PATH: ::c_int = 0o10000000;
ff7c6d11 414pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
8bb4bdeb 415
416331ca 416pub const MADV_SOFT_OFFLINE: ::c_int = 101;
8bb4bdeb
XL
417pub const MAP_GROWSDOWN: ::c_int = 0x0100;
418
419pub const EDEADLK: ::c_int = 35;
420pub const ENAMETOOLONG: ::c_int = 36;
421pub const ENOLCK: ::c_int = 37;
422pub const ENOSYS: ::c_int = 38;
423pub const ENOTEMPTY: ::c_int = 39;
424pub const ELOOP: ::c_int = 40;
425pub const ENOMSG: ::c_int = 42;
426pub const EIDRM: ::c_int = 43;
427pub const ECHRNG: ::c_int = 44;
428pub const EL2NSYNC: ::c_int = 45;
429pub const EL3HLT: ::c_int = 46;
430pub const EL3RST: ::c_int = 47;
431pub const ELNRNG: ::c_int = 48;
432pub const EUNATCH: ::c_int = 49;
433pub const ENOCSI: ::c_int = 50;
434pub const EL2HLT: ::c_int = 51;
435pub const EBADE: ::c_int = 52;
436pub const EBADR: ::c_int = 53;
437pub const EXFULL: ::c_int = 54;
438pub const ENOANO: ::c_int = 55;
439pub const EBADRQC: ::c_int = 56;
440pub const EBADSLT: ::c_int = 57;
441pub const EMULTIHOP: ::c_int = 72;
442pub const EOVERFLOW: ::c_int = 75;
443pub const ENOTUNIQ: ::c_int = 76;
444pub const EBADFD: ::c_int = 77;
445pub const EBADMSG: ::c_int = 74;
446pub const EREMCHG: ::c_int = 78;
447pub const ELIBACC: ::c_int = 79;
448pub const ELIBBAD: ::c_int = 80;
449pub const ELIBSCN: ::c_int = 81;
450pub const ELIBMAX: ::c_int = 82;
451pub const ELIBEXEC: ::c_int = 83;
452pub const EILSEQ: ::c_int = 84;
453pub const ERESTART: ::c_int = 85;
454pub const ESTRPIPE: ::c_int = 86;
455pub const EUSERS: ::c_int = 87;
456pub const ENOTSOCK: ::c_int = 88;
457pub const EDESTADDRREQ: ::c_int = 89;
458pub const EMSGSIZE: ::c_int = 90;
459pub const EPROTOTYPE: ::c_int = 91;
460pub const ENOPROTOOPT: ::c_int = 92;
461pub const EPROTONOSUPPORT: ::c_int = 93;
462pub const ESOCKTNOSUPPORT: ::c_int = 94;
463pub const EOPNOTSUPP: ::c_int = 95;
464pub const EPFNOSUPPORT: ::c_int = 96;
465pub const EAFNOSUPPORT: ::c_int = 97;
466pub const EADDRINUSE: ::c_int = 98;
467pub const EADDRNOTAVAIL: ::c_int = 99;
468pub const ENETDOWN: ::c_int = 100;
469pub const ENETUNREACH: ::c_int = 101;
470pub const ENETRESET: ::c_int = 102;
471pub const ECONNABORTED: ::c_int = 103;
472pub const ECONNRESET: ::c_int = 104;
473pub const ENOBUFS: ::c_int = 105;
474pub const EISCONN: ::c_int = 106;
475pub const ENOTCONN: ::c_int = 107;
476pub const ESHUTDOWN: ::c_int = 108;
477pub const ETOOMANYREFS: ::c_int = 109;
478pub const ETIMEDOUT: ::c_int = 110;
479pub const ECONNREFUSED: ::c_int = 111;
480pub const EHOSTDOWN: ::c_int = 112;
481pub const EHOSTUNREACH: ::c_int = 113;
482pub const EALREADY: ::c_int = 114;
483pub const EINPROGRESS: ::c_int = 115;
484pub const ESTALE: ::c_int = 116;
485pub const EDQUOT: ::c_int = 122;
486pub const ENOMEDIUM: ::c_int = 123;
487pub const EMEDIUMTYPE: ::c_int = 124;
488pub const ECANCELED: ::c_int = 125;
489pub const ENOKEY: ::c_int = 126;
490pub const EKEYEXPIRED: ::c_int = 127;
491pub const EKEYREVOKED: ::c_int = 128;
492pub const EKEYREJECTED: ::c_int = 129;
493pub const EOWNERDEAD: ::c_int = 130;
494pub const ENOTRECOVERABLE: ::c_int = 131;
495pub const EHWPOISON: ::c_int = 133;
496pub const ERFKILL: ::c_int = 132;
497
416331ca
XL
498pub const SOCK_STREAM: ::c_int = 1;
499pub const SOCK_DGRAM: ::c_int = 2;
500
8bb4bdeb
XL
501pub const SA_ONSTACK: ::c_int = 0x08000000;
502pub const SA_SIGINFO: ::c_int = 0x00000004;
503pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
504
416331ca
XL
505pub const SIGTTIN: ::c_int = 21;
506pub const SIGTTOU: ::c_int = 22;
507pub const SIGXCPU: ::c_int = 24;
508pub const SIGXFSZ: ::c_int = 25;
509pub const SIGVTALRM: ::c_int = 26;
510pub const SIGPROF: ::c_int = 27;
511pub const SIGWINCH: ::c_int = 28;
8bb4bdeb
XL
512pub const SIGCHLD: ::c_int = 17;
513pub const SIGBUS: ::c_int = 7;
514pub const SIGUSR1: ::c_int = 10;
515pub const SIGUSR2: ::c_int = 12;
516pub const SIGCONT: ::c_int = 18;
517pub const SIGSTOP: ::c_int = 19;
518pub const SIGTSTP: ::c_int = 20;
519pub const SIGURG: ::c_int = 23;
520pub const SIGIO: ::c_int = 29;
521pub const SIGSYS: ::c_int = 31;
522pub const SIGSTKFLT: ::c_int = 16;
e74abb32 523#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
8bb4bdeb
XL
524pub const SIGUNUSED: ::c_int = 31;
525pub const SIGPOLL: ::c_int = 29;
526pub const SIGPWR: ::c_int = 30;
527pub const SIG_SETMASK: ::c_int = 2;
528pub const SIG_BLOCK: ::c_int = 0x000000;
529pub const SIG_UNBLOCK: ::c_int = 0x01;
530
531pub const POLLWRNORM: ::c_short = 0x100;
532pub const POLLWRBAND: ::c_short = 0x200;
533
534pub const O_ASYNC: ::c_int = 0x2000;
535pub const O_NDELAY: ::c_int = 0x800;
536
537pub const PTRACE_DETACH: ::c_uint = 17;
538
539pub const EFD_NONBLOCK: ::c_int = 0x800;
540
541pub const F_GETLK: ::c_int = 5;
542pub const F_GETOWN: ::c_int = 9;
543pub const F_SETOWN: ::c_int = 8;
544pub const F_SETLK: ::c_int = 6;
545pub const F_SETLKW: ::c_int = 7;
ba9703b0
XL
546pub const F_OFD_GETLK: ::c_int = 36;
547pub const F_OFD_SETLK: ::c_int = 37;
548pub const F_OFD_SETLKW: ::c_int = 38;
8bb4bdeb 549
8faf50e0
XL
550pub const F_RDLCK: ::c_int = 0;
551pub const F_WRLCK: ::c_int = 1;
552pub const F_UNLCK: ::c_int = 2;
553
8bb4bdeb
XL
554pub const SFD_NONBLOCK: ::c_int = 0x0800;
555
416331ca
XL
556pub const TCSANOW: ::c_int = 0;
557pub const TCSADRAIN: ::c_int = 1;
558pub const TCSAFLUSH: ::c_int = 2;
559
8bb4bdeb
XL
560pub const SFD_CLOEXEC: ::c_int = 0x080000;
561
562pub const NCCS: usize = 32;
563
564pub const O_TRUNC: ::c_int = 512;
565
566pub const O_CLOEXEC: ::c_int = 0x80000;
567
568pub const EBFONT: ::c_int = 59;
569pub const ENOSTR: ::c_int = 60;
570pub const ENODATA: ::c_int = 61;
571pub const ETIME: ::c_int = 62;
572pub const ENOSR: ::c_int = 63;
573pub const ENONET: ::c_int = 64;
574pub const ENOPKG: ::c_int = 65;
575pub const EREMOTE: ::c_int = 66;
576pub const ENOLINK: ::c_int = 67;
577pub const EADV: ::c_int = 68;
578pub const ESRMNT: ::c_int = 69;
579pub const ECOMM: ::c_int = 70;
580pub const EPROTO: ::c_int = 71;
581pub const EDOTDOT: ::c_int = 73;
582
583pub const SA_NODEFER: ::c_int = 0x40000000;
584pub const SA_RESETHAND: ::c_int = 0x80000000;
585pub const SA_RESTART: ::c_int = 0x10000000;
586pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
587
588pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
589
590pub const EFD_CLOEXEC: ::c_int = 0x80000;
591
476ff2be 592pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
476ff2be
SL
593pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
594
595pub const O_DIRECT: ::c_int = 0x4000;
596pub const O_DIRECTORY: ::c_int = 0x10000;
597pub const O_NOFOLLOW: ::c_int = 0x20000;
598
416331ca 599pub const MAP_HUGETLB: ::c_int = 0x040000;
476ff2be
SL
600pub const MAP_LOCKED: ::c_int = 0x02000;
601pub const MAP_NORESERVE: ::c_int = 0x04000;
602pub const MAP_32BIT: ::c_int = 0x0040;
416331ca
XL
603pub const MAP_ANON: ::c_int = 0x0020;
604pub const MAP_ANONYMOUS: ::c_int = 0x0020;
605pub const MAP_DENYWRITE: ::c_int = 0x0800;
606pub const MAP_EXECUTABLE: ::c_int = 0x01000;
607pub const MAP_POPULATE: ::c_int = 0x08000;
608pub const MAP_NONBLOCK: ::c_int = 0x010000;
609pub const MAP_STACK: ::c_int = 0x020000;
5869c6ff 610pub const MAP_SYNC: ::c_int = 0x080000;
476ff2be
SL
611
612pub const EDEADLOCK: ::c_int = 35;
416331ca
XL
613pub const EUCLEAN: ::c_int = 117;
614pub const ENOTNAM: ::c_int = 118;
615pub const ENAVAIL: ::c_int = 119;
616pub const EISNAM: ::c_int = 120;
617pub const EREMOTEIO: ::c_int = 121;
476ff2be 618
476ff2be
SL
619pub const PTRACE_GETFPREGS: ::c_uint = 14;
620pub const PTRACE_SETFPREGS: ::c_uint = 15;
621pub const PTRACE_GETFPXREGS: ::c_uint = 18;
622pub const PTRACE_SETFPXREGS: ::c_uint = 19;
623pub const PTRACE_GETREGS: ::c_uint = 12;
624pub const PTRACE_SETREGS: ::c_uint = 13;
476ff2be 625pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1;
f035d41b
XL
626pub const PTRACE_SYSEMU: ::c_uint = 31;
627pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
476ff2be 628
476ff2be
SL
629pub const MCL_CURRENT: ::c_int = 0x0001;
630pub const MCL_FUTURE: ::c_int = 0x0002;
631
632pub const SIGSTKSZ: ::size_t = 8192;
7cac9316 633pub const MINSIGSTKSZ: ::size_t = 2048;
476ff2be 634pub const CBAUD: ::tcflag_t = 0o0010017;
416331ca
XL
635pub const TAB1: ::tcflag_t = 0x00000800;
636pub const TAB2: ::tcflag_t = 0x00001000;
637pub const TAB3: ::tcflag_t = 0x00001800;
638pub const CR1: ::tcflag_t = 0x00000200;
639pub const CR2: ::tcflag_t = 0x00000400;
640pub const CR3: ::tcflag_t = 0x00000600;
641pub const FF1: ::tcflag_t = 0x00008000;
642pub const BS1: ::tcflag_t = 0x00002000;
643pub const VT1: ::tcflag_t = 0x00004000;
476ff2be
SL
644pub const VWERASE: usize = 14;
645pub const VREPRINT: usize = 12;
646pub const VSUSP: usize = 10;
647pub const VSTART: usize = 8;
648pub const VSTOP: usize = 9;
649pub const VDISCARD: usize = 13;
650pub const VTIME: usize = 5;
651pub const IXON: ::tcflag_t = 0x00000400;
652pub const IXOFF: ::tcflag_t = 0x00001000;
653pub const ONLCR: ::tcflag_t = 0x4;
654pub const CSIZE: ::tcflag_t = 0x00000030;
655pub const CS6: ::tcflag_t = 0x00000010;
656pub const CS7: ::tcflag_t = 0x00000020;
657pub const CS8: ::tcflag_t = 0x00000030;
658pub const CSTOPB: ::tcflag_t = 0x00000040;
659pub const CREAD: ::tcflag_t = 0x00000080;
660pub const PARENB: ::tcflag_t = 0x00000100;
661pub const PARODD: ::tcflag_t = 0x00000200;
662pub const HUPCL: ::tcflag_t = 0x00000400;
663pub const CLOCAL: ::tcflag_t = 0x00000800;
664pub const ECHOKE: ::tcflag_t = 0x00000800;
665pub const ECHOE: ::tcflag_t = 0x00000010;
666pub const ECHOK: ::tcflag_t = 0x00000020;
667pub const ECHONL: ::tcflag_t = 0x00000040;
668pub const ECHOPRT: ::tcflag_t = 0x00000400;
669pub const ECHOCTL: ::tcflag_t = 0x00000200;
670pub const ISIG: ::tcflag_t = 0x00000001;
671pub const ICANON: ::tcflag_t = 0x00000002;
672pub const PENDIN: ::tcflag_t = 0x00004000;
673pub const NOFLSH: ::tcflag_t = 0x00000080;
041b39d2
XL
674pub const CIBAUD: ::tcflag_t = 0o02003600000;
675pub const CBAUDEX: ::tcflag_t = 0o010000;
676pub const VSWTC: usize = 7;
e74abb32
XL
677pub const OLCUC: ::tcflag_t = 0o000002;
678pub const NLDLY: ::tcflag_t = 0o000400;
679pub const CRDLY: ::tcflag_t = 0o003000;
041b39d2 680pub const TABDLY: ::tcflag_t = 0o014000;
e74abb32
XL
681pub const BSDLY: ::tcflag_t = 0o020000;
682pub const FFDLY: ::tcflag_t = 0o100000;
683pub const VTDLY: ::tcflag_t = 0o040000;
684pub const XTABS: ::tcflag_t = 0o014000;
476ff2be 685
8bb4bdeb
XL
686pub const B0: ::speed_t = 0o000000;
687pub const B50: ::speed_t = 0o000001;
688pub const B75: ::speed_t = 0o000002;
689pub const B110: ::speed_t = 0o000003;
690pub const B134: ::speed_t = 0o000004;
691pub const B150: ::speed_t = 0o000005;
692pub const B200: ::speed_t = 0o000006;
693pub const B300: ::speed_t = 0o000007;
694pub const B600: ::speed_t = 0o000010;
695pub const B1200: ::speed_t = 0o000011;
696pub const B1800: ::speed_t = 0o000012;
697pub const B2400: ::speed_t = 0o000013;
698pub const B4800: ::speed_t = 0o000014;
699pub const B9600: ::speed_t = 0o000015;
700pub const B19200: ::speed_t = 0o000016;
701pub const B38400: ::speed_t = 0o000017;
702pub const EXTA: ::speed_t = B19200;
703pub const EXTB: ::speed_t = B38400;
704pub const B57600: ::speed_t = 0o010001;
705pub const B115200: ::speed_t = 0o010002;
706pub const B230400: ::speed_t = 0o010003;
707pub const B460800: ::speed_t = 0o010004;
708pub const B500000: ::speed_t = 0o010005;
709pub const B576000: ::speed_t = 0o010006;
710pub const B921600: ::speed_t = 0o010007;
711pub const B1000000: ::speed_t = 0o010010;
712pub const B1152000: ::speed_t = 0o010011;
713pub const B1500000: ::speed_t = 0o010012;
714pub const B2000000: ::speed_t = 0o010013;
715pub const B2500000: ::speed_t = 0o010014;
716pub const B3000000: ::speed_t = 0o010015;
717pub const B3500000: ::speed_t = 0o010016;
718pub const B4000000: ::speed_t = 0o010017;
719
476ff2be
SL
720pub const VEOL: usize = 11;
721pub const VEOL2: usize = 16;
722pub const VMIN: usize = 6;
723pub const IEXTEN: ::tcflag_t = 0x00008000;
724pub const TOSTOP: ::tcflag_t = 0x00000100;
725pub const FLUSHO: ::tcflag_t = 0x00001000;
726pub const EXTPROC: ::tcflag_t = 0x00010000;
476ff2be 727
3b2f2976
XL
728// offsets in user_regs_structs, from sys/reg.h
729pub const R15: ::c_int = 0;
730pub const R14: ::c_int = 1;
731pub const R13: ::c_int = 2;
732pub const R12: ::c_int = 3;
733pub const RBP: ::c_int = 4;
734pub const RBX: ::c_int = 5;
735pub const R11: ::c_int = 6;
736pub const R10: ::c_int = 7;
737pub const R9: ::c_int = 8;
738pub const R8: ::c_int = 9;
739pub const RAX: ::c_int = 10;
740pub const RCX: ::c_int = 11;
741pub const RDX: ::c_int = 12;
742pub const RSI: ::c_int = 13;
743pub const RDI: ::c_int = 14;
744pub const ORIG_RAX: ::c_int = 15;
745pub const RIP: ::c_int = 16;
746pub const CS: ::c_int = 17;
747pub const EFLAGS: ::c_int = 18;
748pub const RSP: ::c_int = 19;
749pub const SS: ::c_int = 20;
750pub const FS_BASE: ::c_int = 21;
751pub const GS_BASE: ::c_int = 22;
752pub const DS: ::c_int = 23;
753pub const ES: ::c_int = 24;
754pub const FS: ::c_int = 25;
755pub const GS: ::c_int = 26;
756
532ac7d7
XL
757// offsets in mcontext_t.gregs from sys/ucontext.h
758pub const REG_R8: ::c_int = 0;
759pub const REG_R9: ::c_int = 1;
760pub const REG_R10: ::c_int = 2;
761pub const REG_R11: ::c_int = 3;
762pub const REG_R12: ::c_int = 4;
763pub const REG_R13: ::c_int = 5;
764pub const REG_R14: ::c_int = 6;
765pub const REG_R15: ::c_int = 7;
766pub const REG_RDI: ::c_int = 8;
767pub const REG_RSI: ::c_int = 9;
768pub const REG_RBP: ::c_int = 10;
769pub const REG_RBX: ::c_int = 11;
770pub const REG_RDX: ::c_int = 12;
771pub const REG_RAX: ::c_int = 13;
772pub const REG_RCX: ::c_int = 14;
773pub const REG_RSP: ::c_int = 15;
774pub const REG_RIP: ::c_int = 16;
775pub const REG_EFL: ::c_int = 17;
776pub const REG_CSGSFS: ::c_int = 18;
777pub const REG_ERR: ::c_int = 19;
778pub const REG_TRAPNO: ::c_int = 20;
779pub const REG_OLDMASK: ::c_int = 21;
780pub const REG_CR2: ::c_int = 22;
781
5099ac24
FG
782pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
783pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
784pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
785pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
786
e74abb32 787extern "C" {
476ff2be
SL
788 pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
789 pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
cdc7bbd5
XL
790 pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...);
791 pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
041b39d2 792 pub fn iopl(level: ::c_int) -> ::c_int;
cdc7bbd5 793 pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int;
476ff2be 794}
416331ca
XL
795
796cfg_if! {
797 if #[cfg(target_pointer_width = "32")] {
798 mod x32;
799 pub use self::x32::*;
800 } else {
801 mod not_x32;
802 pub use self::not_x32::*;
803 }
804}
e74abb32
XL
805
806cfg_if! {
807 if #[cfg(libc_align)] {
808 mod align;
809 pub use self::align::*;
810 }
811}