aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-05-17 10:53:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-05-17 10:53:13 +0200
commit76ccdd97c60561e5b3fb23f5d88049dc074d6559 (patch)
tree8b10fcf8d20e9643a650a1e68ce061e95788a491 /libbuild2
parent53234fea9cd628d5c69c3a4c8a7eba32a05c166c (diff)
Handle stack size querying on OpenBSD
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/scheduler.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/libbuild2/scheduler.cxx b/libbuild2/scheduler.cxx
index 469ded7..5027f90 100644
--- a/libbuild2/scheduler.cxx
+++ b/libbuild2/scheduler.cxx
@@ -5,8 +5,11 @@
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
# include <pthread.h>
-# ifdef __FreeBSD__
+# if defined(__FreeBSD__)
# include <pthread_np.h> // pthread_attr_get_np() (in <pthread.h> on NetBSD)
+# elif defined(__OpenBSD__)
+# include <sys/signal.h>
+# include <pthread_np.h> // pthread_stackseg_np()
# endif
#endif
@@ -850,6 +853,15 @@ namespace build2
if (r != 0)
throw_system_error (r);
+#elif defined(__OpenBSD__)
+ stack_t s;
+ int r (pthread_stackseg_np (pthread_self (), &s));
+
+ if (r != 0)
+ throw_system_error (r);
+
+ stack_size = s.ss_size;
+
#else // defined(__APPLE__)
stack_size = pthread_get_stacksize_np (pthread_self ());
#endif