mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
fixup! Add workaround for targets with too small a main stack size
This commit is contained in:
parent
a3e0d64e88
commit
b495cffa50
4
build.rs
4
build.rs
|
@ -192,9 +192,9 @@ fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
|
||||||
// build.rs is executed on the main thread, so we are getting the main thread's stack size.
|
// build.rs is executed on the main thread, so we are getting the main thread's stack size.
|
||||||
// Modern macOS versions default to an 8 MiB main stack but legacy OS X have a 0.5 MiB one.
|
// Modern macOS versions default to an 8 MiB main stack but legacy OS X have a 0.5 MiB one.
|
||||||
let stack_size = unsafe { pthread_get_stacksize_np(pthread_self()) };
|
let stack_size = unsafe { pthread_get_stacksize_np(pthread_self()) };
|
||||||
const TWO_MIB: usize = 2 * 1024 * 1024;
|
const TWO_MIB: usize = 2 * 1024 * 1024 - 1;
|
||||||
match stack_size {
|
match stack_size {
|
||||||
0..TWO_MIB => Ok(true),
|
0..=TWO_MIB => Ok(true),
|
||||||
_ => Ok(false),
|
_ => Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user