File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -806,6 +806,8 @@ pub mod guard {
806806 #[ cfg( target_os = "netbsd" ) ]
807807 unsafe fn get_stack_start ( ) -> Option < * mut libc:: c_void > {
808808 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
809811 let mut attr: libc:: pthread_attr_t = crate :: mem:: zeroed ( ) ;
810812 let e = libc:: pthread_getattr_np ( libc:: pthread_self ( ) , & mut attr) ;
811813 if e == 0 {
@@ -816,7 +818,9 @@ pub mod guard {
816818 // on netbsd, we need to take in account the guard size to push up
817819 // the stack's address from the bottom.
818820 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) ;
820824 ret = Some ( stackaddr) ;
821825 }
822826 ret
You can’t perform that action at this time.
0 commit comments