Skip to content

Commit 772c9aa

Browse files
semarienagisa
authored andcommitted
few corrections for guess_os_stack_limit() on OpenBSD
- assert_eq!() syntax - `ss_sp` is pointer (not usize) - `ss_sp` is top (well, for all archs except hppa on OpenBSD, but hppa isn't supported by rust for now)
1 parent 88f67c4 commit 772c9aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ cfg_if! {
372372
} else if #[cfg(target_os = "openbsd")] {
373373
unsafe fn guess_os_stack_limit() -> Option<usize> {
374374
let mut stackinfo = std::mem::MaybeUninit::<libc::stack_t>::uninit();
375-
assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), stackinfo.as_mut_ptr()));
376-
Some(stackinfo.assume_init().ss_sp)
375+
assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), stackinfo.as_mut_ptr()), 0);
376+
Some(stackinfo.assume_init().ss_sp as usize - stackinfo.assume_init().ss_size)
377377
}
378378
} else if #[cfg(target_os = "macos")] {
379379
unsafe fn guess_os_stack_limit() -> Option<usize> {

0 commit comments

Comments
 (0)