1 //! x86_64-specific definitions for 64-bit linux-like values 2 3 pub type c_char = i8; 4 pub type wchar_t = i32; 5 pub type nlink_t = u64; 6 pub type blksize_t = i64; 7 pub type greg_t = i64; 8 pub type suseconds_t = i64; 9 pub type __u64 = ::c_ulonglong; 10 pub type __s64 = ::c_longlong; 11 12 s! { 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 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 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 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, 88 pub st_atime_nsec: i64, 89 pub st_mtime: ::time_t, 90 pub st_mtime_nsec: i64, 91 pub st_ctime: ::time_t, 92 pub st_ctime_nsec: i64, 93 __unused: [i64; 3], 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, 109 pub st_atime_nsec: i64, 110 pub st_mtime: ::time_t, 111 pub st_mtime_nsec: i64, 112 pub st_ctime: ::time_t, 113 pub st_ctime_nsec: i64, 114 __reserved: [i64; 3], 115 } 116 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 147 pub struct pthread_attr_t { 148 #[cfg(target_pointer_width = "32")] 149 __size: [u32; 8], 150 #[cfg(target_pointer_width = "64")] 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 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, 219 #[cfg(target_pointer_width = "32")] 220 __pad1: u32, 221 pub u_ar0: *mut user_regs_struct, 222 #[cfg(target_pointer_width = "32")] 223 __pad2: u32, 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 230 pub struct mcontext_t { 231 pub gregs: [greg_t; 23], 232 pub fpregs: *mut _libc_fpstate, 233 __private: [u64; 8], 234 } 235 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, 246 __unused1: u64, 247 __unused2: u64 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, 259 __unused4: u64, 260 __unused5: u64 261 } 262 263 pub struct ip_mreqn { 264 pub imr_multiaddr: ::in_addr, 265 pub imr_address: ::in_addr, 266 pub imr_ifindex: ::c_int, 267 } 268 269 pub struct seccomp_notif_sizes { 270 pub seccomp_notif: ::__u16, 271 pub seccomp_notif_resp: ::__u16, 272 pub seccomp_data: ::__u16, 273 } 274 } 275 276 s_no_extra_traits! { 277 pub struct user_fpregs_struct { 278 pub cwd: ::c_ushort, 279 pub swd: ::c_ushort, 280 pub ftw: ::c_ushort, 281 pub fop: ::c_ushort, 282 pub rip: ::c_ulonglong, 283 pub rdp: ::c_ulonglong, 284 pub mxcsr: ::c_uint, 285 pub mxcr_mask: ::c_uint, 286 pub st_space: [::c_uint; 32], 287 pub xmm_space: [::c_uint; 64], 288 padding: [::c_uint; 24], 289 } 290 291 pub struct ucontext_t { 292 pub uc_flags: ::c_ulong, 293 pub uc_link: *mut ucontext_t, 294 pub uc_stack: ::stack_t, 295 pub uc_mcontext: mcontext_t, 296 pub uc_sigmask: ::sigset_t, 297 __private: [u8; 512], 298 // FIXME: the shadow stack field requires glibc >= 2.28. 299 // Re-add once we drop compatibility with glibc versions older than 300 // 2.28. 301 // 302 // __ssp: [::c_ulonglong; 4], 303 } 304 } 305 306 cfg_if! { 307 if #[cfg(feature = "extra_traits")] { 308 impl PartialEq for user_fpregs_struct { 309 fn eq(&self, other: &user_fpregs_struct) -> bool { 310 self.cwd == other.cwd 311 && self.swd == other.swd 312 && self.ftw == other.ftw 313 && self.fop == other.fop 314 && self.rip == other.rip 315 && self.rdp == other.rdp 316 && self.mxcsr == other.mxcsr 317 && self.mxcr_mask == other.mxcr_mask 318 && self.st_space == other.st_space 319 && self 320 .xmm_space 321 .iter() 322 .zip(other.xmm_space.iter()) 323 .all(|(a,b)| a == b) 324 // Ignore padding field 325 } 326 } 327 328 impl Eq for user_fpregs_struct {} 329 330 impl ::fmt::Debug for user_fpregs_struct { 331 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 332 f.debug_struct("user_fpregs_struct") 333 .field("cwd", &self.cwd) 334 .field("ftw", &self.ftw) 335 .field("fop", &self.fop) 336 .field("rip", &self.rip) 337 .field("rdp", &self.rdp) 338 .field("mxcsr", &self.mxcsr) 339 .field("mxcr_mask", &self.mxcr_mask) 340 .field("st_space", &self.st_space) 341 // FIXME: .field("xmm_space", &self.xmm_space) 342 // Ignore padding field 343 .finish() 344 } 345 } 346 347 impl ::hash::Hash for user_fpregs_struct { 348 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 349 self.cwd.hash(state); 350 self.ftw.hash(state); 351 self.fop.hash(state); 352 self.rip.hash(state); 353 self.rdp.hash(state); 354 self.mxcsr.hash(state); 355 self.mxcr_mask.hash(state); 356 self.st_space.hash(state); 357 self.xmm_space.hash(state); 358 // Ignore padding field 359 } 360 } 361 362 impl PartialEq for ucontext_t { 363 fn eq(&self, other: &ucontext_t) -> bool { 364 self.uc_flags == other.uc_flags 365 && self.uc_link == other.uc_link 366 && self.uc_stack == other.uc_stack 367 && self.uc_mcontext == other.uc_mcontext 368 && self.uc_sigmask == other.uc_sigmask 369 // Ignore __private field 370 } 371 } 372 373 impl Eq for ucontext_t {} 374 375 impl ::fmt::Debug for ucontext_t { 376 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 377 f.debug_struct("ucontext_t") 378 .field("uc_flags", &self.uc_flags) 379 .field("uc_link", &self.uc_link) 380 .field("uc_stack", &self.uc_stack) 381 .field("uc_mcontext", &self.uc_mcontext) 382 .field("uc_sigmask", &self.uc_sigmask) 383 // Ignore __private field 384 .finish() 385 } 386 } 387 388 impl ::hash::Hash for ucontext_t { 389 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 390 self.uc_flags.hash(state); 391 self.uc_link.hash(state); 392 self.uc_stack.hash(state); 393 self.uc_mcontext.hash(state); 394 self.uc_sigmask.hash(state); 395 // Ignore __private field 396 } 397 } 398 } 399 } 400 401 pub const POSIX_FADV_DONTNEED: ::c_int = 4; 402 pub const POSIX_FADV_NOREUSE: ::c_int = 5; 403 404 pub const VEOF: usize = 4; 405 pub const RTLD_DEEPBIND: ::c_int = 0x8; 406 pub const RTLD_GLOBAL: ::c_int = 0x100; 407 pub const RTLD_NOLOAD: ::c_int = 0x4; 408 409 pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; 410 pub const RLIMIT_AS: ::__rlimit_resource_t = 9; 411 pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; 412 pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; 413 pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; 414 415 pub const O_APPEND: ::c_int = 1024; 416 pub const O_CREAT: ::c_int = 64; 417 pub const O_EXCL: ::c_int = 128; 418 pub const O_NOCTTY: ::c_int = 256; 419 pub const O_NONBLOCK: ::c_int = 2048; 420 pub const O_SYNC: ::c_int = 1052672; 421 pub const O_RSYNC: ::c_int = 1052672; 422 pub const O_DSYNC: ::c_int = 4096; 423 pub const O_FSYNC: ::c_int = 0x101000; 424 pub const O_NOATIME: ::c_int = 0o1000000; 425 pub const O_PATH: ::c_int = 0o10000000; 426 pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; 427 428 pub const MADV_SOFT_OFFLINE: ::c_int = 101; 429 pub const MAP_GROWSDOWN: ::c_int = 0x0100; 430 431 pub const EDEADLK: ::c_int = 35; 432 pub const ENAMETOOLONG: ::c_int = 36; 433 pub const ENOLCK: ::c_int = 37; 434 pub const ENOSYS: ::c_int = 38; 435 pub const ENOTEMPTY: ::c_int = 39; 436 pub const ELOOP: ::c_int = 40; 437 pub const ENOMSG: ::c_int = 42; 438 pub const EIDRM: ::c_int = 43; 439 pub const ECHRNG: ::c_int = 44; 440 pub const EL2NSYNC: ::c_int = 45; 441 pub const EL3HLT: ::c_int = 46; 442 pub const EL3RST: ::c_int = 47; 443 pub const ELNRNG: ::c_int = 48; 444 pub const EUNATCH: ::c_int = 49; 445 pub const ENOCSI: ::c_int = 50; 446 pub const EL2HLT: ::c_int = 51; 447 pub const EBADE: ::c_int = 52; 448 pub const EBADR: ::c_int = 53; 449 pub const EXFULL: ::c_int = 54; 450 pub const ENOANO: ::c_int = 55; 451 pub const EBADRQC: ::c_int = 56; 452 pub const EBADSLT: ::c_int = 57; 453 pub const EMULTIHOP: ::c_int = 72; 454 pub const EOVERFLOW: ::c_int = 75; 455 pub const ENOTUNIQ: ::c_int = 76; 456 pub const EBADFD: ::c_int = 77; 457 pub const EBADMSG: ::c_int = 74; 458 pub const EREMCHG: ::c_int = 78; 459 pub const ELIBACC: ::c_int = 79; 460 pub const ELIBBAD: ::c_int = 80; 461 pub const ELIBSCN: ::c_int = 81; 462 pub const ELIBMAX: ::c_int = 82; 463 pub const ELIBEXEC: ::c_int = 83; 464 pub const EILSEQ: ::c_int = 84; 465 pub const ERESTART: ::c_int = 85; 466 pub const ESTRPIPE: ::c_int = 86; 467 pub const EUSERS: ::c_int = 87; 468 pub const ENOTSOCK: ::c_int = 88; 469 pub const EDESTADDRREQ: ::c_int = 89; 470 pub const EMSGSIZE: ::c_int = 90; 471 pub const EPROTOTYPE: ::c_int = 91; 472 pub const ENOPROTOOPT: ::c_int = 92; 473 pub const EPROTONOSUPPORT: ::c_int = 93; 474 pub const ESOCKTNOSUPPORT: ::c_int = 94; 475 pub const EOPNOTSUPP: ::c_int = 95; 476 pub const EPFNOSUPPORT: ::c_int = 96; 477 pub const EAFNOSUPPORT: ::c_int = 97; 478 pub const EADDRINUSE: ::c_int = 98; 479 pub const EADDRNOTAVAIL: ::c_int = 99; 480 pub const ENETDOWN: ::c_int = 100; 481 pub const ENETUNREACH: ::c_int = 101; 482 pub const ENETRESET: ::c_int = 102; 483 pub const ECONNABORTED: ::c_int = 103; 484 pub const ECONNRESET: ::c_int = 104; 485 pub const ENOBUFS: ::c_int = 105; 486 pub const EISCONN: ::c_int = 106; 487 pub const ENOTCONN: ::c_int = 107; 488 pub const ESHUTDOWN: ::c_int = 108; 489 pub const ETOOMANYREFS: ::c_int = 109; 490 pub const ETIMEDOUT: ::c_int = 110; 491 pub const ECONNREFUSED: ::c_int = 111; 492 pub const EHOSTDOWN: ::c_int = 112; 493 pub const EHOSTUNREACH: ::c_int = 113; 494 pub const EALREADY: ::c_int = 114; 495 pub const EINPROGRESS: ::c_int = 115; 496 pub const ESTALE: ::c_int = 116; 497 pub const EDQUOT: ::c_int = 122; 498 pub const ENOMEDIUM: ::c_int = 123; 499 pub const EMEDIUMTYPE: ::c_int = 124; 500 pub const ECANCELED: ::c_int = 125; 501 pub const ENOKEY: ::c_int = 126; 502 pub const EKEYEXPIRED: ::c_int = 127; 503 pub const EKEYREVOKED: ::c_int = 128; 504 pub const EKEYREJECTED: ::c_int = 129; 505 pub const EOWNERDEAD: ::c_int = 130; 506 pub const ENOTRECOVERABLE: ::c_int = 131; 507 pub const EHWPOISON: ::c_int = 133; 508 pub const ERFKILL: ::c_int = 132; 509 510 pub const SOCK_STREAM: ::c_int = 1; 511 pub const SOCK_DGRAM: ::c_int = 2; 512 513 pub const SA_ONSTACK: ::c_int = 0x08000000; 514 pub const SA_SIGINFO: ::c_int = 0x00000004; 515 pub const SA_NOCLDWAIT: ::c_int = 0x00000002; 516 517 pub const SIGTTIN: ::c_int = 21; 518 pub const SIGTTOU: ::c_int = 22; 519 pub const SIGXCPU: ::c_int = 24; 520 pub const SIGXFSZ: ::c_int = 25; 521 pub const SIGVTALRM: ::c_int = 26; 522 pub const SIGPROF: ::c_int = 27; 523 pub const SIGWINCH: ::c_int = 28; 524 pub const SIGCHLD: ::c_int = 17; 525 pub const SIGBUS: ::c_int = 7; 526 pub const SIGUSR1: ::c_int = 10; 527 pub const SIGUSR2: ::c_int = 12; 528 pub const SIGCONT: ::c_int = 18; 529 pub const SIGSTOP: ::c_int = 19; 530 pub const SIGTSTP: ::c_int = 20; 531 pub const SIGURG: ::c_int = 23; 532 pub const SIGIO: ::c_int = 29; 533 pub const SIGSYS: ::c_int = 31; 534 pub const SIGSTKFLT: ::c_int = 16; 535 #[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] 536 pub const SIGUNUSED: ::c_int = 31; 537 pub const SIGPOLL: ::c_int = 29; 538 pub const SIGPWR: ::c_int = 30; 539 pub const SIG_SETMASK: ::c_int = 2; 540 pub const SIG_BLOCK: ::c_int = 0x000000; 541 pub const SIG_UNBLOCK: ::c_int = 0x01; 542 543 pub const POLLWRNORM: ::c_short = 0x100; 544 pub const POLLWRBAND: ::c_short = 0x200; 545 546 pub const O_ASYNC: ::c_int = 0x2000; 547 pub const O_NDELAY: ::c_int = 0x800; 548 549 pub const PTRACE_DETACH: ::c_uint = 17; 550 551 pub const EFD_NONBLOCK: ::c_int = 0x800; 552 553 pub const F_GETLK: ::c_int = 5; 554 pub const F_GETOWN: ::c_int = 9; 555 pub const F_SETOWN: ::c_int = 8; 556 pub const F_SETLK: ::c_int = 6; 557 pub const F_SETLKW: ::c_int = 7; 558 pub const F_OFD_GETLK: ::c_int = 36; 559 pub const F_OFD_SETLK: ::c_int = 37; 560 pub const F_OFD_SETLKW: ::c_int = 38; 561 562 pub const F_RDLCK: ::c_int = 0; 563 pub const F_WRLCK: ::c_int = 1; 564 pub const F_UNLCK: ::c_int = 2; 565 566 pub const SFD_NONBLOCK: ::c_int = 0x0800; 567 568 pub const TCSANOW: ::c_int = 0; 569 pub const TCSADRAIN: ::c_int = 1; 570 pub const TCSAFLUSH: ::c_int = 2; 571 572 pub const SFD_CLOEXEC: ::c_int = 0x080000; 573 574 pub const NCCS: usize = 32; 575 576 pub const O_TRUNC: ::c_int = 512; 577 578 pub const O_CLOEXEC: ::c_int = 0x80000; 579 580 pub const EBFONT: ::c_int = 59; 581 pub const ENOSTR: ::c_int = 60; 582 pub const ENODATA: ::c_int = 61; 583 pub const ETIME: ::c_int = 62; 584 pub const ENOSR: ::c_int = 63; 585 pub const ENONET: ::c_int = 64; 586 pub const ENOPKG: ::c_int = 65; 587 pub const EREMOTE: ::c_int = 66; 588 pub const ENOLINK: ::c_int = 67; 589 pub const EADV: ::c_int = 68; 590 pub const ESRMNT: ::c_int = 69; 591 pub const ECOMM: ::c_int = 70; 592 pub const EPROTO: ::c_int = 71; 593 pub const EDOTDOT: ::c_int = 73; 594 595 pub const SA_NODEFER: ::c_int = 0x40000000; 596 pub const SA_RESETHAND: ::c_int = 0x80000000; 597 pub const SA_RESTART: ::c_int = 0x10000000; 598 pub const SA_NOCLDSTOP: ::c_int = 0x00000001; 599 600 pub const EPOLL_CLOEXEC: ::c_int = 0x80000; 601 602 pub const EFD_CLOEXEC: ::c_int = 0x80000; 603 604 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; 605 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; 606 607 pub const O_DIRECT: ::c_int = 0x4000; 608 pub const O_DIRECTORY: ::c_int = 0x10000; 609 pub const O_NOFOLLOW: ::c_int = 0x20000; 610 611 pub const MAP_HUGETLB: ::c_int = 0x040000; 612 pub const MAP_LOCKED: ::c_int = 0x02000; 613 pub const MAP_NORESERVE: ::c_int = 0x04000; 614 pub const MAP_32BIT: ::c_int = 0x0040; 615 pub const MAP_ANON: ::c_int = 0x0020; 616 pub const MAP_ANONYMOUS: ::c_int = 0x0020; 617 pub const MAP_DENYWRITE: ::c_int = 0x0800; 618 pub const MAP_EXECUTABLE: ::c_int = 0x01000; 619 pub const MAP_POPULATE: ::c_int = 0x08000; 620 pub const MAP_NONBLOCK: ::c_int = 0x010000; 621 pub const MAP_STACK: ::c_int = 0x020000; 622 pub const MAP_SYNC: ::c_int = 0x080000; 623 624 pub const EDEADLOCK: ::c_int = 35; 625 pub const EUCLEAN: ::c_int = 117; 626 pub const ENOTNAM: ::c_int = 118; 627 pub const ENAVAIL: ::c_int = 119; 628 pub const EISNAM: ::c_int = 120; 629 pub const EREMOTEIO: ::c_int = 121; 630 631 pub const PTRACE_GETFPREGS: ::c_uint = 14; 632 pub const PTRACE_SETFPREGS: ::c_uint = 15; 633 pub const PTRACE_GETFPXREGS: ::c_uint = 18; 634 pub const PTRACE_SETFPXREGS: ::c_uint = 19; 635 pub const PTRACE_GETREGS: ::c_uint = 12; 636 pub const PTRACE_SETREGS: ::c_uint = 13; 637 pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1; 638 pub const PTRACE_SYSEMU: ::c_uint = 31; 639 pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32; 640 641 pub const MCL_CURRENT: ::c_int = 0x0001; 642 pub const MCL_FUTURE: ::c_int = 0x0002; 643 644 pub const SIGSTKSZ: ::size_t = 8192; 645 pub const MINSIGSTKSZ: ::size_t = 2048; 646 pub const CBAUD: ::tcflag_t = 0o0010017; 647 pub const TAB1: ::tcflag_t = 0x00000800; 648 pub const TAB2: ::tcflag_t = 0x00001000; 649 pub const TAB3: ::tcflag_t = 0x00001800; 650 pub const CR1: ::tcflag_t = 0x00000200; 651 pub const CR2: ::tcflag_t = 0x00000400; 652 pub const CR3: ::tcflag_t = 0x00000600; 653 pub const FF1: ::tcflag_t = 0x00008000; 654 pub const BS1: ::tcflag_t = 0x00002000; 655 pub const VT1: ::tcflag_t = 0x00004000; 656 pub const VWERASE: usize = 14; 657 pub const VREPRINT: usize = 12; 658 pub const VSUSP: usize = 10; 659 pub const VSTART: usize = 8; 660 pub const VSTOP: usize = 9; 661 pub const VDISCARD: usize = 13; 662 pub const VTIME: usize = 5; 663 pub const IXON: ::tcflag_t = 0x00000400; 664 pub const IXOFF: ::tcflag_t = 0x00001000; 665 pub const ONLCR: ::tcflag_t = 0x4; 666 pub const CSIZE: ::tcflag_t = 0x00000030; 667 pub const CS6: ::tcflag_t = 0x00000010; 668 pub const CS7: ::tcflag_t = 0x00000020; 669 pub const CS8: ::tcflag_t = 0x00000030; 670 pub const CSTOPB: ::tcflag_t = 0x00000040; 671 pub const CREAD: ::tcflag_t = 0x00000080; 672 pub const PARENB: ::tcflag_t = 0x00000100; 673 pub const PARODD: ::tcflag_t = 0x00000200; 674 pub const HUPCL: ::tcflag_t = 0x00000400; 675 pub const CLOCAL: ::tcflag_t = 0x00000800; 676 pub const ECHOKE: ::tcflag_t = 0x00000800; 677 pub const ECHOE: ::tcflag_t = 0x00000010; 678 pub const ECHOK: ::tcflag_t = 0x00000020; 679 pub const ECHONL: ::tcflag_t = 0x00000040; 680 pub const ECHOPRT: ::tcflag_t = 0x00000400; 681 pub const ECHOCTL: ::tcflag_t = 0x00000200; 682 pub const ISIG: ::tcflag_t = 0x00000001; 683 pub const ICANON: ::tcflag_t = 0x00000002; 684 pub const PENDIN: ::tcflag_t = 0x00004000; 685 pub const NOFLSH: ::tcflag_t = 0x00000080; 686 pub const CIBAUD: ::tcflag_t = 0o02003600000; 687 pub const CBAUDEX: ::tcflag_t = 0o010000; 688 pub const VSWTC: usize = 7; 689 pub const OLCUC: ::tcflag_t = 0o000002; 690 pub const NLDLY: ::tcflag_t = 0o000400; 691 pub const CRDLY: ::tcflag_t = 0o003000; 692 pub const TABDLY: ::tcflag_t = 0o014000; 693 pub const BSDLY: ::tcflag_t = 0o020000; 694 pub const FFDLY: ::tcflag_t = 0o100000; 695 pub const VTDLY: ::tcflag_t = 0o040000; 696 pub const XTABS: ::tcflag_t = 0o014000; 697 698 pub const B0: ::speed_t = 0o000000; 699 pub const B50: ::speed_t = 0o000001; 700 pub const B75: ::speed_t = 0o000002; 701 pub const B110: ::speed_t = 0o000003; 702 pub const B134: ::speed_t = 0o000004; 703 pub const B150: ::speed_t = 0o000005; 704 pub const B200: ::speed_t = 0o000006; 705 pub const B300: ::speed_t = 0o000007; 706 pub const B600: ::speed_t = 0o000010; 707 pub const B1200: ::speed_t = 0o000011; 708 pub const B1800: ::speed_t = 0o000012; 709 pub const B2400: ::speed_t = 0o000013; 710 pub const B4800: ::speed_t = 0o000014; 711 pub const B9600: ::speed_t = 0o000015; 712 pub const B19200: ::speed_t = 0o000016; 713 pub const B38400: ::speed_t = 0o000017; 714 pub const EXTA: ::speed_t = B19200; 715 pub const EXTB: ::speed_t = B38400; 716 pub const B57600: ::speed_t = 0o010001; 717 pub const B115200: ::speed_t = 0o010002; 718 pub const B230400: ::speed_t = 0o010003; 719 pub const B460800: ::speed_t = 0o010004; 720 pub const B500000: ::speed_t = 0o010005; 721 pub const B576000: ::speed_t = 0o010006; 722 pub const B921600: ::speed_t = 0o010007; 723 pub const B1000000: ::speed_t = 0o010010; 724 pub const B1152000: ::speed_t = 0o010011; 725 pub const B1500000: ::speed_t = 0o010012; 726 pub const B2000000: ::speed_t = 0o010013; 727 pub const B2500000: ::speed_t = 0o010014; 728 pub const B3000000: ::speed_t = 0o010015; 729 pub const B3500000: ::speed_t = 0o010016; 730 pub const B4000000: ::speed_t = 0o010017; 731 732 pub const VEOL: usize = 11; 733 pub const VEOL2: usize = 16; 734 pub const VMIN: usize = 6; 735 pub const IEXTEN: ::tcflag_t = 0x00008000; 736 pub const TOSTOP: ::tcflag_t = 0x00000100; 737 pub const FLUSHO: ::tcflag_t = 0x00001000; 738 pub const EXTPROC: ::tcflag_t = 0x00010000; 739 740 // offsets in user_regs_structs, from sys/reg.h 741 pub const R15: ::c_int = 0; 742 pub const R14: ::c_int = 1; 743 pub const R13: ::c_int = 2; 744 pub const R12: ::c_int = 3; 745 pub const RBP: ::c_int = 4; 746 pub const RBX: ::c_int = 5; 747 pub const R11: ::c_int = 6; 748 pub const R10: ::c_int = 7; 749 pub const R9: ::c_int = 8; 750 pub const R8: ::c_int = 9; 751 pub const RAX: ::c_int = 10; 752 pub const RCX: ::c_int = 11; 753 pub const RDX: ::c_int = 12; 754 pub const RSI: ::c_int = 13; 755 pub const RDI: ::c_int = 14; 756 pub const ORIG_RAX: ::c_int = 15; 757 pub const RIP: ::c_int = 16; 758 pub const CS: ::c_int = 17; 759 pub const EFLAGS: ::c_int = 18; 760 pub const RSP: ::c_int = 19; 761 pub const SS: ::c_int = 20; 762 pub const FS_BASE: ::c_int = 21; 763 pub const GS_BASE: ::c_int = 22; 764 pub const DS: ::c_int = 23; 765 pub const ES: ::c_int = 24; 766 pub const FS: ::c_int = 25; 767 pub const GS: ::c_int = 26; 768 769 // offsets in mcontext_t.gregs from sys/ucontext.h 770 pub const REG_R8: ::c_int = 0; 771 pub const REG_R9: ::c_int = 1; 772 pub const REG_R10: ::c_int = 2; 773 pub const REG_R11: ::c_int = 3; 774 pub const REG_R12: ::c_int = 4; 775 pub const REG_R13: ::c_int = 5; 776 pub const REG_R14: ::c_int = 6; 777 pub const REG_R15: ::c_int = 7; 778 pub const REG_RDI: ::c_int = 8; 779 pub const REG_RSI: ::c_int = 9; 780 pub const REG_RBP: ::c_int = 10; 781 pub const REG_RBX: ::c_int = 11; 782 pub const REG_RDX: ::c_int = 12; 783 pub const REG_RAX: ::c_int = 13; 784 pub const REG_RCX: ::c_int = 14; 785 pub const REG_RSP: ::c_int = 15; 786 pub const REG_RIP: ::c_int = 16; 787 pub const REG_EFL: ::c_int = 17; 788 pub const REG_CSGSFS: ::c_int = 18; 789 pub const REG_ERR: ::c_int = 19; 790 pub const REG_TRAPNO: ::c_int = 20; 791 pub const REG_OLDMASK: ::c_int = 21; 792 pub const REG_CR2: ::c_int = 22; 793 794 pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0; 795 pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1; 796 pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2; 797 pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3; 798 799 extern "C" { 800 pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; 801 pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; 802 pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...); 803 pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int; 804 pub fn iopl(level: ::c_int) -> ::c_int; 805 pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int; 806 } 807 808 cfg_if! { 809 if #[cfg(target_pointer_width = "32")] { 810 mod x32; 811 pub use self::x32::*; 812 } else { 813 mod not_x32; 814 pub use self::not_x32::*; 815 } 816 } 817 818 cfg_if! { 819 if #[cfg(libc_align)] { 820 mod align; 821 pub use self::align::*; 822 } 823 } 824