openbsd-ports/x11/kde4/libs/patches/patch-kjs_collector_cpp
espie d32a2618f1 partial port of the kde4 beta.
this is totally experimental and not working yet !
it's in so that experimental people can look at it and play with it.
do not even think of building it if you don't know what you're doing.
2007-03-22 22:24:32 +00:00

34 lines
1.3 KiB
Plaintext

$OpenBSD: patch-kjs_collector_cpp,v 1.1.1.1 2007/03/22 22:24:33 espie Exp $
--- kjs/collector.cpp.orig Mon Feb 19 10:56:56 2007
+++ kjs/collector.cpp Fri Mar 2 23:42:36 2007
@@ -319,20 +319,25 @@ void Collector::markCurrentThreadConservatively()
static pthread_t stackThread;
pthread_t thread = pthread_self();
if (stackBase == 0 || thread != stackThread) {
- pthread_attr_t sattr;
-#if HAVE(PTHREAD_NP_H) || defined(__NetBSD__)
+#if defined(__OpenBSD__)
+ stack_t sinfo;
+ pthread_stackseg_np(thread, &sinfo);
+ stackBase = (char *)sinfo.ss_sp - sinfo.ss_size;
+#else
+# if HAVE(PTHREAD_NP_H) || defined(__NetBSD__)
// e.g. on FreeBSD 5.4, neundorf@kde.org
// also on NetBSD 3 and 4, raphael.langerhorst@kdemail.net
pthread_attr_get_np(thread, &sattr);
-#else
+# else
// FIXME: this function is non-portable; other POSIX systems may have different np alternatives
pthread_getattr_np(thread, &sattr);
-#endif
+# endif
// Should work but fails on Linux (?)
// pthread_attr_getstack(&sattr, &stackBase, &stackSize);
pthread_attr_getstackaddr(&sattr, &stackBase);
assert(stackBase);
stackThread = thread;
+#endif
}
#else
#error Need a way to get the stack base on this platform