From e29c109d2afa62068528c0adaa3b42dee557cba9 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 23 Nov 2015 03:54:42 +0000 Subject: Haiku now best effort support * configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index b361e8bc0a..39271c86d6 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -33,6 +33,9 @@ #if defined(HAVE_SYS_TIME_H) #include #endif +#if defined(__HAIKU__) +#include +#endif static void native_mutex_lock(rb_nativethread_lock_t *lock); static void native_mutex_unlock(rb_nativethread_lock_t *lock); @@ -497,6 +500,8 @@ size_t pthread_get_stacksize_np(pthread_t); #define STACKADDR_AVAILABLE 1 #elif defined HAVE_PTHREAD_GETTHRDS_NP #define STACKADDR_AVAILABLE 1 +#elif defined __HAIKU__ +#define STACKADDR_AVAILABLE 1 #elif defined __ia64 && defined _HPUX_SOURCE #include @@ -615,6 +620,13 @@ get_stack(void **addr, size_t *size) *addr = thinfo.__pi_stackaddr; *size = thinfo.__pi_stacksize; STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size)); +#elif defined __HAIKU__ + thread_info info; + STACK_GROW_DIR_DETECTION; + CHECK_ERR(get_thread_info(find_thread(NULL), &info)); + *addr = info.stack_base; + *size = (uintptr_t)info.stack_end - (uintptr_t)info.stack_base; + STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size)); #else #error STACKADDR_AVAILABLE is defined but not implemented. #endif -- cgit v1.2.3