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