$OpenBSD: patch-src_kjs_collector_cpp,v 1.4 2020/11/15 06:48:34 rsadowski Exp $
Allow to build & run on OpenBSD.
Index: src/kjs/collector.cpp
--- src/kjs/collector.cpp.orig
+++ src/kjs/collector.cpp
@@ -512,6 +512,11 @@ static inline void *currentThreadStackBase()
     static pthread_t stackThread;
     pthread_t thread = pthread_self();
     if (stackBase == nullptr || thread != stackThread) {
+#if defined(__OpenBSD__)
+        stack_t ss;
+        int rc = pthread_stackseg_np(thread, &ss);
+        stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size);
+#else
         pthread_attr_t sattr;
 #if HAVE_PTHREAD_NP_H || defined(__NetBSD__)
         // e.g. on FreeBSD 5.4, neundorf@kde.org
@@ -529,6 +534,7 @@ static inline void *currentThreadStackBase()
         pthread_attr_getstack(&sattr, &stackBase, &stackSize);
         stackBase = (char *)stackBase + stackSize;      // a matter of interpretation, apparently...
         pthread_attr_destroy(&sattr);
+#endif  // OpenBSD
         assert(stackBase);
         stackThread = thread;
     }
