diff --git a/.github/.cspell/project-dictionary.txt b/.github/.cspell/project-dictionary.txt index 57083b33..05cbfe8a 100644 --- a/.github/.cspell/project-dictionary.txt +++ b/.github/.cspell/project-dictionary.txt @@ -5,6 +5,7 @@ algr allnoconfig aosp armasm +Auxinfo auxv auxvec bitops @@ -43,6 +44,7 @@ espup exynos FIQs getauxval +getpid HWCAP ifunc includepath @@ -94,6 +96,7 @@ osxsave pacman picolibc posix +prctl prefetcher PRIMASK quadword @@ -142,6 +145,7 @@ uapi uart umax umin +unistd unparse usart uscat diff --git a/src/imp/atomic128/detect/auxv.rs b/src/imp/atomic128/detect/auxv.rs index 485db116..eeef82d6 100644 --- a/src/imp/atomic128/detect/auxv.rs +++ b/src/imp/atomic128/detect/auxv.rs @@ -29,6 +29,8 @@ // // See also https://github.com/rust-lang/stdarch/pull/1375 // +// See tests::test_linux_like and aarch64_aa64reg.rs for (test-only) alternative implementations. +// // # FreeBSD // // As of nightly-2023-01-23, is_aarch64_feature_detected always uses mrs on @@ -47,6 +49,8 @@ // https://www.freebsd.org/security/unsupported // See also https://github.com/rust-lang/stdarch/pull/611#issuecomment-445464613 // +// See tests::test_freebsd and aarch64_aa64reg.rs for (test-only) alternative implementations. +// // # PowerPC64 // // On PowerPC64, outline-atomics is currently disabled by default mainly for @@ -235,6 +239,117 @@ mod arch { mod tests { use super::*; + #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(target_pointer_width = "64")] + #[test] + fn test_linux_like() { + use c_types::*; + use core::{arch::asm, mem}; + use test_helper::{libc, sys}; + + // Linux kernel 6.4 has added a way to read auxv without depending on either libc or mrs trap. + // https://github.com/torvalds/linux/commit/ddc65971bb677aa9f6a4c21f76d3133e106f88eb + // + // This is currently used only for testing. + fn getauxval_pr_get_auxv(type_: ffi::c_ulong) -> Result { + #[cfg(target_arch = "aarch64")] + unsafe fn prctl_get_auxv(a1: *mut u8, a2: usize) -> Result { + let r: i64; + unsafe { + asm!( + "svc 0", + in("x8") sys::__NR_prctl as u64, + inout("x0") sys::PR_GET_AUXV as u64 => r, + in("x1") ptr_reg!(a1), + in("x2") a2 as u64, + in("x3") 0_u64, + in("x4") 0_u64, + options(nostack, preserves_flags) + ); + } + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + if (r as c_int) < 0 { + Err(r as c_int) + } else { + Ok(r as usize) + } + } + #[cfg(target_arch = "powerpc64")] + unsafe fn prctl_get_auxv(a1: *mut u8, a2: usize) -> Result { + let r: i64; + unsafe { + asm!( + "sc", + "bns+ 2f", + "neg %r3, %r3", + "2:", + inout("r0") sys::__NR_prctl as u64 => _, + inout("r3") sys::PR_GET_AUXV as u64 => r, + inout("r4") ptr_reg!(a1) => _, + inout("r5") a2 as u64 => _, + inout("r6") 0_u64 => _, + inout("r7") 0_u64 => _, + out("r8") _, + out("r9") _, + out("r10") _, + out("r11") _, + out("r12") _, + out("cr0") _, + options(nostack, preserves_flags) + ); + } + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + if (r as c_int) < 0 { + Err(r as c_int) + } else { + Ok(r as usize) + } + } + + let mut auxv: [sys::Elf64_auxv_t; 26] = unsafe { mem::zeroed() }; + + let old_len = core::mem::size_of_val(&auxv); + + // SAFETY: + // - `out_len` does not exceed the size of `auxv`. + let _len = unsafe { prctl_get_auxv(auxv.as_mut_ptr().cast::(), old_len)? }; + + for aux in &auxv { + if aux.a_type == type_ { + // SAFETY: aux.a_un is #[repr(C)] union and all fields have + // the same size and can be safely transmuted to integers. + return Ok(unsafe { aux.a_un.a_val }); + } + } + Err(0) + } + + unsafe { + let mut u = mem::zeroed(); + assert_eq!(libc::uname(&mut u), 0); + let release = std::ffi::CStr::from_ptr(u.release.as_ptr()); + let release = core::str::from_utf8(release.to_bytes()).unwrap(); + let mut digits = release.split('.'); + let major = digits.next().unwrap().parse::().unwrap(); + let minor = digits.next().unwrap().parse::().unwrap(); + if (major, minor) < (6, 4) { + std::eprintln!("kernel version: {major}.{minor} (no pr_get_auxv)"); + assert_eq!(getauxval_pr_get_auxv(ffi::AT_HWCAP).unwrap_err(), -22); + assert_eq!(getauxval_pr_get_auxv(ffi::AT_HWCAP2).unwrap_err(), -22); + } else { + std::eprintln!("kernel version: {major}.{minor} (has pr_get_auxv)"); + assert_eq!( + os::getauxval(ffi::AT_HWCAP), + getauxval_pr_get_auxv(ffi::AT_HWCAP).unwrap() + ); + assert_eq!( + os::getauxval(ffi::AT_HWCAP2), + getauxval_pr_get_auxv(ffi::AT_HWCAP2).unwrap() + ); + } + } + } + #[allow(clippy::cast_sign_loss)] #[cfg(all(target_arch = "aarch64", target_os = "android"))] #[test] @@ -256,6 +371,260 @@ mod tests { } } + #[allow(clippy::cast_possible_wrap)] + #[cfg(target_os = "freebsd")] + #[test] + fn test_freebsd() { + use c_types::*; + use core::{arch::asm, mem, ptr}; + use test_helper::sys; + + // This is almost equivalent to what elf_aux_info does. + // https://man.freebsd.org/elf_aux_info(3) + // On FreeBSD, [aarch64 support is available on FreeBSD 11.0+](https://www.freebsd.org/releases/11.0R/relnotes/#hardware-arm), + // but elf_aux_info is available on FreeBSD 12.0+ and 11.4+: + // https://github.com/freebsd/freebsd-src/commit/0b08ae2120cdd08c20a2b806e2fcef4d0a36c470 + // https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/sys/auxv.h + // so use sysctl instead of elf_aux_info. + // Note that FreeBSD 11 (11.4) was EoL on 2021-09-30, and FreeBSD 11.3 was EoL on 2020-09-30: + // https://www.freebsd.org/security/unsupported + // + // std_detect uses this way, but it appears to be somewhat incorrect + // (the type of arg4 of sysctl, auxv is smaller than AT_COUNT, etc.). + // https://github.com/rust-lang/stdarch/blob/a0c30f3e3c75adcd6ee7efc94014ebcead61c507/crates/std_detect/src/detect/os/freebsd/auxvec.rs#L52 + // + // This is currently used only for testing. + // If you want us to use this implementation for compatibility with the older FreeBSD + // version that came to EoL a few years ago, please open an issue. + fn getauxval_sysctl_libc(type_: ffi::c_int) -> ffi::c_ulong { + let mut auxv: [sys::Elf64_Auxinfo; sys::AT_COUNT as usize] = unsafe { mem::zeroed() }; + + let mut len: c_size_t = core::mem::size_of_val(&auxv) as c_size_t; + + // SAFETY: calling getpid is safe. + let pid = unsafe { sys::getpid() }; + let mib = [ + sys::CTL_KERN as c_int, + sys::KERN_PROC as c_int, + sys::KERN_PROC_AUXV as c_int, + pid, + ]; + + #[allow(clippy::cast_possible_truncation)] + // SAFETY: + // - `mib.len()` does not exceed the size of `mib`. + // - `out_len` does not exceed the size of `out`. + // - `sysctl` is thread-safe. + let res = unsafe { + sys::sysctl( + mib.as_ptr(), + mib.len() as c_uint, + auxv.as_mut_ptr().cast::(), + &mut len, + ptr::null_mut(), + 0, + ) + }; + + if res != -1 { + for aux in &auxv { + if aux.a_type == type_ as c_long { + // SAFETY: aux.a_un is #[repr(C)] union and all fields have + // the same size and can be safely transmuted to integers. + return unsafe { aux.a_un.a_val as c_ulong }; + } + } + } + 0 + } + // Similar to the above, but call syscall using asm instead of libc. + // Note that FreeBSD does not guarantee the stability of raw syscall as + // much as Linux does (It may actually be stable enough, though: https://lists.llvm.org/pipermail/llvm-dev/2019-June/133393.html). + // + // This is currently used only for testing. + fn getauxval_sysctl_asm_syscall(type_: ffi::c_int) -> Result { + #[allow(non_camel_case_types)] + type pid_t = c_int; + + // https://github.com/freebsd/freebsd-src/blob/9888a79adad22ba06b5aff17d05abac0029c537a/lib/libc/aarch64/SYS.h + // https://github.com/golang/go/blob/4badad8d477ffd7a6b762c35bc69aed82faface7/src/syscall/asm_freebsd_arm64.s + #[cfg(target_arch = "aarch64")] + #[inline] + fn getpid() -> pid_t { + #[allow(clippy::cast_possible_truncation)] + // SAFETY: calling getpid is safe. + unsafe { + let n = sys::SYS_getpid; + let r: i64; + asm!( + "svc 0", + in("x8") n as u64, + out("x0") r, + options(nostack, readonly), + ); + r as pid_t + } + } + #[cfg(target_arch = "aarch64")] + #[inline] + unsafe fn sysctl( + name: *const c_int, + name_len: c_uint, + old_p: *mut c_void, + old_len_p: *mut c_size_t, + new_p: *const c_void, + new_len: c_size_t, + ) -> Result { + #[allow(clippy::cast_possible_truncation)] + // SAFETY: the caller must uphold the safety contract. + unsafe { + let mut n = sys::SYS___sysctl as u64; + let r: i64; + asm!( + "svc 0", + "b.cc 2f", + "mov x8, x0", + "mov x0, #-1", + "2:", + inout("x8") n, + inout("x0") ptr_reg!(name) => r, + inout("x1") name_len as u64 => _, + in("x2") ptr_reg!(old_p), + in("x3") ptr_reg!(old_len_p), + in("x4") ptr_reg!(new_p), + in("x5") new_len as u64, + options(nostack), + ); + if r as c_int == -1 { + Err(n as c_int) + } else { + Ok(r as c_int) + } + } + } + + // https://github.com/freebsd/freebsd-src/blob/9888a79adad22ba06b5aff17d05abac0029c537a/lib/libc/powerpc64/SYS.h + #[cfg(target_arch = "powerpc64")] + #[inline] + fn getpid() -> pid_t { + #[allow(clippy::cast_possible_truncation)] + // SAFETY: calling getpid is safe. + unsafe { + let n = sys::SYS_getpid; + let r: i64; + asm!( + "sc", + inout("r0") n as u64 => _, + out("r3") r, + out("r4") _, + out("r5") _, + out("r6") _, + out("r7") _, + out("r8") _, + out("r9") _, + out("r10") _, + out("r11") _, + out("r12") _, + out("cr0") _, + options(nostack, preserves_flags, readonly), + ); + r as pid_t + } + } + #[cfg(target_arch = "powerpc64")] + #[inline] + unsafe fn sysctl( + name: *const c_int, + name_len: c_uint, + old_p: *mut c_void, + old_len_p: *mut c_size_t, + new_p: *const c_void, + new_len: c_size_t, + ) -> Result { + #[allow(clippy::cast_possible_truncation)] + // SAFETY: the caller must uphold the safety contract. + unsafe { + let mut n = sys::SYS___sysctl as u64; + let r: i64; + asm!( + "sc", + "bns+ 2f", + "mr %r0, %r3", + "li %r3, -1", + "2:", + inout("r0") n, + inout("r3") ptr_reg!(name) => r, + inout("r4") name_len as u64 => _, + inout("r5") ptr_reg!(old_p) => _, + inout("r6") ptr_reg!(old_len_p) => _, + inout("r7") ptr_reg!(new_p) => _, + inout("r8") new_len as u64 => _, + out("r9") _, + out("r10") _, + out("r11") _, + out("r12") _, + out("cr0") _, + options(nostack, preserves_flags) + ); + if r as c_int == -1 { + Err(n as c_int) + } else { + Ok(r as c_int) + } + } + } + + let mut auxv: [sys::Elf64_Auxinfo; sys::AT_COUNT as usize] = unsafe { mem::zeroed() }; + + let mut len: c_size_t = core::mem::size_of_val(&auxv) as c_size_t; + + let pid = getpid(); + let mib = [ + sys::CTL_KERN as c_int, + sys::KERN_PROC as c_int, + sys::KERN_PROC_AUXV as c_int, + pid, + ]; + + #[allow(clippy::cast_possible_truncation)] + // SAFETY: + // - `mib.len()` does not exceed the size of `mib`. + // - `out_len` does not exceed the size of `out`. + // - `sysctl` is thread-safe. + unsafe { + sysctl( + mib.as_ptr(), + mib.len() as c_uint, + auxv.as_mut_ptr().cast::(), + &mut len, + ptr::null_mut(), + 0, + )?; + } + + for aux in &auxv { + if aux.a_type == type_ as c_long { + // SAFETY: aux.a_un is #[repr(C)] union and all fields have + // the same size and can be safely transmuted to integers. + return Ok(unsafe { aux.a_un.a_val as c_ulong }); + } + } + Err(0) + } + + assert_eq!(os::getauxval(ffi::AT_HWCAP), getauxval_sysctl_libc(ffi::AT_HWCAP)); + assert_eq!(os::getauxval(ffi::AT_HWCAP2), getauxval_sysctl_libc(ffi::AT_HWCAP2)); + assert_eq!( + os::getauxval(ffi::AT_HWCAP), + getauxval_sysctl_asm_syscall(ffi::AT_HWCAP).unwrap() + ); + assert_eq!( + os::getauxval(ffi::AT_HWCAP2), + // AT_HWCAP2 is only available on FreeBSD 13+, at least for aarch64. + getauxval_sysctl_asm_syscall(ffi::AT_HWCAP2).unwrap_or(0) + ); + } + // Static assertions for FFI bindings. // This checks that FFI bindings defined in this crate, FFI bindings defined // in libc, and FFI bindings generated for the platform's latest header file diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu/elf.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu/mod.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_be_linux_gnu/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/elf.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/mod.rs b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_be_linux_gnu_ilp32/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/machine_elf.rs b/tests/helper/src/gen/sys/aarch64_freebsd/machine_elf.rs index 711dcc23..c104302f 100644 --- a/tests/helper/src/gen/sys/aarch64_freebsd/machine_elf.rs +++ b/tests/helper/src/gen/sys/aarch64_freebsd/machine_elf.rs @@ -2,6 +2,19 @@ // (gen function at tools/codegen/src/ffi.rs). // It is not intended for manual editing. +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_Auxinfo { + pub a_type: ::std::os::raw::c_long, + pub a_un: Elf64_Auxinfo__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_Auxinfo__bindgen_ty_1 { + pub a_val: ::std::os::raw::c_long, + pub a_ptr: *mut ::core::ffi::c_void, + pub a_fcn: ::core::option::Option, +} pub const HWCAP_FP: u32 = 1; pub const HWCAP_ASIMD: u32 = 2; pub const HWCAP_EVTSTRM: u32 = 4; diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/mod.rs b/tests/helper/src/gen/sys/aarch64_freebsd/mod.rs index 84e32580..05fbe1ac 100644 --- a/tests/helper/src/gen/sys/aarch64_freebsd/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_freebsd/mod.rs @@ -5,10 +5,22 @@ #![cfg_attr(rustfmt, rustfmt::skip)] mod sys_auxv; pub use sys_auxv::elf_aux_info; +mod sys_syscall; +pub use sys_syscall::SYS_getpid; +pub use sys_syscall::SYS___sysctl; +mod sys_sysctl; +pub use sys_sysctl::CTL_KERN; +pub use sys_sysctl::KERN_PROC; +pub use sys_sysctl::KERN_PROC_AUXV; +pub use sys_sysctl::sysctl; mod sys_elf_common; pub use sys_elf_common::AT_HWCAP; pub use sys_elf_common::AT_HWCAP2; +pub use sys_elf_common::AT_COUNT; +mod unistd; +pub use unistd::getpid; mod machine_elf; +pub use machine_elf::Elf64_Auxinfo; pub use machine_elf::HWCAP_FP; pub use machine_elf::HWCAP_ASIMD; pub use machine_elf::HWCAP_EVTSTRM; diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/sys_elf_common.rs b/tests/helper/src/gen/sys/aarch64_freebsd/sys_elf_common.rs index 1d678681..297bd68c 100644 --- a/tests/helper/src/gen/sys/aarch64_freebsd/sys_elf_common.rs +++ b/tests/helper/src/gen/sys/aarch64_freebsd/sys_elf_common.rs @@ -4,3 +4,4 @@ pub const AT_HWCAP: u32 = 25; pub const AT_HWCAP2: u32 = 26; +pub const AT_COUNT: u32 = 37; diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/sys_syscall.rs b/tests/helper/src/gen/sys/aarch64_freebsd/sys_syscall.rs new file mode 100644 index 00000000..43ef3fa3 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_freebsd/sys_syscall.rs @@ -0,0 +1,6 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const SYS_getpid: u32 = 20; +pub const SYS___sysctl: u32 = 202; diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/sys_sysctl.rs b/tests/helper/src/gen/sys/aarch64_freebsd/sys_sysctl.rs new file mode 100644 index 00000000..2194c8d5 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_freebsd/sys_sysctl.rs @@ -0,0 +1,17 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const CTL_KERN: u32 = 1; +pub const KERN_PROC: u32 = 14; +pub const KERN_PROC_AUXV: u32 = 36; +extern "C" { + pub fn sysctl( + arg1: *const ::std::os::raw::c_int, + arg2: ::std::os::raw::c_uint, + arg3: *mut ::core::ffi::c_void, + arg4: *mut usize, + arg5: *const ::core::ffi::c_void, + arg6: usize, + ) -> ::std::os::raw::c_int; +} diff --git a/tests/helper/src/gen/sys/aarch64_freebsd/unistd.rs b/tests/helper/src/gen/sys/aarch64_freebsd/unistd.rs new file mode 100644 index 00000000..639a15e0 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_freebsd/unistd.rs @@ -0,0 +1,10 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub type __int32_t = ::std::os::raw::c_int; +pub type __pid_t = __int32_t; +pub type pid_t = __pid_t; +extern "C" { + pub fn getpid() -> pid_t; +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_android/elf.rs b/tests/helper/src/gen/sys/aarch64_linux_android/elf.rs new file mode 100644 index 00000000..9b553270 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_android/elf.rs @@ -0,0 +1,28 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub type __u32 = ::std::os::raw::c_uint; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: __u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: __u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: __u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: __u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_android/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_linux_android/mod.rs b/tests/helper/src/gen/sys/aarch64_linux_android/mod.rs index 3096bc33..9a3d429b 100644 --- a/tests/helper/src/gen/sys/aarch64_linux_android/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_linux_android/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -89,4 +93,7 @@ pub use sys_auxv::getauxval; mod sys_system_properties; pub use sys_system_properties::PROP_VALUE_MAX; pub use sys_system_properties::__system_property_get; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu/elf.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu/mod.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_linux_gnu/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/elf.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/mod.rs b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_linux_gnu_ilp32/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_linux_musl/elf.rs b/tests/helper/src/gen/sys/aarch64_linux_musl/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_musl/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_musl/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_linux_musl/mod.rs b/tests/helper/src/gen/sys/aarch64_linux_musl/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_linux_musl/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_linux_musl/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/aarch64_linux_uclibc/elf.rs b/tests/helper/src/gen/sys/aarch64_linux_uclibc/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_uclibc/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..d7587133 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 167; diff --git a/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/aarch64_linux_uclibc/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/aarch64_linux_uclibc/mod.rs b/tests/helper/src/gen/sys/aarch64_linux_uclibc/mod.rs index eb392307..ef4a17fc 100644 --- a/tests/helper/src/gen/sys/aarch64_linux_uclibc/mod.rs +++ b/tests/helper/src/gen/sys/aarch64_linux_uclibc/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_hwcap; pub use linux_headers_asm_hwcap::HWCAP_FP; pub use linux_headers_asm_hwcap::HWCAP_ASIMD; @@ -86,4 +90,7 @@ pub use linux_headers_asm_hwcap::HWCAP2_MOPS; pub use linux_headers_asm_hwcap::HWCAP2_HBC; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/machine_elf.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/machine_elf.rs new file mode 100644 index 00000000..08750646 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/machine_elf.rs @@ -0,0 +1,17 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_Auxinfo { + pub a_type: ::std::os::raw::c_long, + pub a_un: Elf64_Auxinfo__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_Auxinfo__bindgen_ty_1 { + pub a_val: ::std::os::raw::c_long, + pub a_ptr: *mut ::core::ffi::c_void, + pub a_fcn: ::core::option::Option, +} diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/mod.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/mod.rs index 86f7ea81..886268aa 100644 --- a/tests/helper/src/gen/sys/powerpc64_freebsd/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/mod.rs @@ -5,9 +5,22 @@ #![cfg_attr(rustfmt, rustfmt::skip)] mod sys_auxv; pub use sys_auxv::elf_aux_info; +mod sys_syscall; +pub use sys_syscall::SYS_getpid; +pub use sys_syscall::SYS___sysctl; +mod sys_sysctl; +pub use sys_sysctl::CTL_KERN; +pub use sys_sysctl::KERN_PROC; +pub use sys_sysctl::KERN_PROC_AUXV; +pub use sys_sysctl::sysctl; mod sys_elf_common; pub use sys_elf_common::AT_HWCAP; pub use sys_elf_common::AT_HWCAP2; +pub use sys_elf_common::AT_COUNT; +mod unistd; +pub use unistd::getpid; +mod machine_elf; +pub use machine_elf::Elf64_Auxinfo; mod machine_cpu; pub use machine_cpu::PPC_FEATURE_32; pub use machine_cpu::PPC_FEATURE_64; diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/sys_elf_common.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_elf_common.rs index 1d678681..297bd68c 100644 --- a/tests/helper/src/gen/sys/powerpc64_freebsd/sys_elf_common.rs +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_elf_common.rs @@ -4,3 +4,4 @@ pub const AT_HWCAP: u32 = 25; pub const AT_HWCAP2: u32 = 26; +pub const AT_COUNT: u32 = 37; diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/sys_syscall.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_syscall.rs new file mode 100644 index 00000000..43ef3fa3 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_syscall.rs @@ -0,0 +1,6 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const SYS_getpid: u32 = 20; +pub const SYS___sysctl: u32 = 202; diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/sys_sysctl.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_sysctl.rs new file mode 100644 index 00000000..2194c8d5 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/sys_sysctl.rs @@ -0,0 +1,17 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const CTL_KERN: u32 = 1; +pub const KERN_PROC: u32 = 14; +pub const KERN_PROC_AUXV: u32 = 36; +extern "C" { + pub fn sysctl( + arg1: *const ::std::os::raw::c_int, + arg2: ::std::os::raw::c_uint, + arg3: *mut ::core::ffi::c_void, + arg4: *mut usize, + arg5: *const ::core::ffi::c_void, + arg6: usize, + ) -> ::std::os::raw::c_int; +} diff --git a/tests/helper/src/gen/sys/powerpc64_freebsd/unistd.rs b/tests/helper/src/gen/sys/powerpc64_freebsd/unistd.rs new file mode 100644 index 00000000..639a15e0 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_freebsd/unistd.rs @@ -0,0 +1,10 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub type __int32_t = ::std::os::raw::c_int; +pub type __pid_t = __int32_t; +pub type pid_t = __pid_t; +extern "C" { + pub fn getpid() -> pid_t; +} diff --git a/tests/helper/src/gen/sys/powerpc64_linux_gnu/elf.rs b/tests/helper/src/gen/sys/powerpc64_linux_gnu/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_gnu/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..865e32f8 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 171; diff --git a/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_gnu/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/powerpc64_linux_gnu/mod.rs b/tests/helper/src/gen/sys/powerpc64_linux_gnu/mod.rs index 1d6025c4..6ecc0abb 100644 --- a/tests/helper/src/gen/sys/powerpc64_linux_gnu/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64_linux_gnu/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_cputable; pub use linux_headers_asm_cputable::PPC_FEATURE_32; pub use linux_headers_asm_cputable::PPC_FEATURE_64; @@ -52,4 +56,7 @@ pub use linux_headers_asm_cputable::PPC_FEATURE2_ARCH_3_1; pub use linux_headers_asm_cputable::PPC_FEATURE2_MMA; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/powerpc64_linux_musl/elf.rs b/tests/helper/src/gen/sys/powerpc64_linux_musl/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_musl/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..865e32f8 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 171; diff --git a/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64_linux_musl/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/powerpc64_linux_musl/mod.rs b/tests/helper/src/gen/sys/powerpc64_linux_musl/mod.rs index 1d6025c4..6ecc0abb 100644 --- a/tests/helper/src/gen/sys/powerpc64_linux_musl/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64_linux_musl/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_cputable; pub use linux_headers_asm_cputable::PPC_FEATURE_32; pub use linux_headers_asm_cputable::PPC_FEATURE_64; @@ -52,4 +56,7 @@ pub use linux_headers_asm_cputable::PPC_FEATURE2_ARCH_3_1; pub use linux_headers_asm_cputable::PPC_FEATURE2_MMA; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/machine_elf.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/machine_elf.rs new file mode 100644 index 00000000..08750646 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/machine_elf.rs @@ -0,0 +1,17 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_Auxinfo { + pub a_type: ::std::os::raw::c_long, + pub a_un: Elf64_Auxinfo__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_Auxinfo__bindgen_ty_1 { + pub a_val: ::std::os::raw::c_long, + pub a_ptr: *mut ::core::ffi::c_void, + pub a_fcn: ::core::option::Option, +} diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/mod.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/mod.rs index 86f7ea81..886268aa 100644 --- a/tests/helper/src/gen/sys/powerpc64le_freebsd/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/mod.rs @@ -5,9 +5,22 @@ #![cfg_attr(rustfmt, rustfmt::skip)] mod sys_auxv; pub use sys_auxv::elf_aux_info; +mod sys_syscall; +pub use sys_syscall::SYS_getpid; +pub use sys_syscall::SYS___sysctl; +mod sys_sysctl; +pub use sys_sysctl::CTL_KERN; +pub use sys_sysctl::KERN_PROC; +pub use sys_sysctl::KERN_PROC_AUXV; +pub use sys_sysctl::sysctl; mod sys_elf_common; pub use sys_elf_common::AT_HWCAP; pub use sys_elf_common::AT_HWCAP2; +pub use sys_elf_common::AT_COUNT; +mod unistd; +pub use unistd::getpid; +mod machine_elf; +pub use machine_elf::Elf64_Auxinfo; mod machine_cpu; pub use machine_cpu::PPC_FEATURE_32; pub use machine_cpu::PPC_FEATURE_64; diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_elf_common.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_elf_common.rs index 1d678681..297bd68c 100644 --- a/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_elf_common.rs +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_elf_common.rs @@ -4,3 +4,4 @@ pub const AT_HWCAP: u32 = 25; pub const AT_HWCAP2: u32 = 26; +pub const AT_COUNT: u32 = 37; diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_syscall.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_syscall.rs new file mode 100644 index 00000000..43ef3fa3 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_syscall.rs @@ -0,0 +1,6 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const SYS_getpid: u32 = 20; +pub const SYS___sysctl: u32 = 202; diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_sysctl.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_sysctl.rs new file mode 100644 index 00000000..2194c8d5 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/sys_sysctl.rs @@ -0,0 +1,17 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const CTL_KERN: u32 = 1; +pub const KERN_PROC: u32 = 14; +pub const KERN_PROC_AUXV: u32 = 36; +extern "C" { + pub fn sysctl( + arg1: *const ::std::os::raw::c_int, + arg2: ::std::os::raw::c_uint, + arg3: *mut ::core::ffi::c_void, + arg4: *mut usize, + arg5: *const ::core::ffi::c_void, + arg6: usize, + ) -> ::std::os::raw::c_int; +} diff --git a/tests/helper/src/gen/sys/powerpc64le_freebsd/unistd.rs b/tests/helper/src/gen/sys/powerpc64le_freebsd/unistd.rs new file mode 100644 index 00000000..639a15e0 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_freebsd/unistd.rs @@ -0,0 +1,10 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub type __int32_t = ::std::os::raw::c_int; +pub type __pid_t = __int32_t; +pub type pid_t = __pid_t; +extern "C" { + pub fn getpid() -> pid_t; +} diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_gnu/elf.rs b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..865e32f8 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 171; diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_gnu/mod.rs b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/mod.rs index 1d6025c4..6ecc0abb 100644 --- a/tests/helper/src/gen/sys/powerpc64le_linux_gnu/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64le_linux_gnu/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_cputable; pub use linux_headers_asm_cputable::PPC_FEATURE_32; pub use linux_headers_asm_cputable::PPC_FEATURE_64; @@ -52,4 +56,7 @@ pub use linux_headers_asm_cputable::PPC_FEATURE2_ARCH_3_1; pub use linux_headers_asm_cputable::PPC_FEATURE2_MMA; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_musl/elf.rs b/tests/helper/src/gen/sys/powerpc64le_linux_musl/elf.rs new file mode 100644 index 00000000..ff4499d2 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_musl/elf.rs @@ -0,0 +1,26 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf32_auxv_t { + pub a_type: u32, + pub a_un: Elf32_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf32_auxv_t__bindgen_ty_1 { + pub a_val: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Elf64_auxv_t { + pub a_type: u64, + pub a_un: Elf64_auxv_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union Elf64_auxv_t__bindgen_ty_1 { + pub a_val: u64, +} diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_asm_unistd.rs b/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_asm_unistd.rs new file mode 100644 index 00000000..865e32f8 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_asm_unistd.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const __NR_prctl: u32 = 171; diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_linux_prctl.rs b/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_linux_prctl.rs new file mode 100644 index 00000000..2639fd63 --- /dev/null +++ b/tests/helper/src/gen/sys/powerpc64le_linux_musl/linux_headers_linux_prctl.rs @@ -0,0 +1,5 @@ +// This file is @generated by portable-atomic-internal-codegen +// (gen function at tools/codegen/src/ffi.rs). +// It is not intended for manual editing. + +pub const PR_GET_AUXV: u32 = 1096112214; diff --git a/tests/helper/src/gen/sys/powerpc64le_linux_musl/mod.rs b/tests/helper/src/gen/sys/powerpc64le_linux_musl/mod.rs index 1d6025c4..6ecc0abb 100644 --- a/tests/helper/src/gen/sys/powerpc64le_linux_musl/mod.rs +++ b/tests/helper/src/gen/sys/powerpc64le_linux_musl/mod.rs @@ -6,6 +6,10 @@ mod linux_headers_linux_auxvec; pub use linux_headers_linux_auxvec::AT_HWCAP; pub use linux_headers_linux_auxvec::AT_HWCAP2; +mod linux_headers_linux_prctl; +pub use linux_headers_linux_prctl::PR_GET_AUXV; +mod linux_headers_asm_unistd; +pub use linux_headers_asm_unistd::__NR_prctl; mod linux_headers_asm_cputable; pub use linux_headers_asm_cputable::PPC_FEATURE_32; pub use linux_headers_asm_cputable::PPC_FEATURE_64; @@ -52,4 +56,7 @@ pub use linux_headers_asm_cputable::PPC_FEATURE2_ARCH_3_1; pub use linux_headers_asm_cputable::PPC_FEATURE2_MMA; mod sys_auxv; pub use sys_auxv::getauxval; +mod elf; +pub use elf::Elf32_auxv_t; +pub use elf::Elf64_auxv_t; pub type c_char = u8; diff --git a/tools/codegen/src/ffi.rs b/tools/codegen/src/ffi.rs index 0a8e6573..ee143432 100644 --- a/tools/codegen/src/ffi.rs +++ b/tools/codegen/src/ffi.rs @@ -53,6 +53,25 @@ static TARGETS: &[Target] = &[ os: &[], env: &[], }, + Header { + // https://github.com/torvalds/linux/blob/HEAD/include/uapi/linux/prctl.h + path: "linux-headers:linux/prctl.h", + types: &[], + vars: &["PR_GET_AUXV"], + functions: &[], + arch: &[], + os: &[], + env: &[], + }, + Header { + path: "linux-headers:asm/unistd.h", + types: &[], + vars: &["__NR_prctl"], + functions: &[], + arch: &[], + os: &[], + env: &[], + }, Header { // https://github.com/torvalds/linux/blob/HEAD/arch/arm64/include/uapi/asm/hwcap.h path: "linux-headers:asm/hwcap.h", @@ -96,6 +115,19 @@ static TARGETS: &[Target] = &[ os: &[android], env: &[], }, + Header { + // https://github.com/bminor/glibc/blob/HEAD/elf/elf.h + // https://github.com/bminor/musl/blob/HEAD/include/elf.h + // https://github.com/wbx-github/uclibc-ng/blob/HEAD/include/elf.h + // https://github.com/aosp-mirror/platform_bionic/blob/HEAD/libc/include/elf.h + path: "elf.h", + types: &["Elf32_auxv_t", "Elf64_auxv_t"], + vars: &[], + functions: &[], + arch: &[], + os: &[], + env: &[], + }, ], }, Target { @@ -130,26 +162,66 @@ static TARGETS: &[Target] = &[ os: &[], env: &[], }, + Header { + // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/sys/syscall.h + path: "sys/syscall.h", + types: &[], + vars: &["SYS_getpid", "SYS___sysctl"], + functions: &[], + arch: &[], + os: &[], + env: &[], + }, + Header { + // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/sys/sysctl.h + path: "sys/sysctl.h", + types: &[], + vars: &["CTL_KERN", "KERN_PROC", "KERN_PROC_AUXV"], + functions: &["sysctl"], + arch: &[], + os: &[], + env: &[], + }, Header { // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/sys/elf_common.h path: "sys/elf_common.h", types: &[], - vars: &["AT_HWCAP.*"], + vars: &["AT_HWCAP.*", "AT_COUNT"], functions: &[], arch: &[], os: &[], env: &[], }, + Header { + // https://github.com/freebsd/freebsd-src/blob/HEAD/include/unistd.h + path: "unistd.h", + types: &[], + vars: &[], + functions: &["getpid"], + arch: &[], + os: &[], + env: &[], + }, Header { // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/arm64/include/elf.h path: "machine/elf.h", - types: &[], + types: &["Elf64_Auxinfo"], vars: &["HWCAP.*"], functions: &[], arch: &[aarch64], os: &[], env: &[], }, + Header { + // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/powerpc/include/elf.h + path: "machine/elf.h", + types: &["Elf64_Auxinfo"], + vars: &[], + functions: &[], + arch: &[powerpc64], + os: &[], + env: &[], + }, Header { // https://github.com/freebsd/freebsd-src/blob/HEAD/sys/powerpc/include/cpu.h path: "machine/cpu.h",