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