1 use crate::off64_t; 2 use crate::prelude::*; 3 4 pub type pthread_t = c_ulong; 5 pub type __priority_which_t = c_uint; 6 pub type __rlimit_resource_t = c_uint; 7 pub type Lmid_t = c_long; 8 pub type regoff_t = c_int; 9 pub type __kernel_rwf_t = c_int; 10 11 cfg_if! { 12 if #[cfg(doc)] { 13 // Used in `linux::arch` to define ioctl constants. 14 pub(crate) type Ioctl = c_ulong; 15 } else { 16 #[doc(hidden)] 17 pub type Ioctl = c_ulong; 18 } 19 } 20 21 s! { 22 pub struct aiocb { 23 pub aio_fildes: c_int, 24 pub aio_lio_opcode: c_int, 25 pub aio_reqprio: c_int, 26 pub aio_buf: *mut c_void, 27 pub aio_nbytes: size_t, 28 pub aio_sigevent: crate::sigevent, 29 __next_prio: *mut aiocb, 30 __abs_prio: c_int, 31 __policy: c_int, 32 __error_code: c_int, 33 __return_value: ssize_t, 34 pub aio_offset: off_t, 35 #[cfg(all( 36 not(gnu_file_offset_bits64), 37 not(target_arch = "x86_64"), 38 target_pointer_width = "32" 39 ))] 40 __unused1: [c_char; 4], 41 __glibc_reserved: [c_char; 32], 42 } 43 44 pub struct __exit_status { 45 pub e_termination: c_short, 46 pub e_exit: c_short, 47 } 48 49 pub struct __timeval { 50 pub tv_sec: i32, 51 pub tv_usec: i32, 52 } 53 54 pub struct glob64_t { 55 pub gl_pathc: size_t, 56 pub gl_pathv: *mut *mut c_char, 57 pub gl_offs: size_t, 58 pub gl_flags: c_int, 59 60 __unused1: *mut c_void, 61 __unused2: *mut c_void, 62 __unused3: *mut c_void, 63 __unused4: *mut c_void, 64 __unused5: *mut c_void, 65 } 66 67 pub struct msghdr { 68 pub msg_name: *mut c_void, 69 pub msg_namelen: crate::socklen_t, 70 pub msg_iov: *mut crate::iovec, 71 pub msg_iovlen: size_t, 72 pub msg_control: *mut c_void, 73 pub msg_controllen: size_t, 74 pub msg_flags: c_int, 75 } 76 77 pub struct cmsghdr { 78 pub cmsg_len: size_t, 79 pub cmsg_level: c_int, 80 pub cmsg_type: c_int, 81 } 82 83 pub struct termios { 84 pub c_iflag: crate::tcflag_t, 85 pub c_oflag: crate::tcflag_t, 86 pub c_cflag: crate::tcflag_t, 87 pub c_lflag: crate::tcflag_t, 88 pub c_line: crate::cc_t, 89 pub c_cc: [crate::cc_t; crate::NCCS], 90 #[cfg(not(any( 91 target_arch = "sparc", 92 target_arch = "sparc64", 93 target_arch = "mips", 94 target_arch = "mips32r6", 95 target_arch = "mips64", 96 target_arch = "mips64r6" 97 )))] 98 pub c_ispeed: crate::speed_t, 99 #[cfg(not(any( 100 target_arch = "sparc", 101 target_arch = "sparc64", 102 target_arch = "mips", 103 target_arch = "mips32r6", 104 target_arch = "mips64", 105 target_arch = "mips64r6" 106 )))] 107 pub c_ospeed: crate::speed_t, 108 } 109 110 pub struct mallinfo { 111 pub arena: c_int, 112 pub ordblks: c_int, 113 pub smblks: c_int, 114 pub hblks: c_int, 115 pub hblkhd: c_int, 116 pub usmblks: c_int, 117 pub fsmblks: c_int, 118 pub uordblks: c_int, 119 pub fordblks: c_int, 120 pub keepcost: c_int, 121 } 122 123 pub struct mallinfo2 { 124 pub arena: size_t, 125 pub ordblks: size_t, 126 pub smblks: size_t, 127 pub hblks: size_t, 128 pub hblkhd: size_t, 129 pub usmblks: size_t, 130 pub fsmblks: size_t, 131 pub uordblks: size_t, 132 pub fordblks: size_t, 133 pub keepcost: size_t, 134 } 135 136 pub struct nl_pktinfo { 137 pub group: u32, 138 } 139 140 pub struct nl_mmap_req { 141 pub nm_block_size: c_uint, 142 pub nm_block_nr: c_uint, 143 pub nm_frame_size: c_uint, 144 pub nm_frame_nr: c_uint, 145 } 146 147 pub struct nl_mmap_hdr { 148 pub nm_status: c_uint, 149 pub nm_len: c_uint, 150 pub nm_group: u32, 151 pub nm_pid: u32, 152 pub nm_uid: u32, 153 pub nm_gid: u32, 154 } 155 156 pub struct rtentry { 157 pub rt_pad1: c_ulong, 158 pub rt_dst: crate::sockaddr, 159 pub rt_gateway: crate::sockaddr, 160 pub rt_genmask: crate::sockaddr, 161 pub rt_flags: c_ushort, 162 pub rt_pad2: c_short, 163 pub rt_pad3: c_ulong, 164 pub rt_tos: c_uchar, 165 pub rt_class: c_uchar, 166 #[cfg(target_pointer_width = "64")] 167 pub rt_pad4: [c_short; 3usize], 168 #[cfg(not(target_pointer_width = "64"))] 169 pub rt_pad4: c_short, 170 pub rt_metric: c_short, 171 pub rt_dev: *mut c_char, 172 pub rt_mtu: c_ulong, 173 pub rt_window: c_ulong, 174 pub rt_irtt: c_ushort, 175 } 176 177 pub struct ntptimeval { 178 pub time: crate::timeval, 179 pub maxerror: c_long, 180 pub esterror: c_long, 181 pub tai: c_long, 182 pub __glibc_reserved1: c_long, 183 pub __glibc_reserved2: c_long, 184 pub __glibc_reserved3: c_long, 185 pub __glibc_reserved4: c_long, 186 } 187 188 pub struct regex_t { 189 __buffer: *mut c_void, 190 __allocated: size_t, 191 __used: size_t, 192 __syntax: c_ulong, 193 __fastmap: *mut c_char, 194 __translate: *mut c_char, 195 __re_nsub: size_t, 196 __bitfield: u8, 197 } 198 199 pub struct Elf64_Chdr { 200 pub ch_type: crate::Elf64_Word, 201 pub ch_reserved: crate::Elf64_Word, 202 pub ch_size: crate::Elf64_Xword, 203 pub ch_addralign: crate::Elf64_Xword, 204 } 205 206 pub struct Elf32_Chdr { 207 pub ch_type: crate::Elf32_Word, 208 pub ch_size: crate::Elf32_Word, 209 pub ch_addralign: crate::Elf32_Word, 210 } 211 212 pub struct seminfo { 213 pub semmap: c_int, 214 pub semmni: c_int, 215 pub semmns: c_int, 216 pub semmnu: c_int, 217 pub semmsl: c_int, 218 pub semopm: c_int, 219 pub semume: c_int, 220 pub semusz: c_int, 221 pub semvmx: c_int, 222 pub semaem: c_int, 223 } 224 225 pub struct ptrace_peeksiginfo_args { 226 pub off: crate::__u64, 227 pub flags: crate::__u32, 228 pub nr: crate::__s32, 229 } 230 231 pub struct __c_anonymous_ptrace_syscall_info_entry { 232 pub nr: crate::__u64, 233 pub args: [crate::__u64; 6], 234 } 235 236 pub struct __c_anonymous_ptrace_syscall_info_exit { 237 pub sval: crate::__s64, 238 pub is_error: crate::__u8, 239 } 240 241 pub struct __c_anonymous_ptrace_syscall_info_seccomp { 242 pub nr: crate::__u64, 243 pub args: [crate::__u64; 6], 244 pub ret_data: crate::__u32, 245 } 246 247 pub struct ptrace_syscall_info { 248 pub op: crate::__u8, 249 pub pad: [crate::__u8; 3], 250 pub arch: crate::__u32, 251 pub instruction_pointer: crate::__u64, 252 pub stack_pointer: crate::__u64, 253 pub u: __c_anonymous_ptrace_syscall_info_data, 254 } 255 256 pub struct ptrace_sud_config { 257 pub mode: crate::__u64, 258 pub selector: crate::__u64, 259 pub offset: crate::__u64, 260 pub len: crate::__u64, 261 } 262 263 pub struct iocb { 264 pub aio_data: crate::__u64, 265 #[cfg(target_endian = "little")] 266 pub aio_key: crate::__u32, 267 #[cfg(target_endian = "little")] 268 pub aio_rw_flags: crate::__kernel_rwf_t, 269 #[cfg(target_endian = "big")] 270 pub aio_rw_flags: crate::__kernel_rwf_t, 271 #[cfg(target_endian = "big")] 272 pub aio_key: crate::__u32, 273 pub aio_lio_opcode: crate::__u16, 274 pub aio_reqprio: crate::__s16, 275 pub aio_fildes: crate::__u32, 276 pub aio_buf: crate::__u64, 277 pub aio_nbytes: crate::__u64, 278 pub aio_offset: crate::__s64, 279 aio_reserved2: crate::__u64, 280 pub aio_flags: crate::__u32, 281 pub aio_resfd: crate::__u32, 282 } 283 284 // netinet/tcp.h 285 286 pub struct tcp_info { 287 pub tcpi_state: u8, 288 pub tcpi_ca_state: u8, 289 pub tcpi_retransmits: u8, 290 pub tcpi_probes: u8, 291 pub tcpi_backoff: u8, 292 pub tcpi_options: u8, 293 /// This contains the bitfields `tcpi_snd_wscale` and `tcpi_rcv_wscale`. 294 /// Each is 4 bits. 295 pub tcpi_snd_rcv_wscale: u8, 296 pub tcpi_rto: u32, 297 pub tcpi_ato: u32, 298 pub tcpi_snd_mss: u32, 299 pub tcpi_rcv_mss: u32, 300 pub tcpi_unacked: u32, 301 pub tcpi_sacked: u32, 302 pub tcpi_lost: u32, 303 pub tcpi_retrans: u32, 304 pub tcpi_fackets: u32, 305 pub tcpi_last_data_sent: u32, 306 pub tcpi_last_ack_sent: u32, 307 pub tcpi_last_data_recv: u32, 308 pub tcpi_last_ack_recv: u32, 309 pub tcpi_pmtu: u32, 310 pub tcpi_rcv_ssthresh: u32, 311 pub tcpi_rtt: u32, 312 pub tcpi_rttvar: u32, 313 pub tcpi_snd_ssthresh: u32, 314 pub tcpi_snd_cwnd: u32, 315 pub tcpi_advmss: u32, 316 pub tcpi_reordering: u32, 317 pub tcpi_rcv_rtt: u32, 318 pub tcpi_rcv_space: u32, 319 pub tcpi_total_retrans: u32, 320 } 321 322 pub struct fanotify_event_info_pidfd { 323 pub hdr: crate::fanotify_event_info_header, 324 pub pidfd: crate::__s32, 325 } 326 327 pub struct fanotify_event_info_error { 328 pub hdr: crate::fanotify_event_info_header, 329 pub error: crate::__s32, 330 pub error_count: crate::__u32, 331 } 332 333 // FIXME(1.0) this is actually a union 334 #[cfg_attr(target_pointer_width = "32", repr(align(4)))] 335 #[cfg_attr(target_pointer_width = "64", repr(align(8)))] 336 pub struct sem_t { 337 #[cfg(target_pointer_width = "32")] 338 __size: [c_char; 16], 339 #[cfg(target_pointer_width = "64")] 340 __size: [c_char; 32], 341 } 342 343 pub struct mbstate_t { 344 __count: c_int, 345 __wchb: [c_char; 4], 346 } 347 348 pub struct fpos64_t { 349 __pos: off64_t, 350 __state: crate::mbstate_t, 351 } 352 353 pub struct fpos_t { 354 #[cfg(not(gnu_file_offset_bits64))] 355 __pos: off_t, 356 #[cfg(gnu_file_offset_bits64)] 357 __pos: off64_t, 358 __state: crate::mbstate_t, 359 } 360 361 // linux x32 compatibility 362 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 363 pub struct timespec { 364 pub tv_sec: time_t, 365 #[cfg(all(gnu_time_bits64, target_endian = "big"))] 366 __pad: i32, 367 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] 368 pub tv_nsec: c_long, 369 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] 370 pub tv_nsec: i64, 371 #[cfg(all(gnu_time_bits64, target_endian = "little"))] 372 __pad: i32, 373 } 374 } 375 376 impl siginfo_t { si_addr(&self) -> *mut c_void377 pub unsafe fn si_addr(&self) -> *mut c_void { 378 #[repr(C)] 379 struct siginfo_sigfault { 380 _si_signo: c_int, 381 _si_errno: c_int, 382 _si_code: c_int, 383 si_addr: *mut c_void, 384 } 385 (*(self as *const siginfo_t).cast::<siginfo_sigfault>()).si_addr 386 } 387 si_value(&self) -> crate::sigval388 pub unsafe fn si_value(&self) -> crate::sigval { 389 #[repr(C)] 390 struct siginfo_timer { 391 _si_signo: c_int, 392 _si_errno: c_int, 393 _si_code: c_int, 394 _si_tid: c_int, 395 _si_overrun: c_int, 396 si_sigval: crate::sigval, 397 } 398 (*(self as *const siginfo_t).cast::<siginfo_timer>()).si_sigval 399 } 400 } 401 402 // Internal, for casts to access union fields 403 #[repr(C)] 404 struct sifields_sigchld { 405 si_pid: crate::pid_t, 406 si_uid: crate::uid_t, 407 si_status: c_int, 408 si_utime: c_long, 409 si_stime: c_long, 410 } 411 impl Copy for sifields_sigchld {} 412 impl Clone for sifields_sigchld { clone(&self) -> sifields_sigchld413 fn clone(&self) -> sifields_sigchld { 414 *self 415 } 416 } 417 418 // Internal, for casts to access union fields 419 #[repr(C)] 420 union sifields { 421 _align_pointer: *mut c_void, 422 sigchld: sifields_sigchld, 423 } 424 425 // Internal, for casts to access union fields. Note that some variants 426 // of sifields start with a pointer, which makes the alignment of 427 // sifields vary on 32-bit and 64-bit architectures. 428 #[repr(C)] 429 struct siginfo_f { 430 _siginfo_base: [c_int; 3], 431 sifields: sifields, 432 } 433 434 impl siginfo_t { sifields(&self) -> &sifields435 unsafe fn sifields(&self) -> &sifields { 436 &(*(self as *const siginfo_t).cast::<siginfo_f>()).sifields 437 } 438 si_pid(&self) -> crate::pid_t439 pub unsafe fn si_pid(&self) -> crate::pid_t { 440 self.sifields().sigchld.si_pid 441 } 442 si_uid(&self) -> crate::uid_t443 pub unsafe fn si_uid(&self) -> crate::uid_t { 444 self.sifields().sigchld.si_uid 445 } 446 si_status(&self) -> c_int447 pub unsafe fn si_status(&self) -> c_int { 448 self.sifields().sigchld.si_status 449 } 450 si_utime(&self) -> c_long451 pub unsafe fn si_utime(&self) -> c_long { 452 self.sifields().sigchld.si_utime 453 } 454 si_stime(&self) -> c_long455 pub unsafe fn si_stime(&self) -> c_long { 456 self.sifields().sigchld.si_stime 457 } 458 } 459 460 s_no_extra_traits! { 461 pub union __c_anonymous_ptrace_syscall_info_data { 462 pub entry: __c_anonymous_ptrace_syscall_info_entry, 463 pub exit: __c_anonymous_ptrace_syscall_info_exit, 464 pub seccomp: __c_anonymous_ptrace_syscall_info_seccomp, 465 } 466 467 pub struct utmpx { 468 pub ut_type: c_short, 469 pub ut_pid: crate::pid_t, 470 pub ut_line: [c_char; __UT_LINESIZE], 471 pub ut_id: [c_char; 4], 472 473 pub ut_user: [c_char; __UT_NAMESIZE], 474 pub ut_host: [c_char; __UT_HOSTSIZE], 475 pub ut_exit: __exit_status, 476 477 #[cfg(any( 478 target_arch = "aarch64", 479 target_arch = "s390x", 480 target_arch = "loongarch64", 481 all(target_pointer_width = "32", not(target_arch = "x86_64")) 482 ))] 483 pub ut_session: c_long, 484 #[cfg(any( 485 target_arch = "aarch64", 486 target_arch = "s390x", 487 target_arch = "loongarch64", 488 all(target_pointer_width = "32", not(target_arch = "x86_64")) 489 ))] 490 pub ut_tv: crate::timeval, 491 492 #[cfg(not(any( 493 target_arch = "aarch64", 494 target_arch = "s390x", 495 target_arch = "loongarch64", 496 all(target_pointer_width = "32", not(target_arch = "x86_64")) 497 )))] 498 pub ut_session: i32, 499 #[cfg(not(any( 500 target_arch = "aarch64", 501 target_arch = "s390x", 502 target_arch = "loongarch64", 503 all(target_pointer_width = "32", not(target_arch = "x86_64")) 504 )))] 505 pub ut_tv: __timeval, 506 507 pub ut_addr_v6: [i32; 4], 508 __glibc_reserved: [c_char; 20], 509 } 510 } 511 512 cfg_if! { 513 if #[cfg(feature = "extra_traits")] { 514 impl PartialEq for utmpx { 515 fn eq(&self, other: &utmpx) -> bool { 516 self.ut_type == other.ut_type 517 && self.ut_pid == other.ut_pid 518 && self.ut_line == other.ut_line 519 && self.ut_id == other.ut_id 520 && self.ut_user == other.ut_user 521 && self 522 .ut_host 523 .iter() 524 .zip(other.ut_host.iter()) 525 .all(|(a, b)| a == b) 526 && self.ut_exit == other.ut_exit 527 && self.ut_session == other.ut_session 528 && self.ut_tv == other.ut_tv 529 && self.ut_addr_v6 == other.ut_addr_v6 530 && self.__glibc_reserved == other.__glibc_reserved 531 } 532 } 533 534 impl Eq for utmpx {} 535 536 impl hash::Hash for utmpx { 537 fn hash<H: hash::Hasher>(&self, state: &mut H) { 538 self.ut_type.hash(state); 539 self.ut_pid.hash(state); 540 self.ut_line.hash(state); 541 self.ut_id.hash(state); 542 self.ut_user.hash(state); 543 self.ut_host.hash(state); 544 self.ut_exit.hash(state); 545 self.ut_session.hash(state); 546 self.ut_tv.hash(state); 547 self.ut_addr_v6.hash(state); 548 self.__glibc_reserved.hash(state); 549 } 550 } 551 552 impl PartialEq for __c_anonymous_ptrace_syscall_info_data { 553 fn eq(&self, other: &__c_anonymous_ptrace_syscall_info_data) -> bool { 554 unsafe { 555 self.entry == other.entry 556 || self.exit == other.exit 557 || self.seccomp == other.seccomp 558 } 559 } 560 } 561 562 impl Eq for __c_anonymous_ptrace_syscall_info_data {} 563 564 impl hash::Hash for __c_anonymous_ptrace_syscall_info_data { 565 fn hash<H: hash::Hasher>(&self, state: &mut H) { 566 unsafe { 567 self.entry.hash(state); 568 self.exit.hash(state); 569 self.seccomp.hash(state); 570 } 571 } 572 } 573 } 574 } 575 576 // include/uapi/asm-generic/hugetlb_encode.h 577 pub const HUGETLB_FLAG_ENCODE_SHIFT: c_int = 26; 578 pub const HUGETLB_FLAG_ENCODE_MASK: c_int = 0x3f; 579 580 pub const HUGETLB_FLAG_ENCODE_64KB: c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT; 581 pub const HUGETLB_FLAG_ENCODE_512KB: c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT; 582 pub const HUGETLB_FLAG_ENCODE_1MB: c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT; 583 pub const HUGETLB_FLAG_ENCODE_2MB: c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT; 584 pub const HUGETLB_FLAG_ENCODE_8MB: c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT; 585 pub const HUGETLB_FLAG_ENCODE_16MB: c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT; 586 pub const HUGETLB_FLAG_ENCODE_32MB: c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT; 587 pub const HUGETLB_FLAG_ENCODE_256MB: c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT; 588 pub const HUGETLB_FLAG_ENCODE_512MB: c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT; 589 pub const HUGETLB_FLAG_ENCODE_1GB: c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT; 590 pub const HUGETLB_FLAG_ENCODE_2GB: c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT; 591 pub const HUGETLB_FLAG_ENCODE_16GB: c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT; 592 593 // include/uapi/linux/mman.h 594 /* 595 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page 596 * size other than the default is desired. See hugetlb_encode.h. 597 * All known huge page size encodings are provided here. It is the 598 * responsibility of the application to know which sizes are supported on 599 * the running system. See mmap(2) man page for details. 600 */ 601 pub const MAP_HUGE_SHIFT: c_int = HUGETLB_FLAG_ENCODE_SHIFT; 602 pub const MAP_HUGE_MASK: c_int = HUGETLB_FLAG_ENCODE_MASK; 603 604 pub const MAP_HUGE_64KB: c_int = HUGETLB_FLAG_ENCODE_64KB; 605 pub const MAP_HUGE_512KB: c_int = HUGETLB_FLAG_ENCODE_512KB; 606 pub const MAP_HUGE_1MB: c_int = HUGETLB_FLAG_ENCODE_1MB; 607 pub const MAP_HUGE_2MB: c_int = HUGETLB_FLAG_ENCODE_2MB; 608 pub const MAP_HUGE_8MB: c_int = HUGETLB_FLAG_ENCODE_8MB; 609 pub const MAP_HUGE_16MB: c_int = HUGETLB_FLAG_ENCODE_16MB; 610 pub const MAP_HUGE_32MB: c_int = HUGETLB_FLAG_ENCODE_32MB; 611 pub const MAP_HUGE_256MB: c_int = HUGETLB_FLAG_ENCODE_256MB; 612 pub const MAP_HUGE_512MB: c_int = HUGETLB_FLAG_ENCODE_512MB; 613 pub const MAP_HUGE_1GB: c_int = HUGETLB_FLAG_ENCODE_1GB; 614 pub const MAP_HUGE_2GB: c_int = HUGETLB_FLAG_ENCODE_2GB; 615 pub const MAP_HUGE_16GB: c_int = HUGETLB_FLAG_ENCODE_16GB; 616 617 pub const PRIO_PROCESS: crate::__priority_which_t = 0; 618 pub const PRIO_PGRP: crate::__priority_which_t = 1; 619 pub const PRIO_USER: crate::__priority_which_t = 2; 620 621 pub const MS_RMT_MASK: c_ulong = 0x02800051; 622 623 pub const __UT_LINESIZE: usize = 32; 624 pub const __UT_NAMESIZE: usize = 32; 625 pub const __UT_HOSTSIZE: usize = 256; 626 pub const EMPTY: c_short = 0; 627 pub const RUN_LVL: c_short = 1; 628 pub const BOOT_TIME: c_short = 2; 629 pub const NEW_TIME: c_short = 3; 630 pub const OLD_TIME: c_short = 4; 631 pub const INIT_PROCESS: c_short = 5; 632 pub const LOGIN_PROCESS: c_short = 6; 633 pub const USER_PROCESS: c_short = 7; 634 pub const DEAD_PROCESS: c_short = 8; 635 pub const ACCOUNTING: c_short = 9; 636 637 // dlfcn.h 638 pub const LM_ID_BASE: c_long = 0; 639 pub const LM_ID_NEWLM: c_long = -1; 640 641 pub const RTLD_DI_LMID: c_int = 1; 642 pub const RTLD_DI_LINKMAP: c_int = 2; 643 pub const RTLD_DI_CONFIGADDR: c_int = 3; 644 pub const RTLD_DI_SERINFO: c_int = 4; 645 pub const RTLD_DI_SERINFOSIZE: c_int = 5; 646 pub const RTLD_DI_ORIGIN: c_int = 6; 647 pub const RTLD_DI_PROFILENAME: c_int = 7; 648 pub const RTLD_DI_PROFILEOUT: c_int = 8; 649 pub const RTLD_DI_TLS_MODID: c_int = 9; 650 pub const RTLD_DI_TLS_DATA: c_int = 10; 651 652 pub const SOCK_NONBLOCK: c_int = O_NONBLOCK; 653 654 pub const SOL_RXRPC: c_int = 272; 655 pub const SOL_PPPOL2TP: c_int = 273; 656 pub const SOL_PNPIPE: c_int = 275; 657 pub const SOL_RDS: c_int = 276; 658 pub const SOL_IUCV: c_int = 277; 659 pub const SOL_CAIF: c_int = 278; 660 pub const SOL_NFC: c_int = 280; 661 662 pub const MSG_TRYHARD: c_int = 4; 663 664 pub const LC_PAPER: c_int = 7; 665 pub const LC_NAME: c_int = 8; 666 pub const LC_ADDRESS: c_int = 9; 667 pub const LC_TELEPHONE: c_int = 10; 668 pub const LC_MEASUREMENT: c_int = 11; 669 pub const LC_IDENTIFICATION: c_int = 12; 670 pub const LC_PAPER_MASK: c_int = 1 << LC_PAPER; 671 pub const LC_NAME_MASK: c_int = 1 << LC_NAME; 672 pub const LC_ADDRESS_MASK: c_int = 1 << LC_ADDRESS; 673 pub const LC_TELEPHONE_MASK: c_int = 1 << LC_TELEPHONE; 674 pub const LC_MEASUREMENT_MASK: c_int = 1 << LC_MEASUREMENT; 675 pub const LC_IDENTIFICATION_MASK: c_int = 1 << LC_IDENTIFICATION; 676 pub const LC_ALL_MASK: c_int = crate::LC_CTYPE_MASK 677 | crate::LC_NUMERIC_MASK 678 | crate::LC_TIME_MASK 679 | crate::LC_COLLATE_MASK 680 | crate::LC_MONETARY_MASK 681 | crate::LC_MESSAGES_MASK 682 | LC_PAPER_MASK 683 | LC_NAME_MASK 684 | LC_ADDRESS_MASK 685 | LC_TELEPHONE_MASK 686 | LC_MEASUREMENT_MASK 687 | LC_IDENTIFICATION_MASK; 688 689 pub const ENOTSUP: c_int = EOPNOTSUPP; 690 691 pub const SOCK_SEQPACKET: c_int = 5; 692 pub const SOCK_DCCP: c_int = 6; 693 #[deprecated(since = "0.2.70", note = "AF_PACKET must be used instead")] 694 pub const SOCK_PACKET: c_int = 10; 695 696 pub const AF_IB: c_int = 27; 697 pub const AF_MPLS: c_int = 28; 698 pub const AF_NFC: c_int = 39; 699 pub const AF_VSOCK: c_int = 40; 700 pub const AF_XDP: c_int = 44; 701 pub const PF_IB: c_int = AF_IB; 702 pub const PF_MPLS: c_int = AF_MPLS; 703 pub const PF_NFC: c_int = AF_NFC; 704 pub const PF_VSOCK: c_int = AF_VSOCK; 705 pub const PF_XDP: c_int = AF_XDP; 706 707 pub const SIGEV_THREAD_ID: c_int = 4; 708 709 pub const BUFSIZ: c_uint = 8192; 710 pub const TMP_MAX: c_uint = 238328; 711 pub const FOPEN_MAX: c_uint = 16; 712 pub const FILENAME_MAX: c_uint = 4096; 713 pub const POSIX_MADV_DONTNEED: c_int = 4; 714 pub const _CS_GNU_LIBC_VERSION: c_int = 2; 715 pub const _CS_GNU_LIBPTHREAD_VERSION: c_int = 3; 716 pub const _CS_V6_ENV: c_int = 1148; 717 pub const _CS_V7_ENV: c_int = 1149; 718 pub const _SC_EQUIV_CLASS_MAX: c_int = 41; 719 pub const _SC_CHARCLASS_NAME_MAX: c_int = 45; 720 pub const _SC_PII: c_int = 53; 721 pub const _SC_PII_XTI: c_int = 54; 722 pub const _SC_PII_SOCKET: c_int = 55; 723 pub const _SC_PII_INTERNET: c_int = 56; 724 pub const _SC_PII_OSI: c_int = 57; 725 pub const _SC_POLL: c_int = 58; 726 pub const _SC_SELECT: c_int = 59; 727 pub const _SC_PII_INTERNET_STREAM: c_int = 61; 728 pub const _SC_PII_INTERNET_DGRAM: c_int = 62; 729 pub const _SC_PII_OSI_COTS: c_int = 63; 730 pub const _SC_PII_OSI_CLTS: c_int = 64; 731 pub const _SC_PII_OSI_M: c_int = 65; 732 pub const _SC_T_IOV_MAX: c_int = 66; 733 pub const _SC_2_C_VERSION: c_int = 96; 734 pub const _SC_CHAR_BIT: c_int = 101; 735 pub const _SC_CHAR_MAX: c_int = 102; 736 pub const _SC_CHAR_MIN: c_int = 103; 737 pub const _SC_INT_MAX: c_int = 104; 738 pub const _SC_INT_MIN: c_int = 105; 739 pub const _SC_LONG_BIT: c_int = 106; 740 pub const _SC_WORD_BIT: c_int = 107; 741 pub const _SC_MB_LEN_MAX: c_int = 108; 742 pub const _SC_SSIZE_MAX: c_int = 110; 743 pub const _SC_SCHAR_MAX: c_int = 111; 744 pub const _SC_SCHAR_MIN: c_int = 112; 745 pub const _SC_SHRT_MAX: c_int = 113; 746 pub const _SC_SHRT_MIN: c_int = 114; 747 pub const _SC_UCHAR_MAX: c_int = 115; 748 pub const _SC_UINT_MAX: c_int = 116; 749 pub const _SC_ULONG_MAX: c_int = 117; 750 pub const _SC_USHRT_MAX: c_int = 118; 751 pub const _SC_NL_ARGMAX: c_int = 119; 752 pub const _SC_NL_LANGMAX: c_int = 120; 753 pub const _SC_NL_MSGMAX: c_int = 121; 754 pub const _SC_NL_NMAX: c_int = 122; 755 pub const _SC_NL_SETMAX: c_int = 123; 756 pub const _SC_NL_TEXTMAX: c_int = 124; 757 pub const _SC_BASE: c_int = 134; 758 pub const _SC_C_LANG_SUPPORT: c_int = 135; 759 pub const _SC_C_LANG_SUPPORT_R: c_int = 136; 760 pub const _SC_DEVICE_IO: c_int = 140; 761 pub const _SC_DEVICE_SPECIFIC: c_int = 141; 762 pub const _SC_DEVICE_SPECIFIC_R: c_int = 142; 763 pub const _SC_FD_MGMT: c_int = 143; 764 pub const _SC_FIFO: c_int = 144; 765 pub const _SC_PIPE: c_int = 145; 766 pub const _SC_FILE_ATTRIBUTES: c_int = 146; 767 pub const _SC_FILE_LOCKING: c_int = 147; 768 pub const _SC_FILE_SYSTEM: c_int = 148; 769 pub const _SC_MULTI_PROCESS: c_int = 150; 770 pub const _SC_SINGLE_PROCESS: c_int = 151; 771 pub const _SC_NETWORKING: c_int = 152; 772 pub const _SC_REGEX_VERSION: c_int = 156; 773 pub const _SC_SIGNALS: c_int = 158; 774 pub const _SC_SYSTEM_DATABASE: c_int = 162; 775 pub const _SC_SYSTEM_DATABASE_R: c_int = 163; 776 pub const _SC_USER_GROUPS: c_int = 166; 777 pub const _SC_USER_GROUPS_R: c_int = 167; 778 pub const _SC_LEVEL1_ICACHE_SIZE: c_int = 185; 779 pub const _SC_LEVEL1_ICACHE_ASSOC: c_int = 186; 780 pub const _SC_LEVEL1_ICACHE_LINESIZE: c_int = 187; 781 pub const _SC_LEVEL1_DCACHE_SIZE: c_int = 188; 782 pub const _SC_LEVEL1_DCACHE_ASSOC: c_int = 189; 783 pub const _SC_LEVEL1_DCACHE_LINESIZE: c_int = 190; 784 pub const _SC_LEVEL2_CACHE_SIZE: c_int = 191; 785 pub const _SC_LEVEL2_CACHE_ASSOC: c_int = 192; 786 pub const _SC_LEVEL2_CACHE_LINESIZE: c_int = 193; 787 pub const _SC_LEVEL3_CACHE_SIZE: c_int = 194; 788 pub const _SC_LEVEL3_CACHE_ASSOC: c_int = 195; 789 pub const _SC_LEVEL3_CACHE_LINESIZE: c_int = 196; 790 pub const _SC_LEVEL4_CACHE_SIZE: c_int = 197; 791 pub const _SC_LEVEL4_CACHE_ASSOC: c_int = 198; 792 pub const _SC_LEVEL4_CACHE_LINESIZE: c_int = 199; 793 pub const O_ACCMODE: c_int = 3; 794 pub const ST_RELATIME: c_ulong = 4096; 795 pub const NI_MAXHOST: crate::socklen_t = 1025; 796 797 // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the 798 // following are only available on newer Linux versions than the versions 799 // currently used in CI in some configurations, so we define them here. 800 cfg_if! { 801 if #[cfg(not(target_arch = "s390x"))] { 802 pub const BINDERFS_SUPER_MAGIC: c_long = 0x6c6f6f70; 803 pub const XFS_SUPER_MAGIC: c_long = 0x58465342; 804 } else if #[cfg(target_arch = "s390x")] { 805 pub const BINDERFS_SUPER_MAGIC: c_uint = 0x6c6f6f70; 806 pub const XFS_SUPER_MAGIC: c_uint = 0x58465342; 807 } 808 } 809 810 pub const CPU_SETSIZE: c_int = 0x400; 811 812 pub const PTRACE_TRACEME: c_uint = 0; 813 pub const PTRACE_PEEKTEXT: c_uint = 1; 814 pub const PTRACE_PEEKDATA: c_uint = 2; 815 pub const PTRACE_PEEKUSER: c_uint = 3; 816 pub const PTRACE_POKETEXT: c_uint = 4; 817 pub const PTRACE_POKEDATA: c_uint = 5; 818 pub const PTRACE_POKEUSER: c_uint = 6; 819 pub const PTRACE_CONT: c_uint = 7; 820 pub const PTRACE_KILL: c_uint = 8; 821 pub const PTRACE_SINGLESTEP: c_uint = 9; 822 pub const PTRACE_ATTACH: c_uint = 16; 823 pub const PTRACE_SYSCALL: c_uint = 24; 824 pub const PTRACE_SETOPTIONS: c_uint = 0x4200; 825 pub const PTRACE_GETEVENTMSG: c_uint = 0x4201; 826 pub const PTRACE_GETSIGINFO: c_uint = 0x4202; 827 pub const PTRACE_SETSIGINFO: c_uint = 0x4203; 828 pub const PTRACE_GETREGSET: c_uint = 0x4204; 829 pub const PTRACE_SETREGSET: c_uint = 0x4205; 830 pub const PTRACE_SEIZE: c_uint = 0x4206; 831 pub const PTRACE_INTERRUPT: c_uint = 0x4207; 832 pub const PTRACE_LISTEN: c_uint = 0x4208; 833 pub const PTRACE_PEEKSIGINFO: c_uint = 0x4209; 834 pub const PTRACE_GETSIGMASK: c_uint = 0x420a; 835 pub const PTRACE_SETSIGMASK: c_uint = 0x420b; 836 pub const PTRACE_GET_SYSCALL_INFO: c_uint = 0x420e; 837 pub const PTRACE_SYSCALL_INFO_NONE: crate::__u8 = 0; 838 pub const PTRACE_SYSCALL_INFO_ENTRY: crate::__u8 = 1; 839 pub const PTRACE_SYSCALL_INFO_EXIT: crate::__u8 = 2; 840 pub const PTRACE_SYSCALL_INFO_SECCOMP: crate::__u8 = 3; 841 pub const PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4210; 842 pub const PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4211; 843 844 // linux/rtnetlink.h 845 pub const TCA_PAD: c_ushort = 9; 846 pub const TCA_DUMP_INVISIBLE: c_ushort = 10; 847 pub const TCA_CHAIN: c_ushort = 11; 848 pub const TCA_HW_OFFLOAD: c_ushort = 12; 849 850 pub const RTM_DELNETCONF: u16 = 81; 851 pub const RTM_NEWSTATS: u16 = 92; 852 pub const RTM_GETSTATS: u16 = 94; 853 pub const RTM_NEWCACHEREPORT: u16 = 96; 854 855 pub const RTM_F_LOOKUP_TABLE: c_uint = 0x1000; 856 pub const RTM_F_FIB_MATCH: c_uint = 0x2000; 857 858 pub const RTA_VIA: c_ushort = 18; 859 pub const RTA_NEWDST: c_ushort = 19; 860 pub const RTA_PREF: c_ushort = 20; 861 pub const RTA_ENCAP_TYPE: c_ushort = 21; 862 pub const RTA_ENCAP: c_ushort = 22; 863 pub const RTA_EXPIRES: c_ushort = 23; 864 pub const RTA_PAD: c_ushort = 24; 865 pub const RTA_UID: c_ushort = 25; 866 pub const RTA_TTL_PROPAGATE: c_ushort = 26; 867 868 // linux/neighbor.h 869 pub const NTF_EXT_LEARNED: u8 = 0x10; 870 pub const NTF_OFFLOADED: u8 = 0x20; 871 872 pub const NDA_MASTER: c_ushort = 9; 873 pub const NDA_LINK_NETNSID: c_ushort = 10; 874 pub const NDA_SRC_VNI: c_ushort = 11; 875 876 // linux/personality.h 877 pub const UNAME26: c_int = 0x0020000; 878 pub const FDPIC_FUNCPTRS: c_int = 0x0080000; 879 880 pub const MAX_LINKS: c_int = 32; 881 882 pub const GENL_UNS_ADMIN_PERM: c_int = 0x10; 883 884 pub const GENL_ID_VFS_DQUOT: c_int = crate::NLMSG_MIN_TYPE + 1; 885 pub const GENL_ID_PMCRAID: c_int = crate::NLMSG_MIN_TYPE + 2; 886 887 pub const ELFOSABI_ARM_AEABI: u8 = 64; 888 889 // linux/sched.h 890 pub const CLONE_NEWTIME: c_int = 0x80; 891 // DIFF(main): changed to `c_ulonglong` in e9abac9ac2 892 pub const CLONE_CLEAR_SIGHAND: c_int = 0x100000000; 893 pub const CLONE_INTO_CGROUP: c_int = 0x200000000; 894 895 // linux/keyctl.h 896 pub const KEYCTL_DH_COMPUTE: u32 = 23; 897 pub const KEYCTL_PKEY_QUERY: u32 = 24; 898 pub const KEYCTL_PKEY_ENCRYPT: u32 = 25; 899 pub const KEYCTL_PKEY_DECRYPT: u32 = 26; 900 pub const KEYCTL_PKEY_SIGN: u32 = 27; 901 pub const KEYCTL_PKEY_VERIFY: u32 = 28; 902 pub const KEYCTL_RESTRICT_KEYRING: u32 = 29; 903 904 pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01; 905 pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02; 906 pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04; 907 pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08; 908 cfg_if! { 909 if #[cfg(not(any( 910 target_arch = "mips", 911 target_arch = "mips32r6", 912 target_arch = "mips64", 913 target_arch = "mips64r6" 914 )))] { 915 pub const KEYCTL_MOVE: u32 = 30; 916 pub const KEYCTL_CAPABILITIES: u32 = 31; 917 918 pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01; 919 pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02; 920 pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04; 921 pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08; 922 pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10; 923 pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20; 924 pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40; 925 pub const KEYCTL_CAPS0_MOVE: u32 = 0x80; 926 pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01; 927 pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02; 928 } 929 } 930 931 pub const M_MXFAST: c_int = 1; 932 pub const M_NLBLKS: c_int = 2; 933 pub const M_GRAIN: c_int = 3; 934 pub const M_KEEP: c_int = 4; 935 pub const M_TRIM_THRESHOLD: c_int = -1; 936 pub const M_TOP_PAD: c_int = -2; 937 pub const M_MMAP_THRESHOLD: c_int = -3; 938 pub const M_MMAP_MAX: c_int = -4; 939 pub const M_CHECK_ACTION: c_int = -5; 940 pub const M_PERTURB: c_int = -6; 941 pub const M_ARENA_TEST: c_int = -7; 942 pub const M_ARENA_MAX: c_int = -8; 943 944 pub const SOMAXCONN: c_int = 4096; 945 946 // linux/mount.h 947 pub const MOVE_MOUNT_F_SYMLINKS: c_uint = 0x00000001; 948 pub const MOVE_MOUNT_F_AUTOMOUNTS: c_uint = 0x00000002; 949 pub const MOVE_MOUNT_F_EMPTY_PATH: c_uint = 0x00000004; 950 pub const MOVE_MOUNT_T_SYMLINKS: c_uint = 0x00000010; 951 pub const MOVE_MOUNT_T_AUTOMOUNTS: c_uint = 0x00000020; 952 pub const MOVE_MOUNT_T_EMPTY_PATH: c_uint = 0x00000040; 953 pub const MOVE_MOUNT_SET_GROUP: c_uint = 0x00000100; 954 pub const MOVE_MOUNT_BENEATH: c_uint = 0x00000200; 955 956 // sys/timex.h 957 pub const ADJ_OFFSET: c_uint = 0x0001; 958 pub const ADJ_FREQUENCY: c_uint = 0x0002; 959 pub const ADJ_MAXERROR: c_uint = 0x0004; 960 pub const ADJ_ESTERROR: c_uint = 0x0008; 961 pub const ADJ_STATUS: c_uint = 0x0010; 962 pub const ADJ_TIMECONST: c_uint = 0x0020; 963 pub const ADJ_TAI: c_uint = 0x0080; 964 pub const ADJ_SETOFFSET: c_uint = 0x0100; 965 pub const ADJ_MICRO: c_uint = 0x1000; 966 pub const ADJ_NANO: c_uint = 0x2000; 967 pub const ADJ_TICK: c_uint = 0x4000; 968 pub const ADJ_OFFSET_SINGLESHOT: c_uint = 0x8001; 969 pub const ADJ_OFFSET_SS_READ: c_uint = 0xa001; 970 pub const MOD_OFFSET: c_uint = ADJ_OFFSET; 971 pub const MOD_FREQUENCY: c_uint = ADJ_FREQUENCY; 972 pub const MOD_MAXERROR: c_uint = ADJ_MAXERROR; 973 pub const MOD_ESTERROR: c_uint = ADJ_ESTERROR; 974 pub const MOD_STATUS: c_uint = ADJ_STATUS; 975 pub const MOD_TIMECONST: c_uint = ADJ_TIMECONST; 976 pub const MOD_CLKB: c_uint = ADJ_TICK; 977 pub const MOD_CLKA: c_uint = ADJ_OFFSET_SINGLESHOT; 978 pub const MOD_TAI: c_uint = ADJ_TAI; 979 pub const MOD_MICRO: c_uint = ADJ_MICRO; 980 pub const MOD_NANO: c_uint = ADJ_NANO; 981 pub const STA_PLL: c_int = 0x0001; 982 pub const STA_PPSFREQ: c_int = 0x0002; 983 pub const STA_PPSTIME: c_int = 0x0004; 984 pub const STA_FLL: c_int = 0x0008; 985 pub const STA_INS: c_int = 0x0010; 986 pub const STA_DEL: c_int = 0x0020; 987 pub const STA_UNSYNC: c_int = 0x0040; 988 pub const STA_FREQHOLD: c_int = 0x0080; 989 pub const STA_PPSSIGNAL: c_int = 0x0100; 990 pub const STA_PPSJITTER: c_int = 0x0200; 991 pub const STA_PPSWANDER: c_int = 0x0400; 992 pub const STA_PPSERROR: c_int = 0x0800; 993 pub const STA_CLOCKERR: c_int = 0x1000; 994 pub const STA_NANO: c_int = 0x2000; 995 pub const STA_MODE: c_int = 0x4000; 996 pub const STA_CLK: c_int = 0x8000; 997 pub const STA_RONLY: c_int = STA_PPSSIGNAL 998 | STA_PPSJITTER 999 | STA_PPSWANDER 1000 | STA_PPSERROR 1001 | STA_CLOCKERR 1002 | STA_NANO 1003 | STA_MODE 1004 | STA_CLK; 1005 pub const NTP_API: c_int = 4; 1006 pub const TIME_OK: c_int = 0; 1007 pub const TIME_INS: c_int = 1; 1008 pub const TIME_DEL: c_int = 2; 1009 pub const TIME_OOP: c_int = 3; 1010 pub const TIME_WAIT: c_int = 4; 1011 pub const TIME_ERROR: c_int = 5; 1012 pub const TIME_BAD: c_int = TIME_ERROR; 1013 pub const MAXTC: c_long = 6; 1014 1015 // Portable GLOB_* flags are defined at the `linux_like` level. 1016 // The following are GNU extensions. 1017 pub const GLOB_PERIOD: c_int = 1 << 7; 1018 pub const GLOB_ALTDIRFUNC: c_int = 1 << 9; 1019 pub const GLOB_BRACE: c_int = 1 << 10; 1020 pub const GLOB_NOMAGIC: c_int = 1 << 11; 1021 pub const GLOB_TILDE: c_int = 1 << 12; 1022 pub const GLOB_ONLYDIR: c_int = 1 << 13; 1023 pub const GLOB_TILDE_CHECK: c_int = 1 << 14; 1024 1025 pub const MADV_COLLAPSE: c_int = 25; 1026 1027 cfg_if! { 1028 if #[cfg(any( 1029 target_arch = "arm", 1030 target_arch = "x86", 1031 target_arch = "x86_64", 1032 target_arch = "s390x", 1033 target_arch = "riscv64", 1034 target_arch = "riscv32" 1035 ))] { 1036 pub const PTHREAD_STACK_MIN: size_t = 16384; 1037 } else if #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] { 1038 pub const PTHREAD_STACK_MIN: size_t = 0x6000; 1039 } else { 1040 pub const PTHREAD_STACK_MIN: size_t = 131072; 1041 } 1042 } 1043 pub const PTHREAD_MUTEX_ADAPTIVE_NP: c_int = 3; 1044 1045 pub const REG_STARTEND: c_int = 4; 1046 1047 pub const REG_EEND: c_int = 14; 1048 pub const REG_ESIZE: c_int = 15; 1049 pub const REG_ERPAREN: c_int = 16; 1050 1051 extern "C" { fgetspent_r( fp: *mut crate::FILE, spbuf: *mut crate::spwd, buf: *mut c_char, buflen: size_t, spbufp: *mut *mut crate::spwd, ) -> c_int1052 pub fn fgetspent_r( 1053 fp: *mut crate::FILE, 1054 spbuf: *mut crate::spwd, 1055 buf: *mut c_char, 1056 buflen: size_t, 1057 spbufp: *mut *mut crate::spwd, 1058 ) -> c_int; sgetspent_r( s: *const c_char, spbuf: *mut crate::spwd, buf: *mut c_char, buflen: size_t, spbufp: *mut *mut crate::spwd, ) -> c_int1059 pub fn sgetspent_r( 1060 s: *const c_char, 1061 spbuf: *mut crate::spwd, 1062 buf: *mut c_char, 1063 buflen: size_t, 1064 spbufp: *mut *mut crate::spwd, 1065 ) -> c_int; getspent_r( spbuf: *mut crate::spwd, buf: *mut c_char, buflen: size_t, spbufp: *mut *mut crate::spwd, ) -> c_int1066 pub fn getspent_r( 1067 spbuf: *mut crate::spwd, 1068 buf: *mut c_char, 1069 buflen: size_t, 1070 spbufp: *mut *mut crate::spwd, 1071 ) -> c_int; qsort_r( base: *mut c_void, num: size_t, size: size_t, compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>, arg: *mut c_void, )1072 pub fn qsort_r( 1073 base: *mut c_void, 1074 num: size_t, 1075 size: size_t, 1076 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>, 1077 arg: *mut c_void, 1078 ); 1079 #[cfg_attr(gnu_time_bits64, link_name = "__sendmmsg64")] sendmmsg( sockfd: c_int, msgvec: *mut crate::mmsghdr, vlen: c_uint, flags: c_int, ) -> c_int1080 pub fn sendmmsg( 1081 sockfd: c_int, 1082 msgvec: *mut crate::mmsghdr, 1083 vlen: c_uint, 1084 flags: c_int, 1085 ) -> c_int; 1086 #[cfg_attr(gnu_time_bits64, link_name = "__recvmmsg64")] recvmmsg( sockfd: c_int, msgvec: *mut crate::mmsghdr, vlen: c_uint, flags: c_int, timeout: *mut crate::timespec, ) -> c_int1087 pub fn recvmmsg( 1088 sockfd: c_int, 1089 msgvec: *mut crate::mmsghdr, 1090 vlen: c_uint, 1091 flags: c_int, 1092 timeout: *mut crate::timespec, 1093 ) -> c_int; 1094 getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int1095 pub fn getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int; setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) -> c_int1096 pub fn setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) 1097 -> c_int; 1098 #[cfg_attr(gnu_file_offset_bits64, link_name = "getrlimit64")] getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int1099 pub fn getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; 1100 #[cfg_attr(gnu_file_offset_bits64, link_name = "setrlimit64")] setrlimit(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit) -> c_int1101 pub fn setrlimit(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; 1102 #[cfg_attr(gnu_file_offset_bits64, link_name = "prlimit64")] prlimit( pid: crate::pid_t, resource: crate::__rlimit_resource_t, new_limit: *const crate::rlimit, old_limit: *mut crate::rlimit, ) -> c_int1103 pub fn prlimit( 1104 pid: crate::pid_t, 1105 resource: crate::__rlimit_resource_t, 1106 new_limit: *const crate::rlimit, 1107 old_limit: *mut crate::rlimit, 1108 ) -> c_int; prlimit64( pid: crate::pid_t, resource: crate::__rlimit_resource_t, new_limit: *const crate::rlimit64, old_limit: *mut crate::rlimit64, ) -> c_int1109 pub fn prlimit64( 1110 pid: crate::pid_t, 1111 resource: crate::__rlimit_resource_t, 1112 new_limit: *const crate::rlimit64, 1113 old_limit: *mut crate::rlimit64, 1114 ) -> c_int; utmpname(file: *const c_char) -> c_int1115 pub fn utmpname(file: *const c_char) -> c_int; utmpxname(file: *const c_char) -> c_int1116 pub fn utmpxname(file: *const c_char) -> c_int; getutxent() -> *mut utmpx1117 pub fn getutxent() -> *mut utmpx; getutxid(ut: *const utmpx) -> *mut utmpx1118 pub fn getutxid(ut: *const utmpx) -> *mut utmpx; getutxline(ut: *const utmpx) -> *mut utmpx1119 pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pututxline(ut: *const utmpx) -> *mut utmpx1120 pub fn pututxline(ut: *const utmpx) -> *mut utmpx; setutxent()1121 pub fn setutxent(); endutxent()1122 pub fn endutxent(); getpt() -> c_int1123 pub fn getpt() -> c_int; mallopt(param: c_int, value: c_int) -> c_int1124 pub fn mallopt(param: c_int, value: c_int) -> c_int; 1125 #[cfg_attr(gnu_time_bits64, link_name = "__gettimeofday64")] gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int1126 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int; getentropy(buf: *mut c_void, buflen: size_t) -> c_int1127 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t1128 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; getauxval(type_: c_ulong) -> c_ulong1129 pub fn getauxval(type_: c_ulong) -> c_ulong; 1130 1131 #[cfg_attr(gnu_time_bits64, link_name = "___adjtimex64")] adjtimex(buf: *mut timex) -> c_int1132 pub fn adjtimex(buf: *mut timex) -> c_int; 1133 #[cfg_attr(gnu_time_bits64, link_name = "___adjtimex64")] ntp_adjtime(buf: *mut timex) -> c_int1134 pub fn ntp_adjtime(buf: *mut timex) -> c_int; 1135 #[cfg_attr(not(gnu_time_bits64), link_name = "ntp_gettimex")] 1136 #[cfg_attr(gnu_time_bits64, link_name = "__ntp_gettime64")] ntp_gettime(buf: *mut ntptimeval) -> c_int1137 pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int; 1138 #[cfg_attr(gnu_time_bits64, link_name = "__clock_adjtime64")] clock_adjtime(clk_id: crate::clockid_t, buf: *mut crate::timex) -> c_int1139 pub fn clock_adjtime(clk_id: crate::clockid_t, buf: *mut crate::timex) -> c_int; 1140 fanotify_mark( fd: c_int, flags: c_uint, mask: u64, dirfd: c_int, path: *const c_char, ) -> c_int1141 pub fn fanotify_mark( 1142 fd: c_int, 1143 flags: c_uint, 1144 mask: u64, 1145 dirfd: c_int, 1146 path: *const c_char, 1147 ) -> c_int; 1148 #[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64v2")] preadv2( fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t, flags: c_int, ) -> ssize_t1149 pub fn preadv2( 1150 fd: c_int, 1151 iov: *const crate::iovec, 1152 iovcnt: c_int, 1153 offset: off_t, 1154 flags: c_int, 1155 ) -> ssize_t; 1156 #[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64v2")] pwritev2( fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t, flags: c_int, ) -> ssize_t1157 pub fn pwritev2( 1158 fd: c_int, 1159 iov: *const crate::iovec, 1160 iovcnt: c_int, 1161 offset: off_t, 1162 flags: c_int, 1163 ) -> ssize_t; preadv64v2( fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t, flags: c_int, ) -> ssize_t1164 pub fn preadv64v2( 1165 fd: c_int, 1166 iov: *const crate::iovec, 1167 iovcnt: c_int, 1168 offset: off64_t, 1169 flags: c_int, 1170 ) -> ssize_t; pwritev64v2( fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t, flags: c_int, ) -> ssize_t1171 pub fn pwritev64v2( 1172 fd: c_int, 1173 iov: *const crate::iovec, 1174 iovcnt: c_int, 1175 offset: off64_t, 1176 flags: c_int, 1177 ) -> ssize_t; renameat2( olddirfd: c_int, oldpath: *const c_char, newdirfd: c_int, newpath: *const c_char, flags: c_uint, ) -> c_int1178 pub fn renameat2( 1179 olddirfd: c_int, 1180 oldpath: *const c_char, 1181 newdirfd: c_int, 1182 newpath: *const c_char, 1183 flags: c_uint, 1184 ) -> c_int; 1185 1186 // Added in `glibc` 2.25 explicit_bzero(s: *mut c_void, len: size_t)1187 pub fn explicit_bzero(s: *mut c_void, len: size_t); 1188 // Added in `glibc` 2.29 reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void1189 pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void; 1190 ctermid(s: *mut c_char) -> *mut c_char1191 pub fn ctermid(s: *mut c_char) -> *mut c_char; backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int1192 pub fn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int; 1193 #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")] glob64( pattern: *const c_char, flags: c_int, errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, pglob: *mut glob64_t, ) -> c_int1194 pub fn glob64( 1195 pattern: *const c_char, 1196 flags: c_int, 1197 errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, 1198 pglob: *mut glob64_t, 1199 ) -> c_int; 1200 #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")] globfree64(pglob: *mut glob64_t)1201 pub fn globfree64(pglob: *mut glob64_t); ptrace(request: c_uint, ...) -> c_long1202 pub fn ptrace(request: c_uint, ...) -> c_long; pthread_attr_getaffinity_np( attr: *const crate::pthread_attr_t, cpusetsize: size_t, cpuset: *mut crate::cpu_set_t, ) -> c_int1203 pub fn pthread_attr_getaffinity_np( 1204 attr: *const crate::pthread_attr_t, 1205 cpusetsize: size_t, 1206 cpuset: *mut crate::cpu_set_t, 1207 ) -> c_int; pthread_attr_setaffinity_np( attr: *mut crate::pthread_attr_t, cpusetsize: size_t, cpuset: *const crate::cpu_set_t, ) -> c_int1208 pub fn pthread_attr_setaffinity_np( 1209 attr: *mut crate::pthread_attr_t, 1210 cpusetsize: size_t, 1211 cpuset: *const crate::cpu_set_t, 1212 ) -> c_int; getpriority(which: crate::__priority_which_t, who: crate::id_t) -> c_int1213 pub fn getpriority(which: crate::__priority_which_t, who: crate::id_t) -> c_int; setpriority(which: crate::__priority_which_t, who: crate::id_t, prio: c_int) -> c_int1214 pub fn setpriority(which: crate::__priority_which_t, who: crate::id_t, prio: c_int) -> c_int; pthread_rwlockattr_getkind_np( attr: *const crate::pthread_rwlockattr_t, val: *mut c_int, ) -> c_int1215 pub fn pthread_rwlockattr_getkind_np( 1216 attr: *const crate::pthread_rwlockattr_t, 1217 val: *mut c_int, 1218 ) -> c_int; pthread_rwlockattr_setkind_np( attr: *mut crate::pthread_rwlockattr_t, val: c_int, ) -> c_int1219 pub fn pthread_rwlockattr_setkind_np( 1220 attr: *mut crate::pthread_rwlockattr_t, 1221 val: c_int, 1222 ) -> c_int; pthread_sigqueue(thread: crate::pthread_t, sig: c_int, value: crate::sigval) -> c_int1223 pub fn pthread_sigqueue(thread: crate::pthread_t, sig: c_int, value: crate::sigval) -> c_int; mallinfo() -> crate::mallinfo1224 pub fn mallinfo() -> crate::mallinfo; mallinfo2() -> crate::mallinfo21225 pub fn mallinfo2() -> crate::mallinfo2; malloc_stats()1226 pub fn malloc_stats(); malloc_info(options: c_int, stream: *mut crate::FILE) -> c_int1227 pub fn malloc_info(options: c_int, stream: *mut crate::FILE) -> c_int; malloc_usable_size(ptr: *mut c_void) -> size_t1228 pub fn malloc_usable_size(ptr: *mut c_void) -> size_t; getpwent_r( pwd: *mut crate::passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::passwd, ) -> c_int1229 pub fn getpwent_r( 1230 pwd: *mut crate::passwd, 1231 buf: *mut c_char, 1232 buflen: size_t, 1233 result: *mut *mut crate::passwd, 1234 ) -> c_int; getgrent_r( grp: *mut crate::group, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::group, ) -> c_int1235 pub fn getgrent_r( 1236 grp: *mut crate::group, 1237 buf: *mut c_char, 1238 buflen: size_t, 1239 result: *mut *mut crate::group, 1240 ) -> c_int; fgetpwent_r( stream: *mut crate::FILE, pwd: *mut crate::passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::passwd, ) -> c_int1241 pub fn fgetpwent_r( 1242 stream: *mut crate::FILE, 1243 pwd: *mut crate::passwd, 1244 buf: *mut c_char, 1245 buflen: size_t, 1246 result: *mut *mut crate::passwd, 1247 ) -> c_int; fgetgrent_r( stream: *mut crate::FILE, grp: *mut crate::group, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::group, ) -> c_int1248 pub fn fgetgrent_r( 1249 stream: *mut crate::FILE, 1250 grp: *mut crate::group, 1251 buf: *mut c_char, 1252 buflen: size_t, 1253 result: *mut *mut crate::group, 1254 ) -> c_int; 1255 putpwent(p: *const crate::passwd, stream: *mut crate::FILE) -> c_int1256 pub fn putpwent(p: *const crate::passwd, stream: *mut crate::FILE) -> c_int; putgrent(grp: *const crate::group, stream: *mut crate::FILE) -> c_int1257 pub fn putgrent(grp: *const crate::group, stream: *mut crate::FILE) -> c_int; 1258 sethostid(hostid: c_long) -> c_int1259 pub fn sethostid(hostid: c_long) -> c_int; 1260 memfd_create(name: *const c_char, flags: c_uint) -> c_int1261 pub fn memfd_create(name: *const c_char, flags: c_uint) -> c_int; mlock2(addr: *const c_void, len: size_t, flags: c_uint) -> c_int1262 pub fn mlock2(addr: *const c_void, len: size_t, flags: c_uint) -> c_int; 1263 euidaccess(pathname: *const c_char, mode: c_int) -> c_int1264 pub fn euidaccess(pathname: *const c_char, mode: c_int) -> c_int; eaccess(pathname: *const c_char, mode: c_int) -> c_int1265 pub fn eaccess(pathname: *const c_char, mode: c_int) -> c_int; 1266 asctime_r(tm: *const crate::tm, buf: *mut c_char) -> *mut c_char1267 pub fn asctime_r(tm: *const crate::tm, buf: *mut c_char) -> *mut c_char; 1268 #[cfg_attr(gnu_time_bits64, link_name = "__ctime64_r")] ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char1269 pub fn ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char; 1270 dirname(path: *mut c_char) -> *mut c_char1271 pub fn dirname(path: *mut c_char) -> *mut c_char; 1272 /// POSIX version of `basename(3)`, defined in `libgen.h`. 1273 #[link_name = "__xpg_basename"] posix_basename(path: *mut c_char) -> *mut c_char1274 pub fn posix_basename(path: *mut c_char) -> *mut c_char; 1275 /// GNU version of `basename(3)`, defined in `string.h`. 1276 #[link_name = "basename"] gnu_basename(path: *const c_char) -> *mut c_char1277 pub fn gnu_basename(path: *const c_char) -> *mut c_char; dlmopen(lmid: Lmid_t, filename: *const c_char, flag: c_int) -> *mut c_void1278 pub fn dlmopen(lmid: Lmid_t, filename: *const c_char, flag: c_int) -> *mut c_void; dlinfo(handle: *mut c_void, request: c_int, info: *mut c_void) -> c_int1279 pub fn dlinfo(handle: *mut c_void, request: c_int, info: *mut c_void) -> c_int; dladdr1( addr: *const c_void, info: *mut crate::Dl_info, extra_info: *mut *mut c_void, flags: c_int, ) -> c_int1280 pub fn dladdr1( 1281 addr: *const c_void, 1282 info: *mut crate::Dl_info, 1283 extra_info: *mut *mut c_void, 1284 flags: c_int, 1285 ) -> c_int; malloc_trim(__pad: size_t) -> c_int1286 pub fn malloc_trim(__pad: size_t) -> c_int; gnu_get_libc_release() -> *const c_char1287 pub fn gnu_get_libc_release() -> *const c_char; gnu_get_libc_version() -> *const c_char1288 pub fn gnu_get_libc_version() -> *const c_char; 1289 1290 // posix/spawn.h 1291 // Added in `glibc` 2.29 posix_spawn_file_actions_addchdir_np( actions: *mut crate::posix_spawn_file_actions_t, path: *const c_char, ) -> c_int1292 pub fn posix_spawn_file_actions_addchdir_np( 1293 actions: *mut crate::posix_spawn_file_actions_t, 1294 path: *const c_char, 1295 ) -> c_int; 1296 // Added in `glibc` 2.29 posix_spawn_file_actions_addfchdir_np( actions: *mut crate::posix_spawn_file_actions_t, fd: c_int, ) -> c_int1297 pub fn posix_spawn_file_actions_addfchdir_np( 1298 actions: *mut crate::posix_spawn_file_actions_t, 1299 fd: c_int, 1300 ) -> c_int; 1301 // Added in `glibc` 2.34 posix_spawn_file_actions_addclosefrom_np( actions: *mut crate::posix_spawn_file_actions_t, from: c_int, ) -> c_int1302 pub fn posix_spawn_file_actions_addclosefrom_np( 1303 actions: *mut crate::posix_spawn_file_actions_t, 1304 from: c_int, 1305 ) -> c_int; 1306 // Added in `glibc` 2.35 posix_spawn_file_actions_addtcsetpgrp_np( actions: *mut crate::posix_spawn_file_actions_t, tcfd: c_int, ) -> c_int1307 pub fn posix_spawn_file_actions_addtcsetpgrp_np( 1308 actions: *mut crate::posix_spawn_file_actions_t, 1309 tcfd: c_int, 1310 ) -> c_int; 1311 1312 // mntent.h getmntent_r( stream: *mut crate::FILE, mntbuf: *mut crate::mntent, buf: *mut c_char, buflen: c_int, ) -> *mut crate::mntent1313 pub fn getmntent_r( 1314 stream: *mut crate::FILE, 1315 mntbuf: *mut crate::mntent, 1316 buf: *mut c_char, 1317 buflen: c_int, 1318 ) -> *mut crate::mntent; 1319 execveat( dirfd: c_int, pathname: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char, flags: c_int, ) -> c_int1320 pub fn execveat( 1321 dirfd: c_int, 1322 pathname: *const c_char, 1323 argv: *const *mut c_char, 1324 envp: *const *mut c_char, 1325 flags: c_int, 1326 ) -> c_int; 1327 1328 // Added in `glibc` 2.34 close_range(first: c_uint, last: c_uint, flags: c_int) -> c_int1329 pub fn close_range(first: c_uint, last: c_uint, flags: c_int) -> c_int; 1330 mq_notify(mqdes: crate::mqd_t, sevp: *const crate::sigevent) -> c_int1331 pub fn mq_notify(mqdes: crate::mqd_t, sevp: *const crate::sigevent) -> c_int; 1332 1333 #[cfg_attr(gnu_time_bits64, link_name = "__epoll_pwait2_time64")] epoll_pwait2( epfd: c_int, events: *mut crate::epoll_event, maxevents: c_int, timeout: *const crate::timespec, sigmask: *const crate::sigset_t, ) -> c_int1334 pub fn epoll_pwait2( 1335 epfd: c_int, 1336 events: *mut crate::epoll_event, 1337 maxevents: c_int, 1338 timeout: *const crate::timespec, 1339 sigmask: *const crate::sigset_t, 1340 ) -> c_int; 1341 mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void1342 pub fn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; 1343 } 1344 1345 cfg_if! { 1346 if #[cfg(any( 1347 target_arch = "x86", 1348 target_arch = "arm", 1349 target_arch = "m68k", 1350 target_arch = "csky", 1351 target_arch = "mips", 1352 target_arch = "mips32r6", 1353 target_arch = "powerpc", 1354 target_arch = "sparc", 1355 target_arch = "riscv32" 1356 ))] { 1357 mod b32; 1358 pub use self::b32::*; 1359 } else if #[cfg(any( 1360 target_arch = "x86_64", 1361 target_arch = "aarch64", 1362 target_arch = "powerpc64", 1363 target_arch = "mips64", 1364 target_arch = "mips64r6", 1365 target_arch = "s390x", 1366 target_arch = "sparc64", 1367 target_arch = "riscv64", 1368 target_arch = "loongarch64" 1369 ))] { 1370 mod b64; 1371 pub use self::b64::*; 1372 } else { 1373 // Unknown target_arch 1374 } 1375 } 1376