From 777b719bbadec6f6942c7016dfcde226fff39e2f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 5 Feb 2024 10:31:29 +0000 Subject: [PATCH] fix cross compiling build --- library/std/src/sys/pal/unix/thread.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index add1739a70c3..c3f763bb4345 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -854,11 +854,20 @@ pub mod guard { static mut GUARD_PAGES: usize = 1; ONCE.call_once(|| { + extern "C" { + pub fn sysctlbyname( + oid: *const libc::c_char, + ov: *mut libc::c_void, + osize: *mut libc::size_t, + nv: *const libc::c_void, + nsize: libc::size_t, + ) -> libc::c_int; + } let mut guard: usize = 0; let mut size = crate::mem::size_of_val(&guard); let oid = crate::ffi::CStr::from_bytes_with_nul(b"security.bsd.stack_guard_page\0") .unwrap(); - let res = libc::sysctlbyname( + let res = sysctlbyname( oid.as_ptr(), &mut guard as *mut _ as *mut _, &mut size as *mut _ as *mut _,