From 90cf7b7f07727768dbdc96f78a91a27b6d3da47f Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 15 Oct 2012 20:13:28 +0000 Subject: [PATCH] Pull in pthread_stackseg_np() usage patch for OpenBSD from older www/mozilla-firefox port. --- 3rdp/build/js_src_jsnativestack_cpp.patch | 45 +++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/3rdp/build/js_src_jsnativestack_cpp.patch b/3rdp/build/js_src_jsnativestack_cpp.patch index 2b1e6309e0..97b10d4cef 100644 --- a/3rdp/build/js_src_jsnativestack_cpp.patch +++ b/3rdp/build/js_src_jsnativestack_cpp.patch @@ -1,7 +1,5 @@ -$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 -- GitLab