File tree 1 file changed +5
-1
lines changed
library/std/src/sys/pal/unix
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -806,6 +806,8 @@ pub mod guard {
806
806
#[ cfg( target_os = "netbsd" ) ]
807
807
unsafe fn get_stack_start ( ) -> Option < * mut libc:: c_void > {
808
808
let mut ret = None ;
809
+ // We do not need pthread_attr_init/pthread_attr_destroy
810
+ // instead we use `pthread_getattr_np` to initialise the thread's attribute
809
811
let mut attr: libc:: pthread_attr_t = crate :: mem:: zeroed ( ) ;
810
812
let e = libc:: pthread_getattr_np ( libc:: pthread_self ( ) , & mut attr) ;
811
813
if e == 0 {
@@ -816,7 +818,9 @@ pub mod guard {
816
818
// on netbsd, we need to take in account the guard size to push up
817
819
// the stack's address from the bottom.
818
820
assert_eq ! ( libc:: pthread_attr_getguardsize( & attr, & mut guardsize) , 0 ) ;
819
- stackaddr = stackaddr. add ( guardsize) ;
821
+ // Only hppa arch seems to support stack growing up to higher address
822
+ // (__MACHINE_STACK_GROWS_UP)
823
+ stackaddr = stackaddr. sub ( guardsize) ;
820
824
ret = Some ( stackaddr) ;
821
825
}
822
826
ret
You can’t perform that action at this time.
0 commit comments