- this PR should close #16261 
- fixes #16261

Confirmed to build with Rust-1.86 and to yield a working binary.
This commit is contained in:
pin
2025-07-27 21:27:35 +02:00
committed by GitHub
parent f8698a6c24
commit 28a796d5cb

View File

@ -100,6 +100,8 @@ unsafe fn sysctl_get(
data: *mut libc::c_void,
data_len: *mut usize,
) -> i32 {
// Safety: Call to unsafe function `libc::sysctl`
unsafe {
sysctl(
name,
name_len,
@ -113,6 +115,7 @@ unsafe fn sysctl_get(
0,
)
}
}
fn get_procs() -> io::Result<Vec<KInfoProc>> {
// To understand what's going on here, see the sysctl(3) and sysctl(7) manpages for NetBSD.
@ -249,6 +252,8 @@ fn get_proc_args(pid: i32, what: i32) -> io::Result<Vec<u8>> {
// For getting simple values from the sysctl interface
unsafe fn get_ctl<T>(ctl_name: &[i32]) -> io::Result<T> {
// Safety: Call to unsafe function `netbsd::sysctl_get`
unsafe {
let mut value: MaybeUninit<T> = MaybeUninit::uninit();
let mut value_len = mem::size_of_val(&value);
check(sysctl_get(
@ -259,6 +264,7 @@ unsafe fn get_ctl<T>(ctl_name: &[i32]) -> io::Result<T> {
))?;
Ok(value.assume_init())
}
}
fn get_pagesize() -> io::Result<libc::c_int> {
// not in libc for some reason