File tree 2 files changed +30
-2
lines changed
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ _LT_AC_TRY_DLOPEN_SELF([
146
146
] )
147
147
148
148
dnl Checks for library functions.
149
- AC_CHECK_FUNCS ( getpid kill sigsetjmp pthread_getattr_np pthread_attr_get_np pthread_get_stackaddr_np pthread_attr_getstack gettid )
149
+ AC_CHECK_FUNCS ( getpid kill sigsetjmp pthread_getattr_np pthread_attr_get_np pthread_get_stackaddr_np pthread_attr_getstack pthread_stackseg_np gettid )
150
150
151
151
dnl Test whether the stack grows downwards
152
152
dnl Assumes contiguous stack
Original file line number Diff line number Diff line change 35
35
# include <sys/types.h>
36
36
# endif
37
37
#endif /* ZEND_WIN32 */
38
- #if defined(__linux__ ) || defined(__FreeBSD__ ) || defined(__APPLE__ )
38
+ #if defined(__linux__ ) || defined(__FreeBSD__ ) || defined(__APPLE__ ) || defined( __OpenBSD__ )
39
39
# include <pthread.h>
40
40
#endif
41
41
#ifdef __FreeBSD__
44
44
# include <sys/sysctl.h>
45
45
# include <sys/user.h>
46
46
#endif
47
+ #ifdef __OpenBSD__
48
+ # include <pthread_np.h>
49
+ #endif
47
50
#ifdef __linux__
48
51
#include <sys/syscall.h>
49
52
#endif
@@ -432,6 +435,27 @@ static bool zend_call_stack_get_macos(zend_call_stack *stack)
432
435
}
433
436
#endif /* defined(__APPLE__) && defined(HAVE_PTHREAD_GET_STACKADDR_NP) */
434
437
438
+ #if defined(HAVE_PTHREAD_STACKSEG_NP )
439
+ static bool zend_call_stack_get_openbsd (zend_call_stack * stack )
440
+ {
441
+ stack_t ss ;
442
+
443
+ if (pthread_stackseg_np (pthread_self (), & ss ) != 0 ) {
444
+ return false;
445
+ }
446
+
447
+ stack -> base = (char * )ss .ss_sp - ss .ss_size ;
448
+ stack -> max_size = ss .ss_size - sysconf (_SC_PAGE_SIZE );
449
+
450
+ return true;
451
+ }
452
+ #else
453
+ static bool zend_call_stack_get_openbsd (zend_call_stack * stack )
454
+ {
455
+ return false;
456
+ }
457
+ #endif /* defined(HAVE_PTHREAD_STACKSEG_NP) */
458
+
435
459
/** Get the stack information for the calling thread */
436
460
ZEND_API bool zend_call_stack_get (zend_call_stack * stack )
437
461
{
@@ -451,6 +475,10 @@ ZEND_API bool zend_call_stack_get(zend_call_stack *stack)
451
475
return true;
452
476
}
453
477
478
+ if (zend_call_stack_get_openbsd (stack )) {
479
+ return true;
480
+ }
481
+
454
482
return false;
455
483
}
456
484
You can’t perform that action at this time.
0 commit comments