[Tarantool-patches] [PATCH 04/11] Fix building of tt_pthread_attr_getstack() on OpenBSD
sergeyb at tarantool.org
sergeyb at tarantool.org
Tue May 12 15:32:20 MSK 2020
From: Sergey Bronnikov <sergeyb at tarantool.org>
Part of #4967
---
src/tt_pthread.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/tt_pthread.h b/src/tt_pthread.h
index 6bb19eb23..70f605091 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
--
2.23.0
More information about the Tarantool-patches
mailing list