Skip to main content

libc/unix/linux_like/linux/gnu/b64/x86_64/
mod.rs

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