diff --git a/src/tt_pthread.h b/src/tt_pthread.h index 6bb19eb23c767f0c08b93dd8c684fbb65766d1b1..70f6050912010bcaf0da5ce27a1ea6093dbc9762 100644 --- a/src/tt_pthread.h +++ b/src/tt_pthread.h @@ -37,9 +37,13 @@ #include <stdio.h> #include <errno.h> #include <pthread.h> -#if HAVE_PTHREAD_NP_H +#if HAVE_PTHREAD_NP_H || (__OpenBSD__) #include <pthread_np.h> #endif +#if (__OpenBSD__) +#include <signal.h> +#include <sys/signal.h> +#endif #include "say.h" /** @@ -358,6 +362,11 @@ tt_pthread_attr_getstack(pthread_t thread, void **stackaddr, size_t *stacksize) /* Old macOS */ *stacksize = pthread_get_stacksize_np(thread); *stackaddr = pthread_get_stackaddr_np(thread); +#elif (__OpenBSD__) + stack_t *sinfo = (stack_t*)malloc(sizeof(stack_t)); + pthread_stackseg_np(thread, sinfo); + *stacksize = sinfo->ss_size; + *stackaddr = sinfo->ss_sp; #else #error Unable to get thread stack #endif