Skip to content
Snippets Groups Projects
Commit 90cf7b7f authored by deuce's avatar deuce
Browse files

Pull in pthread_stackseg_np() usage patch for OpenBSD from older

www/mozilla-firefox port.
parent 40b745e9
No related branches found
No related tags found
No related merge requests found
$OpenBSD: patch-js_src_jsnativestack_cpp,v 1.2 2011/06/28 05:43:57 landry Exp $
https://bugzilla.mozilla.org/show_bug.cgi?id=634609
--- js/src/jsnativestack.cpp.orig Fri May 27 18:12:08 2011
+++ js/src/jsnativestack.cpp Tue May 31 22:18:21 2011
--- js/src/jsnativestack.cpp.orig 2011-03-31 12:08:36.000000000 -0700
+++ js/src/jsnativestack.cpp 2012-10-15 13:03:20.000000000 -0700
@@ -50,7 +50,7 @@
#elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX)
# include <pthread.h>
......@@ -11,3 +9,42 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=634609
# include <pthread_np.h>
# endif
@@ -198,7 +198,9 @@
pthread_attr_init(&sattr);
# if defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD)
/* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */
- pthread_attr_get_np(thread, &sattr);
+# if (!defined(__OpenBSD__))
+ pthread_attr_get_np(thread, &sattr);
+# endif
# else
/*
* FIXME: this function is non-portable;
@@ -209,14 +211,24 @@
void *stackBase = 0;
size_t stackSize = 0;
-# ifdef DEBUG
- int rc =
-# endif
+# if defined(__OpenBSD__)
+ stack_t ss;
+ int rslt;
+
+ rslt = pthread_stackseg_np(pthread_self(), &ss);
+ stackBase = (void*)((size_t)ss.ss_sp - ss.ss_size);
+ stackSize = ss.ss_size;
+# else
+# ifdef DEBUG
+ int rc =
+# endif
pthread_attr_getstack(&sattr, &stackBase, &stackSize);
JS_ASSERT(!rc);
JS_ASSERT(stackBase);
pthread_attr_destroy(&sattr);
+# endif
+
# if JS_STACK_GROWTH_DIRECTION > 0
return stackBase;
# else
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment