Skip to content

Commit

Permalink
fix cross compiling build
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Feb 5, 2024
1 parent 3760c05 commit 777b719
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 _,
Expand Down

0 comments on commit 777b719

Please sign in to comment.