1 pub type pthread_t = c_ulong; 2 pub type __priority_which_t = ::c_uint; 3 pub type __rlimit_resource_t = ::c_uint; 4 pub type Lmid_t = ::c_long; 5 pub type regoff_t = ::c_int; 6 7 cfg_if! { 8 if #[cfg(doc)] { 9 // Used in `linux::arch` to define ioctl constants. 10 pub(crate) type Ioctl = ::c_ulong; 11 } else { 12 #[doc(hidden)] 13 pub type Ioctl = ::c_ulong; 14 } 15 } 16 17 s! { 18 pub struct statx { 19 pub stx_mask: u32, 20 pub stx_blksize: u32, 21 pub stx_attributes: u64, 22 pub stx_nlink: u32, 23 pub stx_uid: u32, 24 pub stx_gid: u32, 25 pub stx_mode: u16, 26 __statx_pad1: [u16; 1], 27 pub stx_ino: u64, 28 pub stx_size: u64, 29 pub stx_blocks: u64, 30 pub stx_attributes_mask: u64, 31 pub stx_atime: ::statx_timestamp, 32 pub stx_btime: ::statx_timestamp, 33 pub stx_ctime: ::statx_timestamp, 34 pub stx_mtime: ::statx_timestamp, 35 pub stx_rdev_major: u32, 36 pub stx_rdev_minor: u32, 37 pub stx_dev_major: u32, 38 pub stx_dev_minor: u32, 39 pub stx_mnt_id: u64, 40 pub stx_dio_mem_align: u32, 41 pub stx_dio_offset_align: u32, 42 __statx_pad3: [u64; 12], 43 } 44 45 pub struct statx_timestamp { 46 pub tv_sec: i64, 47 pub tv_nsec: u32, 48 pub __statx_timestamp_pad1: [i32; 1], 49 } 50 51 pub struct aiocb { 52 pub aio_fildes: ::c_int, 53 pub aio_lio_opcode: ::c_int, 54 pub aio_reqprio: ::c_int, 55 pub aio_buf: *mut ::c_void, 56 pub aio_nbytes: ::size_t, 57 pub aio_sigevent: ::sigevent, 58 __next_prio: *mut aiocb, 59 __abs_prio: ::c_int, 60 __policy: ::c_int, 61 __error_code: ::c_int, 62 __return_value: ::ssize_t, 63 pub aio_offset: off_t, 64 #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))] 65 __unused1: [::c_char; 4], 66 __glibc_reserved: [::c_char; 32] 67 } 68 69 pub struct __exit_status { 70 pub e_termination: ::c_short, 71 pub e_exit: ::c_short, 72 } 73 74 pub struct __timeval { 75 pub tv_sec: i32, 76 pub tv_usec: i32, 77 } 78 79 pub struct glob64_t { 80 pub gl_pathc: ::size_t, 81 pub gl_pathv: *mut *mut ::c_char, 82 pub gl_offs: ::size_t, 83 pub gl_flags: ::c_int, 84 85 __unused1: *mut ::c_void, 86 __unused2: *mut ::c_void, 87 __unused3: *mut ::c_void, 88 __unused4: *mut ::c_void, 89 __unused5: *mut ::c_void, 90 } 91 92 pub struct msghdr { 93 pub msg_name: *mut ::c_void, 94 pub msg_namelen: ::socklen_t, 95 pub msg_iov: *mut ::iovec, 96 pub msg_iovlen: ::size_t, 97 pub msg_control: *mut ::c_void, 98 pub msg_controllen: ::size_t, 99 pub msg_flags: ::c_int, 100 } 101 102 pub struct cmsghdr { 103 pub cmsg_len: ::size_t, 104 pub cmsg_level: ::c_int, 105 pub cmsg_type: ::c_int, 106 } 107 108 pub struct termios { 109 pub c_iflag: ::tcflag_t, 110 pub c_oflag: ::tcflag_t, 111 pub c_cflag: ::tcflag_t, 112 pub c_lflag: ::tcflag_t, 113 pub c_line: ::cc_t, 114 pub c_cc: [::cc_t; ::NCCS], 115 #[cfg(not(any( 116 target_arch = "sparc", 117 target_arch = "sparc64", 118 target_arch = "mips", 119 target_arch = "mips64")))] 120 pub c_ispeed: ::speed_t, 121 #[cfg(not(any( 122 target_arch = "sparc", 123 target_arch = "sparc64", 124 target_arch = "mips", 125 target_arch = "mips64")))] 126 pub c_ospeed: ::speed_t, 127 } 128 129 pub struct mallinfo { 130 pub arena: ::c_int, 131 pub ordblks: ::c_int, 132 pub smblks: ::c_int, 133 pub hblks: ::c_int, 134 pub hblkhd: ::c_int, 135 pub usmblks: ::c_int, 136 pub fsmblks: ::c_int, 137 pub uordblks: ::c_int, 138 pub fordblks: ::c_int, 139 pub keepcost: ::c_int, 140 } 141 142 pub struct mallinfo2 { 143 pub arena: ::size_t, 144 pub ordblks: ::size_t, 145 pub smblks: ::size_t, 146 pub hblks: ::size_t, 147 pub hblkhd: ::size_t, 148 pub usmblks: ::size_t, 149 pub fsmblks: ::size_t, 150 pub uordblks: ::size_t, 151 pub fordblks: ::size_t, 152 pub keepcost: ::size_t, 153 } 154 155 pub struct nl_pktinfo { 156 pub group: u32, 157 } 158 159 pub struct nl_mmap_req { 160 pub nm_block_size: ::c_uint, 161 pub nm_block_nr: ::c_uint, 162 pub nm_frame_size: ::c_uint, 163 pub nm_frame_nr: ::c_uint, 164 } 165 166 pub struct nl_mmap_hdr { 167 pub nm_status: ::c_uint, 168 pub nm_len: ::c_uint, 169 pub nm_group: u32, 170 pub nm_pid: u32, 171 pub nm_uid: u32, 172 pub nm_gid: u32, 173 } 174 175 pub struct rtentry { 176 pub rt_pad1: ::c_ulong, 177 pub rt_dst: ::sockaddr, 178 pub rt_gateway: ::sockaddr, 179 pub rt_genmask: ::sockaddr, 180 pub rt_flags: ::c_ushort, 181 pub rt_pad2: ::c_short, 182 pub rt_pad3: ::c_ulong, 183 pub rt_tos: ::c_uchar, 184 pub rt_class: ::c_uchar, 185 #[cfg(target_pointer_width = "64")] 186 pub rt_pad4: [::c_short; 3usize], 187 #[cfg(not(target_pointer_width = "64"))] 188 pub rt_pad4: ::c_short, 189 pub rt_metric: ::c_short, 190 pub rt_dev: *mut ::c_char, 191 pub rt_mtu: ::c_ulong, 192 pub rt_window: ::c_ulong, 193 pub rt_irtt: ::c_ushort, 194 } 195 196 pub struct timex { 197 pub modes: ::c_uint, 198 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 199 pub offset: i64, 200 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 201 pub offset: ::c_long, 202 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 203 pub freq: i64, 204 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 205 pub freq: ::c_long, 206 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 207 pub maxerror: i64, 208 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 209 pub maxerror: ::c_long, 210 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 211 pub esterror: i64, 212 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 213 pub esterror: ::c_long, 214 pub status: ::c_int, 215 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 216 pub constant: i64, 217 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 218 pub constant: ::c_long, 219 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 220 pub precision: i64, 221 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 222 pub precision: ::c_long, 223 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 224 pub tolerance: i64, 225 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 226 pub tolerance: ::c_long, 227 pub time: ::timeval, 228 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 229 pub tick: i64, 230 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 231 pub tick: ::c_long, 232 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 233 pub ppsfreq: i64, 234 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 235 pub ppsfreq: ::c_long, 236 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 237 pub jitter: i64, 238 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 239 pub jitter: ::c_long, 240 pub shift: ::c_int, 241 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 242 pub stabil: i64, 243 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 244 pub stabil: ::c_long, 245 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 246 pub jitcnt: i64, 247 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 248 pub jitcnt: ::c_long, 249 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 250 pub calcnt: i64, 251 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 252 pub calcnt: ::c_long, 253 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 254 pub errcnt: i64, 255 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 256 pub errcnt: ::c_long, 257 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 258 pub stbcnt: i64, 259 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 260 pub stbcnt: ::c_long, 261 pub tai: ::c_int, 262 pub __unused1: i32, 263 pub __unused2: i32, 264 pub __unused3: i32, 265 pub __unused4: i32, 266 pub __unused5: i32, 267 pub __unused6: i32, 268 pub __unused7: i32, 269 pub __unused8: i32, 270 pub __unused9: i32, 271 pub __unused10: i32, 272 pub __unused11: i32, 273 } 274 275 pub struct ntptimeval { 276 pub time: ::timeval, 277 pub maxerror: ::c_long, 278 pub esterror: ::c_long, 279 pub tai: ::c_long, 280 pub __glibc_reserved1: ::c_long, 281 pub __glibc_reserved2: ::c_long, 282 pub __glibc_reserved3: ::c_long, 283 pub __glibc_reserved4: ::c_long, 284 } 285 286 pub struct regex_t { 287 __buffer: *mut ::c_void, 288 __allocated: ::size_t, 289 __used: ::size_t, 290 __syntax: ::c_ulong, 291 __fastmap: *mut ::c_char, 292 __translate: *mut ::c_char, 293 __re_nsub: ::size_t, 294 __bitfield: u8, 295 } 296 297 pub struct Elf64_Chdr { 298 pub ch_type: ::Elf64_Word, 299 pub ch_reserved: ::Elf64_Word, 300 pub ch_size: ::Elf64_Xword, 301 pub ch_addralign: ::Elf64_Xword, 302 } 303 304 pub struct Elf32_Chdr { 305 pub ch_type: ::Elf32_Word, 306 pub ch_size: ::Elf32_Word, 307 pub ch_addralign: ::Elf32_Word, 308 } 309 310 pub struct seminfo { 311 pub semmap: ::c_int, 312 pub semmni: ::c_int, 313 pub semmns: ::c_int, 314 pub semmnu: ::c_int, 315 pub semmsl: ::c_int, 316 pub semopm: ::c_int, 317 pub semume: ::c_int, 318 pub semusz: ::c_int, 319 pub semvmx: ::c_int, 320 pub semaem: ::c_int, 321 } 322 323 pub struct ptrace_peeksiginfo_args { 324 pub off: ::__u64, 325 pub flags: ::__u32, 326 pub nr: ::__s32, 327 } 328 329 pub struct __c_anonymous_ptrace_syscall_info_entry { 330 pub nr: ::__u64, 331 pub args: [::__u64; 6], 332 } 333 334 pub struct __c_anonymous_ptrace_syscall_info_exit { 335 pub sval: ::__s64, 336 pub is_error: ::__u8, 337 } 338 339 pub struct __c_anonymous_ptrace_syscall_info_seccomp { 340 pub nr: ::__u64, 341 pub args: [::__u64; 6], 342 pub ret_data: ::__u32, 343 } 344 345 pub struct ptrace_syscall_info { 346 pub op: ::__u8, 347 pub pad: [::__u8; 3], 348 pub arch: ::__u32, 349 pub instruction_pointer: ::__u64, 350 pub stack_pointer: ::__u64, 351 #[cfg(libc_union)] 352 pub u: __c_anonymous_ptrace_syscall_info_data, 353 } 354 } 355 356 impl siginfo_t { 357 pub unsafe fn si_addr(&self) -> *mut ::c_void { 358 #[repr(C)] 359 struct siginfo_sigfault { 360 _si_signo: ::c_int, 361 _si_errno: ::c_int, 362 _si_code: ::c_int, 363 si_addr: *mut ::c_void, 364 } 365 (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr 366 } 367 368 pub unsafe fn si_value(&self) -> ::sigval { 369 #[repr(C)] 370 struct siginfo_timer { 371 _si_signo: ::c_int, 372 _si_errno: ::c_int, 373 _si_code: ::c_int, 374 _si_tid: ::c_int, 375 _si_overrun: ::c_int, 376 si_sigval: ::sigval, 377 } 378 (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval 379 } 380 } 381 382 cfg_if! { 383 if #[cfg(libc_union)] { 384 // Internal, for casts to access union fields 385 #[repr(C)] 386 struct sifields_sigchld { 387 si_pid: ::pid_t, 388 si_uid: ::uid_t, 389 si_status: ::c_int, 390 si_utime: ::c_long, 391 si_stime: ::c_long, 392 } 393 impl ::Copy for sifields_sigchld {} 394 impl ::Clone for sifields_sigchld { 395 fn clone(&self) -> sifields_sigchld { 396 *self 397 } 398 } 399 400 // Internal, for casts to access union fields 401 #[repr(C)] 402 union sifields { 403 _align_pointer: *mut ::c_void, 404 sigchld: sifields_sigchld, 405 } 406 407 // Internal, for casts to access union fields. Note that some variants 408 // of sifields start with a pointer, which makes the alignment of 409 // sifields vary on 32-bit and 64-bit architectures. 410 #[repr(C)] 411 struct siginfo_f { 412 _siginfo_base: [::c_int; 3], 413 sifields: sifields, 414 } 415 416 impl siginfo_t { 417 unsafe fn sifields(&self) -> &sifields { 418 &(*(self as *const siginfo_t as *const siginfo_f)).sifields 419 } 420 421 pub unsafe fn si_pid(&self) -> ::pid_t { 422 self.sifields().sigchld.si_pid 423 } 424 425 pub unsafe fn si_uid(&self) -> ::uid_t { 426 self.sifields().sigchld.si_uid 427 } 428 429 pub unsafe fn si_status(&self) -> ::c_int { 430 self.sifields().sigchld.si_status 431 } 432 433 pub unsafe fn si_utime(&self) -> ::c_long { 434 self.sifields().sigchld.si_utime 435 } 436 437 pub unsafe fn si_stime(&self) -> ::c_long { 438 self.sifields().sigchld.si_stime 439 } 440 } 441 442 pub union __c_anonymous_ptrace_syscall_info_data { 443 pub entry: __c_anonymous_ptrace_syscall_info_entry, 444 pub exit: __c_anonymous_ptrace_syscall_info_exit, 445 pub seccomp: __c_anonymous_ptrace_syscall_info_seccomp, 446 } 447 impl ::Copy for __c_anonymous_ptrace_syscall_info_data {} 448 impl ::Clone for __c_anonymous_ptrace_syscall_info_data { 449 fn clone(&self) -> __c_anonymous_ptrace_syscall_info_data { 450 *self 451 } 452 } 453 } 454 } 455 456 s_no_extra_traits! { 457 pub struct utmpx { 458 pub ut_type: ::c_short, 459 pub ut_pid: ::pid_t, 460 pub ut_line: [::c_char; __UT_LINESIZE], 461 pub ut_id: [::c_char; 4], 462 463 pub ut_user: [::c_char; __UT_NAMESIZE], 464 pub ut_host: [::c_char; __UT_HOSTSIZE], 465 pub ut_exit: __exit_status, 466 467 #[cfg(any(target_arch = "aarch64", 468 target_arch = "s390x", 469 target_arch = "loongarch64", 470 all(target_pointer_width = "32", 471 not(target_arch = "x86_64"))))] 472 pub ut_session: ::c_long, 473 #[cfg(any(target_arch = "aarch64", 474 target_arch = "s390x", 475 target_arch = "loongarch64", 476 all(target_pointer_width = "32", 477 not(target_arch = "x86_64"))))] 478 pub ut_tv: ::timeval, 479 480 #[cfg(not(any(target_arch = "aarch64", 481 target_arch = "s390x", 482 target_arch = "loongarch64", 483 all(target_pointer_width = "32", 484 not(target_arch = "x86_64")))))] 485 pub ut_session: i32, 486 #[cfg(not(any(target_arch = "aarch64", 487 target_arch = "s390x", 488 target_arch = "loongarch64", 489 all(target_pointer_width = "32", 490 not(target_arch = "x86_64")))))] 491 pub ut_tv: __timeval, 492 493 pub ut_addr_v6: [i32; 4], 494 __glibc_reserved: [::c_char; 20], 495 } 496 } 497 498 cfg_if! { 499 if #[cfg(feature = "extra_traits")] { 500 impl PartialEq for utmpx { 501 fn eq(&self, other: &utmpx) -> bool { 502 self.ut_type == other.ut_type 503 && self.ut_pid == other.ut_pid 504 && self.ut_line == other.ut_line 505 && self.ut_id == other.ut_id 506 && self.ut_user == other.ut_user 507 && self 508 .ut_host 509 .iter() 510 .zip(other.ut_host.iter()) 511 .all(|(a,b)| a == b) 512 && self.ut_exit == other.ut_exit 513 && self.ut_session == other.ut_session 514 && self.ut_tv == other.ut_tv 515 && self.ut_addr_v6 == other.ut_addr_v6 516 && self.__glibc_reserved == other.__glibc_reserved 517 } 518 } 519 520 impl Eq for utmpx {} 521 522 impl ::fmt::Debug for utmpx { 523 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 524 f.debug_struct("utmpx") 525 .field("ut_type", &self.ut_type) 526 .field("ut_pid", &self.ut_pid) 527 .field("ut_line", &self.ut_line) 528 .field("ut_id", &self.ut_id) 529 .field("ut_user", &self.ut_user) 530 // FIXME: .field("ut_host", &self.ut_host) 531 .field("ut_exit", &self.ut_exit) 532 .field("ut_session", &self.ut_session) 533 .field("ut_tv", &self.ut_tv) 534 .field("ut_addr_v6", &self.ut_addr_v6) 535 .field("__glibc_reserved", &self.__glibc_reserved) 536 .finish() 537 } 538 } 539 540 impl ::hash::Hash for utmpx { 541 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 542 self.ut_type.hash(state); 543 self.ut_pid.hash(state); 544 self.ut_line.hash(state); 545 self.ut_id.hash(state); 546 self.ut_user.hash(state); 547 self.ut_host.hash(state); 548 self.ut_exit.hash(state); 549 self.ut_session.hash(state); 550 self.ut_tv.hash(state); 551 self.ut_addr_v6.hash(state); 552 self.__glibc_reserved.hash(state); 553 } 554 } 555 556 #[cfg(libc_union)] 557 impl PartialEq for __c_anonymous_ptrace_syscall_info_data { 558 fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool { 559 unsafe { 560 self.entry == other.entry || 561 self.exit == other.exit || 562 self.seccomp == other.seccomp 563 } 564 } 565 } 566 567 #[cfg(libc_union)] 568 impl Eq for __c_anonymous_ptrace_syscall_info_data {} 569 570 #[cfg(libc_union)] 571 impl ::fmt::Debug for __c_anonymous_ptrace_syscall_info_data { 572 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 573 unsafe { 574 f.debug_struct("__c_anonymous_ptrace_syscall_info_data") 575 .field("entry", &self.entry) 576 .field("exit", &self.exit) 577 .field("seccomp", &self.seccomp) 578 .finish() 579 } 580 } 581 } 582 583 #[cfg(libc_union)] 584 impl ::hash::Hash for __c_anonymous_ptrace_syscall_info_data { 585 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 586 unsafe { 587 self.entry.hash(state); 588 self.exit.hash(state); 589 self.seccomp.hash(state); 590 } 591 } 592 } 593 } 594 } 595 596 // include/uapi/asm-generic/hugetlb_encode.h 597 pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26; 598 pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f; 599 600 pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT; 601 pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT; 602 pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT; 603 pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT; 604 pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT; 605 pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT; 606 pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT; 607 pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT; 608 pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT; 609 pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT; 610 pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT; 611 pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT; 612 613 // include/uapi/linux/mman.h 614 /* 615 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page 616 * size other than the default is desired. See hugetlb_encode.h. 617 * All known huge page size encodings are provided here. It is the 618 * responsibility of the application to know which sizes are supported on 619 * the running system. See mmap(2) man page for details. 620 */ 621 pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT; 622 pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK; 623 624 pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB; 625 pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB; 626 pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB; 627 pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB; 628 pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB; 629 pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB; 630 pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB; 631 pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB; 632 pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB; 633 pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB; 634 pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB; 635 pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB; 636 637 pub const PRIO_PROCESS: ::__priority_which_t = 0; 638 pub const PRIO_PGRP: ::__priority_which_t = 1; 639 pub const PRIO_USER: ::__priority_which_t = 2; 640 641 pub const MS_RMT_MASK: ::c_ulong = 0x02800051; 642 643 pub const __UT_LINESIZE: usize = 32; 644 pub const __UT_NAMESIZE: usize = 32; 645 pub const __UT_HOSTSIZE: usize = 256; 646 pub const EMPTY: ::c_short = 0; 647 pub const RUN_LVL: ::c_short = 1; 648 pub const BOOT_TIME: ::c_short = 2; 649 pub const NEW_TIME: ::c_short = 3; 650 pub const OLD_TIME: ::c_short = 4; 651 pub const INIT_PROCESS: ::c_short = 5; 652 pub const LOGIN_PROCESS: ::c_short = 6; 653 pub const USER_PROCESS: ::c_short = 7; 654 pub const DEAD_PROCESS: ::c_short = 8; 655 pub const ACCOUNTING: ::c_short = 9; 656 657 // dlfcn.h 658 pub const LM_ID_BASE: ::c_long = 0; 659 pub const LM_ID_NEWLM: ::c_long = -1; 660 661 pub const RTLD_DI_LMID: ::c_int = 1; 662 pub const RTLD_DI_LINKMAP: ::c_int = 2; 663 pub const RTLD_DI_CONFIGADDR: ::c_int = 3; 664 pub const RTLD_DI_SERINFO: ::c_int = 4; 665 pub const RTLD_DI_SERINFOSIZE: ::c_int = 5; 666 pub const RTLD_DI_ORIGIN: ::c_int = 6; 667 pub const RTLD_DI_PROFILENAME: ::c_int = 7; 668 pub const RTLD_DI_PROFILEOUT: ::c_int = 8; 669 pub const RTLD_DI_TLS_MODID: ::c_int = 9; 670 pub const RTLD_DI_TLS_DATA: ::c_int = 10; 671 672 pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; 673 pub const PIDFD_NONBLOCK: ::c_uint = O_NONBLOCK as ::c_uint; 674 675 pub const SOL_RXRPC: ::c_int = 272; 676 pub const SOL_PPPOL2TP: ::c_int = 273; 677 pub const SOL_PNPIPE: ::c_int = 275; 678 pub const SOL_RDS: ::c_int = 276; 679 pub const SOL_IUCV: ::c_int = 277; 680 pub const SOL_CAIF: ::c_int = 278; 681 pub const SOL_NFC: ::c_int = 280; 682 pub const SOL_XDP: ::c_int = 283; 683 684 pub const MSG_TRYHARD: ::c_int = 4; 685 686 pub const LC_PAPER: ::c_int = 7; 687 pub const LC_NAME: ::c_int = 8; 688 pub const LC_ADDRESS: ::c_int = 9; 689 pub const LC_TELEPHONE: ::c_int = 10; 690 pub const LC_MEASUREMENT: ::c_int = 11; 691 pub const LC_IDENTIFICATION: ::c_int = 12; 692 pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER; 693 pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME; 694 pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS; 695 pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE; 696 pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT; 697 pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION; 698 pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK 699 | ::LC_NUMERIC_MASK 700 | ::LC_TIME_MASK 701 | ::LC_COLLATE_MASK 702 | ::LC_MONETARY_MASK 703 | ::LC_MESSAGES_MASK 704 | LC_PAPER_MASK 705 | LC_NAME_MASK 706 | LC_ADDRESS_MASK 707 | LC_TELEPHONE_MASK 708 | LC_MEASUREMENT_MASK 709 | LC_IDENTIFICATION_MASK; 710 711 pub const ENOTSUP: ::c_int = EOPNOTSUPP; 712 713 pub const SOCK_SEQPACKET: ::c_int = 5; 714 pub const SOCK_DCCP: ::c_int = 6; 715 pub const SOCK_PACKET: ::c_int = 10; 716 717 pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; 718 pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; 719 // NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0 720 pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100; 721 722 pub const AF_IB: ::c_int = 27; 723 pub const AF_MPLS: ::c_int = 28; 724 pub const AF_NFC: ::c_int = 39; 725 pub const AF_VSOCK: ::c_int = 40; 726 pub const AF_XDP: ::c_int = 44; 727 pub const PF_IB: ::c_int = AF_IB; 728 pub const PF_MPLS: ::c_int = AF_MPLS; 729 pub const PF_NFC: ::c_int = AF_NFC; 730 pub const PF_VSOCK: ::c_int = AF_VSOCK; 731 pub const PF_XDP: ::c_int = AF_XDP; 732 733 /* DCCP socket options */ 734 pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; 735 pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; 736 pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; 737 pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; 738 pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; 739 pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; 740 pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; 741 pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; 742 pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; 743 pub const DCCP_SOCKOPT_CCID: ::c_int = 13; 744 pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; 745 pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; 746 pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; 747 pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; 748 pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; 749 pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; 750 751 /// maximum number of services provided on the same listening port 752 pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; 753 754 pub const SIGEV_THREAD_ID: ::c_int = 4; 755 756 pub const BUFSIZ: ::c_uint = 8192; 757 pub const TMP_MAX: ::c_uint = 238328; 758 pub const FOPEN_MAX: ::c_uint = 16; 759 pub const FILENAME_MAX: ::c_uint = 4096; 760 pub const POSIX_MADV_DONTNEED: ::c_int = 4; 761 pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; 762 pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; 763 pub const _SC_PII: ::c_int = 53; 764 pub const _SC_PII_XTI: ::c_int = 54; 765 pub const _SC_PII_SOCKET: ::c_int = 55; 766 pub const _SC_PII_INTERNET: ::c_int = 56; 767 pub const _SC_PII_OSI: ::c_int = 57; 768 pub const _SC_POLL: ::c_int = 58; 769 pub const _SC_SELECT: ::c_int = 59; 770 pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; 771 pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; 772 pub const _SC_PII_OSI_COTS: ::c_int = 63; 773 pub const _SC_PII_OSI_CLTS: ::c_int = 64; 774 pub const _SC_PII_OSI_M: ::c_int = 65; 775 pub const _SC_T_IOV_MAX: ::c_int = 66; 776 pub const _SC_2_C_VERSION: ::c_int = 96; 777 pub const _SC_CHAR_BIT: ::c_int = 101; 778 pub const _SC_CHAR_MAX: ::c_int = 102; 779 pub const _SC_CHAR_MIN: ::c_int = 103; 780 pub const _SC_INT_MAX: ::c_int = 104; 781 pub const _SC_INT_MIN: ::c_int = 105; 782 pub const _SC_LONG_BIT: ::c_int = 106; 783 pub const _SC_WORD_BIT: ::c_int = 107; 784 pub const _SC_MB_LEN_MAX: ::c_int = 108; 785 pub const _SC_SSIZE_MAX: ::c_int = 110; 786 pub const _SC_SCHAR_MAX: ::c_int = 111; 787 pub const _SC_SCHAR_MIN: ::c_int = 112; 788 pub const _SC_SHRT_MAX: ::c_int = 113; 789 pub const _SC_SHRT_MIN: ::c_int = 114; 790 pub const _SC_UCHAR_MAX: ::c_int = 115; 791 pub const _SC_UINT_MAX: ::c_int = 116; 792 pub const _SC_ULONG_MAX: ::c_int = 117; 793 pub const _SC_USHRT_MAX: ::c_int = 118; 794 pub const _SC_NL_ARGMAX: ::c_int = 119; 795 pub const _SC_NL_LANGMAX: ::c_int = 120; 796 pub const _SC_NL_MSGMAX: ::c_int = 121; 797 pub const _SC_NL_NMAX: ::c_int = 122; 798 pub const _SC_NL_SETMAX: ::c_int = 123; 799 pub const _SC_NL_TEXTMAX: ::c_int = 124; 800 pub const _SC_BASE: ::c_int = 134; 801 pub const _SC_C_LANG_SUPPORT: ::c_int = 135; 802 pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; 803 pub const _SC_DEVICE_IO: ::c_int = 140; 804 pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; 805 pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; 806 pub const _SC_FD_MGMT: ::c_int = 143; 807 pub const _SC_FIFO: ::c_int = 144; 808 pub const _SC_PIPE: ::c_int = 145; 809 pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; 810 pub const _SC_FILE_LOCKING: ::c_int = 147; 811 pub const _SC_FILE_SYSTEM: ::c_int = 148; 812 pub const _SC_MULTI_PROCESS: ::c_int = 150; 813 pub const _SC_SINGLE_PROCESS: ::c_int = 151; 814 pub const _SC_NETWORKING: ::c_int = 152; 815 pub const _SC_REGEX_VERSION: ::c_int = 156; 816 pub const _SC_SIGNALS: ::c_int = 158; 817 pub const _SC_SYSTEM_DATABASE: ::c_int = 162; 818 pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; 819 pub const _SC_USER_GROUPS: ::c_int = 166; 820 pub const _SC_USER_GROUPS_R: ::c_int = 167; 821 pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; 822 pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; 823 pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; 824 pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; 825 pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; 826 pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; 827 pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; 828 pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; 829 pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; 830 pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; 831 pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; 832 pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; 833 pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; 834 pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; 835 pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; 836 pub const O_ACCMODE: ::c_int = 3; 837 pub const ST_RELATIME: ::c_ulong = 4096; 838 pub const NI_MAXHOST: ::socklen_t = 1025; 839 840 // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the 841 // following are only available on newer Linux versions than the versions 842 // currently used in CI in some configurations, so we define them here. 843 cfg_if! { 844 if #[cfg(not(target_arch = "s390x"))] { 845 pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; 846 pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; 847 } else if #[cfg(target_arch = "s390x")] { 848 pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70; 849 pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342; 850 } 851 } 852 853 pub const CPU_SETSIZE: ::c_int = 0x400; 854 855 pub const PTRACE_TRACEME: ::c_uint = 0; 856 pub const PTRACE_PEEKTEXT: ::c_uint = 1; 857 pub const PTRACE_PEEKDATA: ::c_uint = 2; 858 pub const PTRACE_PEEKUSER: ::c_uint = 3; 859 pub const PTRACE_POKETEXT: ::c_uint = 4; 860 pub const PTRACE_POKEDATA: ::c_uint = 5; 861 pub const PTRACE_POKEUSER: ::c_uint = 6; 862 pub const PTRACE_CONT: ::c_uint = 7; 863 pub const PTRACE_KILL: ::c_uint = 8; 864 pub const PTRACE_SINGLESTEP: ::c_uint = 9; 865 pub const PTRACE_ATTACH: ::c_uint = 16; 866 pub const PTRACE_SYSCALL: ::c_uint = 24; 867 pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; 868 pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; 869 pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; 870 pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; 871 pub const PTRACE_GETREGSET: ::c_uint = 0x4204; 872 pub const PTRACE_SETREGSET: ::c_uint = 0x4205; 873 pub const PTRACE_SEIZE: ::c_uint = 0x4206; 874 pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; 875 pub const PTRACE_LISTEN: ::c_uint = 0x4208; 876 pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; 877 pub const PTRACE_GET_SYSCALL_INFO: ::c_uint = 0x420e; 878 pub const PTRACE_SYSCALL_INFO_NONE: ::__u8 = 0; 879 pub const PTRACE_SYSCALL_INFO_ENTRY: ::__u8 = 1; 880 pub const PTRACE_SYSCALL_INFO_EXIT: ::__u8 = 2; 881 pub const PTRACE_SYSCALL_INFO_SECCOMP: ::__u8 = 3; 882 883 // linux/fs.h 884 885 // Flags for preadv2/pwritev2 886 pub const RWF_HIPRI: ::c_int = 0x00000001; 887 pub const RWF_DSYNC: ::c_int = 0x00000002; 888 pub const RWF_SYNC: ::c_int = 0x00000004; 889 pub const RWF_NOWAIT: ::c_int = 0x00000008; 890 pub const RWF_APPEND: ::c_int = 0x00000010; 891 892 // linux/rtnetlink.h 893 pub const TCA_PAD: ::c_ushort = 9; 894 pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10; 895 pub const TCA_CHAIN: ::c_ushort = 11; 896 pub const TCA_HW_OFFLOAD: ::c_ushort = 12; 897 898 pub const RTM_DELNETCONF: u16 = 81; 899 pub const RTM_NEWSTATS: u16 = 92; 900 pub const RTM_GETSTATS: u16 = 94; 901 pub const RTM_NEWCACHEREPORT: u16 = 96; 902 903 pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000; 904 pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000; 905 906 pub const RTA_VIA: ::c_ushort = 18; 907 pub const RTA_NEWDST: ::c_ushort = 19; 908 pub const RTA_PREF: ::c_ushort = 20; 909 pub const RTA_ENCAP_TYPE: ::c_ushort = 21; 910 pub const RTA_ENCAP: ::c_ushort = 22; 911 pub const RTA_EXPIRES: ::c_ushort = 23; 912 pub const RTA_PAD: ::c_ushort = 24; 913 pub const RTA_UID: ::c_ushort = 25; 914 pub const RTA_TTL_PROPAGATE: ::c_ushort = 26; 915 916 // linux/neighbor.h 917 pub const NTF_EXT_LEARNED: u8 = 0x10; 918 pub const NTF_OFFLOADED: u8 = 0x20; 919 920 pub const NDA_MASTER: ::c_ushort = 9; 921 pub const NDA_LINK_NETNSID: ::c_ushort = 10; 922 pub const NDA_SRC_VNI: ::c_ushort = 11; 923 924 // linux/personality.h 925 pub const UNAME26: ::c_int = 0x0020000; 926 pub const FDPIC_FUNCPTRS: ::c_int = 0x0080000; 927 928 // linux/if_addr.h 929 pub const IFA_FLAGS: ::c_ushort = 8; 930 931 pub const IFA_F_MANAGETEMPADDR: u32 = 0x100; 932 pub const IFA_F_NOPREFIXROUTE: u32 = 0x200; 933 pub const IFA_F_MCAUTOJOIN: u32 = 0x400; 934 pub const IFA_F_STABLE_PRIVACY: u32 = 0x800; 935 936 pub const MAX_LINKS: ::c_int = 32; 937 938 pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; 939 940 pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1; 941 pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; 942 943 // elf.h 944 pub const NT_PRSTATUS: ::c_int = 1; 945 pub const NT_PRFPREG: ::c_int = 2; 946 pub const NT_FPREGSET: ::c_int = 2; 947 pub const NT_PRPSINFO: ::c_int = 3; 948 pub const NT_PRXREG: ::c_int = 4; 949 pub const NT_TASKSTRUCT: ::c_int = 4; 950 pub const NT_PLATFORM: ::c_int = 5; 951 pub const NT_AUXV: ::c_int = 6; 952 pub const NT_GWINDOWS: ::c_int = 7; 953 pub const NT_ASRS: ::c_int = 8; 954 pub const NT_PSTATUS: ::c_int = 10; 955 pub const NT_PSINFO: ::c_int = 13; 956 pub const NT_PRCRED: ::c_int = 14; 957 pub const NT_UTSNAME: ::c_int = 15; 958 pub const NT_LWPSTATUS: ::c_int = 16; 959 pub const NT_LWPSINFO: ::c_int = 17; 960 pub const NT_PRFPXREG: ::c_int = 20; 961 962 pub const ELFOSABI_ARM_AEABI: u8 = 64; 963 964 // linux/keyctl.h 965 pub const KEYCTL_DH_COMPUTE: u32 = 23; 966 pub const KEYCTL_PKEY_QUERY: u32 = 24; 967 pub const KEYCTL_PKEY_ENCRYPT: u32 = 25; 968 pub const KEYCTL_PKEY_DECRYPT: u32 = 26; 969 pub const KEYCTL_PKEY_SIGN: u32 = 27; 970 pub const KEYCTL_PKEY_VERIFY: u32 = 28; 971 pub const KEYCTL_RESTRICT_KEYRING: u32 = 29; 972 973 pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01; 974 pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02; 975 pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04; 976 pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08; 977 cfg_if! { 978 if #[cfg(not(any(target_arch="mips", target_arch="mips64")))] { 979 pub const KEYCTL_MOVE: u32 = 30; 980 pub const KEYCTL_CAPABILITIES: u32 = 31; 981 982 pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01; 983 pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02; 984 pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04; 985 pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08; 986 pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10; 987 pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20; 988 pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40; 989 pub const KEYCTL_CAPS0_MOVE: u32 = 0x80; 990 pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01; 991 pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02; 992 } 993 } 994 995 pub const M_MXFAST: ::c_int = 1; 996 pub const M_NLBLKS: ::c_int = 2; 997 pub const M_GRAIN: ::c_int = 3; 998 pub const M_KEEP: ::c_int = 4; 999 pub const M_TRIM_THRESHOLD: ::c_int = -1; 1000 pub const M_TOP_PAD: ::c_int = -2; 1001 pub const M_MMAP_THRESHOLD: ::c_int = -3; 1002 pub const M_MMAP_MAX: ::c_int = -4; 1003 pub const M_CHECK_ACTION: ::c_int = -5; 1004 pub const M_PERTURB: ::c_int = -6; 1005 pub const M_ARENA_TEST: ::c_int = -7; 1006 pub const M_ARENA_MAX: ::c_int = -8; 1007 1008 pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000; 1009 pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000; 1010 pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000; 1011 pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000; 1012 pub const STATX_TYPE: ::c_uint = 0x0001; 1013 pub const STATX_MODE: ::c_uint = 0x0002; 1014 pub const STATX_NLINK: ::c_uint = 0x0004; 1015 pub const STATX_UID: ::c_uint = 0x0008; 1016 pub const STATX_GID: ::c_uint = 0x0010; 1017 pub const STATX_ATIME: ::c_uint = 0x0020; 1018 pub const STATX_MTIME: ::c_uint = 0x0040; 1019 pub const STATX_CTIME: ::c_uint = 0x0080; 1020 pub const STATX_INO: ::c_uint = 0x0100; 1021 pub const STATX_SIZE: ::c_uint = 0x0200; 1022 pub const STATX_BLOCKS: ::c_uint = 0x0400; 1023 pub const STATX_BASIC_STATS: ::c_uint = 0x07ff; 1024 pub const STATX_BTIME: ::c_uint = 0x0800; 1025 pub const STATX_MNT_ID: ::c_uint = 0x1000; 1026 pub const STATX_DIOALIGN: ::c_uint = 0x2000; 1027 pub const STATX_ALL: ::c_uint = 0x0fff; 1028 pub const STATX__RESERVED: ::c_int = 0x80000000; 1029 pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004; 1030 pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010; 1031 pub const STATX_ATTR_APPEND: ::c_int = 0x0020; 1032 pub const STATX_ATTR_NODUMP: ::c_int = 0x0040; 1033 pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800; 1034 pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000; 1035 pub const STATX_ATTR_MOUNT_ROOT: ::c_int = 0x2000; 1036 pub const STATX_ATTR_VERITY: ::c_int = 0x00100000; 1037 pub const STATX_ATTR_DAX: ::c_int = 0x00200000; 1038 1039 pub const SOMAXCONN: ::c_int = 4096; 1040 1041 //sys/timex.h 1042 pub const ADJ_OFFSET: ::c_uint = 0x0001; 1043 pub const ADJ_FREQUENCY: ::c_uint = 0x0002; 1044 pub const ADJ_MAXERROR: ::c_uint = 0x0004; 1045 pub const ADJ_ESTERROR: ::c_uint = 0x0008; 1046 pub const ADJ_STATUS: ::c_uint = 0x0010; 1047 pub const ADJ_TIMECONST: ::c_uint = 0x0020; 1048 pub const ADJ_TAI: ::c_uint = 0x0080; 1049 pub const ADJ_SETOFFSET: ::c_uint = 0x0100; 1050 pub const ADJ_MICRO: ::c_uint = 0x1000; 1051 pub const ADJ_NANO: ::c_uint = 0x2000; 1052 pub const ADJ_TICK: ::c_uint = 0x4000; 1053 pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001; 1054 pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001; 1055 pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET; 1056 pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY; 1057 pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR; 1058 pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR; 1059 pub const MOD_STATUS: ::c_uint = ADJ_STATUS; 1060 pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST; 1061 pub const MOD_CLKB: ::c_uint = ADJ_TICK; 1062 pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT; 1063 pub const MOD_TAI: ::c_uint = ADJ_TAI; 1064 pub const MOD_MICRO: ::c_uint = ADJ_MICRO; 1065 pub const MOD_NANO: ::c_uint = ADJ_NANO; 1066 pub const STA_PLL: ::c_int = 0x0001; 1067 pub const STA_PPSFREQ: ::c_int = 0x0002; 1068 pub const STA_PPSTIME: ::c_int = 0x0004; 1069 pub const STA_FLL: ::c_int = 0x0008; 1070 pub const STA_INS: ::c_int = 0x0010; 1071 pub const STA_DEL: ::c_int = 0x0020; 1072 pub const STA_UNSYNC: ::c_int = 0x0040; 1073 pub const STA_FREQHOLD: ::c_int = 0x0080; 1074 pub const STA_PPSSIGNAL: ::c_int = 0x0100; 1075 pub const STA_PPSJITTER: ::c_int = 0x0200; 1076 pub const STA_PPSWANDER: ::c_int = 0x0400; 1077 pub const STA_PPSERROR: ::c_int = 0x0800; 1078 pub const STA_CLOCKERR: ::c_int = 0x1000; 1079 pub const STA_NANO: ::c_int = 0x2000; 1080 pub const STA_MODE: ::c_int = 0x4000; 1081 pub const STA_CLK: ::c_int = 0x8000; 1082 pub const STA_RONLY: ::c_int = STA_PPSSIGNAL 1083 | STA_PPSJITTER 1084 | STA_PPSWANDER 1085 | STA_PPSERROR 1086 | STA_CLOCKERR 1087 | STA_NANO 1088 | STA_MODE 1089 | STA_CLK; 1090 pub const NTP_API: ::c_int = 4; 1091 pub const TIME_OK: ::c_int = 0; 1092 pub const TIME_INS: ::c_int = 1; 1093 pub const TIME_DEL: ::c_int = 2; 1094 pub const TIME_OOP: ::c_int = 3; 1095 pub const TIME_WAIT: ::c_int = 4; 1096 pub const TIME_ERROR: ::c_int = 5; 1097 pub const TIME_BAD: ::c_int = TIME_ERROR; 1098 pub const MAXTC: ::c_long = 6; 1099 1100 cfg_if! { 1101 if #[cfg(any( 1102 target_arch = "arm", 1103 target_arch = "x86", 1104 target_arch = "x86_64", 1105 target_arch = "s390x", 1106 target_arch = "riscv64", 1107 target_arch = "riscv32" 1108 ))] { 1109 pub const PTHREAD_STACK_MIN: ::size_t = 16384; 1110 } else if #[cfg(any( 1111 target_arch = "sparc", 1112 target_arch = "sparc64" 1113 ))] { 1114 pub const PTHREAD_STACK_MIN: ::size_t = 0x6000; 1115 } else { 1116 pub const PTHREAD_STACK_MIN: ::size_t = 131072; 1117 } 1118 } 1119 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; 1120 1121 pub const REG_STARTEND: ::c_int = 4; 1122 1123 pub const REG_EEND: ::c_int = 14; 1124 pub const REG_ESIZE: ::c_int = 15; 1125 pub const REG_ERPAREN: ::c_int = 16; 1126 1127 extern "C" { 1128 pub fn fgetspent_r( 1129 fp: *mut ::FILE, 1130 spbuf: *mut ::spwd, 1131 buf: *mut ::c_char, 1132 buflen: ::size_t, 1133 spbufp: *mut *mut ::spwd, 1134 ) -> ::c_int; 1135 pub fn sgetspent_r( 1136 s: *const ::c_char, 1137 spbuf: *mut ::spwd, 1138 buf: *mut ::c_char, 1139 buflen: ::size_t, 1140 spbufp: *mut *mut ::spwd, 1141 ) -> ::c_int; 1142 pub fn getspent_r( 1143 spbuf: *mut ::spwd, 1144 buf: *mut ::c_char, 1145 buflen: ::size_t, 1146 spbufp: *mut *mut ::spwd, 1147 ) -> ::c_int; 1148 pub fn qsort_r( 1149 base: *mut ::c_void, 1150 num: ::size_t, 1151 size: ::size_t, 1152 compar: ::Option< 1153 unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int, 1154 >, 1155 arg: *mut ::c_void, 1156 ); 1157 pub fn sendmmsg( 1158 sockfd: ::c_int, 1159 msgvec: *mut ::mmsghdr, 1160 vlen: ::c_uint, 1161 flags: ::c_int, 1162 ) -> ::c_int; 1163 pub fn recvmmsg( 1164 sockfd: ::c_int, 1165 msgvec: *mut ::mmsghdr, 1166 vlen: ::c_uint, 1167 flags: ::c_int, 1168 timeout: *mut ::timespec, 1169 ) -> ::c_int; 1170 1171 pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int; 1172 pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int; 1173 pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int; 1174 pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; 1175 pub fn prlimit( 1176 pid: ::pid_t, 1177 resource: ::__rlimit_resource_t, 1178 new_limit: *const ::rlimit, 1179 old_limit: *mut ::rlimit, 1180 ) -> ::c_int; 1181 pub fn prlimit64( 1182 pid: ::pid_t, 1183 resource: ::__rlimit_resource_t, 1184 new_limit: *const ::rlimit64, 1185 old_limit: *mut ::rlimit64, 1186 ) -> ::c_int; 1187 pub fn utmpname(file: *const ::c_char) -> ::c_int; 1188 pub fn utmpxname(file: *const ::c_char) -> ::c_int; 1189 pub fn getutxent() -> *mut utmpx; 1190 pub fn getutxid(ut: *const utmpx) -> *mut utmpx; 1191 pub fn getutxline(ut: *const utmpx) -> *mut utmpx; 1192 pub fn pututxline(ut: *const utmpx) -> *mut utmpx; 1193 pub fn setutxent(); 1194 pub fn endutxent(); 1195 pub fn getpt() -> ::c_int; 1196 pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; 1197 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; 1198 pub fn statx( 1199 dirfd: ::c_int, 1200 pathname: *const c_char, 1201 flags: ::c_int, 1202 mask: ::c_uint, 1203 statxbuf: *mut statx, 1204 ) -> ::c_int; 1205 pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; 1206 pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; 1207 pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; 1208 1209 pub fn adjtimex(buf: *mut timex) -> ::c_int; 1210 pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; 1211 #[link_name = "ntp_gettimex"] 1212 pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; 1213 pub fn clock_adjtime(clk_id: ::clockid_t, buf: *mut ::timex) -> ::c_int; 1214 1215 pub fn fanotify_mark( 1216 fd: ::c_int, 1217 flags: ::c_uint, 1218 mask: u64, 1219 dirfd: ::c_int, 1220 path: *const ::c_char, 1221 ) -> ::c_int; 1222 pub fn preadv2( 1223 fd: ::c_int, 1224 iov: *const ::iovec, 1225 iovcnt: ::c_int, 1226 offset: ::off_t, 1227 flags: ::c_int, 1228 ) -> ::ssize_t; 1229 pub fn pwritev2( 1230 fd: ::c_int, 1231 iov: *const ::iovec, 1232 iovcnt: ::c_int, 1233 offset: ::off_t, 1234 flags: ::c_int, 1235 ) -> ::ssize_t; 1236 pub fn preadv64v2( 1237 fd: ::c_int, 1238 iov: *const ::iovec, 1239 iovcnt: ::c_int, 1240 offset: ::off64_t, 1241 flags: ::c_int, 1242 ) -> ::ssize_t; 1243 pub fn pwritev64v2( 1244 fd: ::c_int, 1245 iov: *const ::iovec, 1246 iovcnt: ::c_int, 1247 offset: ::off64_t, 1248 flags: ::c_int, 1249 ) -> ::ssize_t; 1250 pub fn renameat2( 1251 olddirfd: ::c_int, 1252 oldpath: *const ::c_char, 1253 newdirfd: ::c_int, 1254 newpath: *const ::c_char, 1255 flags: ::c_uint, 1256 ) -> ::c_int; 1257 1258 // Added in `glibc` 2.25 1259 pub fn explicit_bzero(s: *mut ::c_void, len: ::size_t); 1260 // Added in `glibc` 2.29 1261 pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void; 1262 1263 pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char; 1264 } 1265 1266 extern "C" { 1267 pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; 1268 pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; 1269 pub fn glob64( 1270 pattern: *const ::c_char, 1271 flags: ::c_int, 1272 errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, 1273 pglob: *mut glob64_t, 1274 ) -> ::c_int; 1275 pub fn globfree64(pglob: *mut glob64_t); 1276 pub fn ptrace(request: ::c_uint, ...) -> ::c_long; 1277 pub fn pthread_attr_getaffinity_np( 1278 attr: *const ::pthread_attr_t, 1279 cpusetsize: ::size_t, 1280 cpuset: *mut ::cpu_set_t, 1281 ) -> ::c_int; 1282 pub fn pthread_attr_setaffinity_np( 1283 attr: *mut ::pthread_attr_t, 1284 cpusetsize: ::size_t, 1285 cpuset: *const ::cpu_set_t, 1286 ) -> ::c_int; 1287 pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; 1288 pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; 1289 pub fn pthread_rwlockattr_getkind_np( 1290 attr: *const ::pthread_rwlockattr_t, 1291 val: *mut ::c_int, 1292 ) -> ::c_int; 1293 pub fn pthread_rwlockattr_setkind_np( 1294 attr: *mut ::pthread_rwlockattr_t, 1295 val: ::c_int, 1296 ) -> ::c_int; 1297 pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int; 1298 pub fn mallinfo() -> ::mallinfo; 1299 pub fn mallinfo2() -> ::mallinfo2; 1300 pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int; 1301 pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; 1302 pub fn getpwent_r( 1303 pwd: *mut ::passwd, 1304 buf: *mut ::c_char, 1305 buflen: ::size_t, 1306 result: *mut *mut ::passwd, 1307 ) -> ::c_int; 1308 pub fn getgrent_r( 1309 grp: *mut ::group, 1310 buf: *mut ::c_char, 1311 buflen: ::size_t, 1312 result: *mut *mut ::group, 1313 ) -> ::c_int; 1314 pub fn fgetpwent_r( 1315 stream: *mut ::FILE, 1316 pwd: *mut ::passwd, 1317 buf: *mut ::c_char, 1318 buflen: ::size_t, 1319 result: *mut *mut ::passwd, 1320 ) -> ::c_int; 1321 pub fn fgetgrent_r( 1322 stream: *mut ::FILE, 1323 grp: *mut ::group, 1324 buf: *mut ::c_char, 1325 buflen: ::size_t, 1326 result: *mut *mut ::group, 1327 ) -> ::c_int; 1328 1329 pub fn sethostid(hostid: ::c_long) -> ::c_int; 1330 1331 pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int; 1332 pub fn mlock2(addr: *const ::c_void, len: ::size_t, flags: ::c_uint) -> ::c_int; 1333 1334 pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; 1335 pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; 1336 1337 pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; 1338 pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char; 1339 1340 pub fn strftime( 1341 s: *mut ::c_char, 1342 max: ::size_t, 1343 format: *const ::c_char, 1344 tm: *const ::tm, 1345 ) -> ::size_t; 1346 pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; 1347 1348 pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; 1349 /// POSIX version of `basename(3)`, defined in `libgen.h`. 1350 #[link_name = "__xpg_basename"] 1351 pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char; 1352 /// GNU version of `basename(3)`, defined in `string.h`. 1353 #[link_name = "basename"] 1354 pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char; 1355 } 1356 1357 extern "C" { 1358 pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; 1359 pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int; 1360 pub fn dladdr1( 1361 addr: *const ::c_void, 1362 info: *mut ::Dl_info, 1363 extra_info: *mut *mut ::c_void, 1364 flags: ::c_int, 1365 ) -> ::c_int; 1366 pub fn malloc_trim(__pad: ::size_t) -> ::c_int; 1367 } 1368 1369 extern "C" { 1370 pub fn gnu_get_libc_release() -> *const ::c_char; 1371 pub fn gnu_get_libc_version() -> *const ::c_char; 1372 } 1373 1374 // posix/spawn.h 1375 extern "C" { 1376 // Added in `glibc` 2.29 1377 pub fn posix_spawn_file_actions_addchdir_np( 1378 actions: *mut ::posix_spawn_file_actions_t, 1379 path: *const ::c_char, 1380 ) -> ::c_int; 1381 // Added in `glibc` 2.29 1382 pub fn posix_spawn_file_actions_addfchdir_np( 1383 actions: *mut ::posix_spawn_file_actions_t, 1384 fd: ::c_int, 1385 ) -> ::c_int; 1386 // Added in `glibc` 2.34 1387 pub fn posix_spawn_file_actions_addclosefrom_np( 1388 actions: *mut ::posix_spawn_file_actions_t, 1389 from: ::c_int, 1390 ) -> ::c_int; 1391 // Added in `glibc` 2.35 1392 pub fn posix_spawn_file_actions_addtcsetpgrp_np( 1393 actions: *mut ::posix_spawn_file_actions_t, 1394 tcfd: ::c_int, 1395 ) -> ::c_int; 1396 } 1397 1398 cfg_if! { 1399 if #[cfg(any(target_arch = "x86", 1400 target_arch = "arm", 1401 target_arch = "m68k", 1402 target_arch = "mips", 1403 target_arch = "powerpc", 1404 target_arch = "sparc", 1405 target_arch = "riscv32"))] { 1406 mod b32; 1407 pub use self::b32::*; 1408 } else if #[cfg(any(target_arch = "x86_64", 1409 target_arch = "aarch64", 1410 target_arch = "powerpc64", 1411 target_arch = "mips64", 1412 target_arch = "s390x", 1413 target_arch = "sparc64", 1414 target_arch = "riscv64", 1415 target_arch = "loongarch64"))] { 1416 mod b64; 1417 pub use self::b64::*; 1418 } else { 1419 // Unknown target_arch 1420 } 1421 } 1422 1423 cfg_if! { 1424 if #[cfg(libc_align)] { 1425 mod align; 1426 pub use self::align::*; 1427 } else { 1428 mod no_align; 1429 pub use self::no_align::*; 1430 } 1431 } 1432