Auto merge of #125577 - devnexen:netbsd_stack_min, r=joboet · model-checking/verify-rust-std@fe5adb9

Original file line numberDiff line numberDiff line change

@@ -717,5 +717,14 @@ unsafe fn min_stack_size(_: *const libc::pthread_attr_t) -> usize {

717717
718718

#[cfg(target_os = "netbsd")]

719719

unsafe fn min_stack_size(_: *const libc::pthread_attr_t) -> usize {

720-

2048 // just a guess

720+

static STACK: crate::sync::OnceLock<usize> = crate::sync::OnceLock::new();

721+
722+

*STACK.get_or_init(|| {

723+

let mut stack = unsafe { libc::sysconf(libc::_SC_THREAD_STACK_MIN) };

724+

if stack < 0 {

725+

stack = 2048; // just a guess

726+

}

727+
728+

stack as usize

729+

})

721730

}