diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-23 03:54:42 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-23 03:54:42 +0000 |
commit | e29c109d2afa62068528c0adaa3b42dee557cba9 (patch) | |
tree | f1f6ace8a3a8c74fc012cec15dca0071dc0a4059 /thread_pthread.c | |
parent | e3120abd58e7ee2f29a57c658526e5d84aa7b4fe (diff) | |
download | ruby-e29c109d2afa62068528c0adaa3b42dee557cba9.tar.gz |
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
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 12 |
1 files changed, 12 insertions, 0 deletions
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 <sys/time.h> #endif +#if defined(__HAIKU__) +#include <kernel/OS.h> +#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 <sys/dyntune.h> @@ -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 |