openbsd-ports/devel/spidermonkey/patches/patch-jsnativestack_cpp
landry 191bc6db26 Import devel/spidermonkey 1.8.5
- built from the official upstream release
- needed for upcoming gnome/js update
- this is not an update to lang/spidermonkey, as that new version was
  built upon Ffx 4 js engine and probably only works on amd64/i386/ppc.
It builds on sparc64 but is broken at runtime. Not marking BROKEN-* to
allow depending ports to build. Other archs untested.
- special care was taken to ensure it doesnt conflict with
  lang/spidermonkey (install versionned binaries/headers..)
- ports wanting to use it should use devel/spidermonkey>=1.8,<1.9 to
  ensure the correct version is picked up

Tested in an amd64 bulk build.
ok/prodding ajacoutot@
2012-04-07 13:48:18 +00:00

44 lines
1.3 KiB
Plaintext

$OpenBSD: patch-jsnativestack_cpp,v 1.1.1.1 2012/04/07 13:48:18 landry Exp $
--- jsnativestack.cpp.orig Thu Mar 31 21:08:36 2011
+++ jsnativestack.cpp Sun Apr 3 12:38:25 2011
@@ -50,7 +50,7 @@
#elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX)
# include <pthread.h>
-# if defined(__FreeBSD__)
+# if defined(__FreeBSD__) || defined (__OpenBSD__)
# include <pthread_np.h>
# endif
@@ -198,24 +198,21 @@ GetNativeStackBaseImpl()
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);
# else
/*
* FIXME: this function is non-portable;
* other POSIX systems may have different np alternatives
*/
- pthread_getattr_np(thread, &sattr);
# endif
void *stackBase = 0;
size_t stackSize = 0;
-# ifdef DEBUG
- int rc =
-# endif
- pthread_attr_getstack(&sattr, &stackBase, &stackSize);
- JS_ASSERT(!rc);
- JS_ASSERT(stackBase);
- pthread_attr_destroy(&sattr);
+ 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;
# if JS_STACK_GROWTH_DIRECTION > 0
return stackBase;