From 78d48a330d481948f1d899d72ae5b122b7756533 Mon Sep 17 00:00:00 2001 From: kanemoto Date: Tue, 29 Jun 2010 17:29:27 +0000 Subject: * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX. * configure.in: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28485 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 c2a555aa6c..99edbc62e1 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -191,6 +191,8 @@ native_thread_destroy(rb_thread_t *th) #define STACKADDR_AVAILABLE 1 #elif defined HAVE_THR_STKSEGMENT || defined HAVE_PTHREAD_STACKSEG_NP #define STACKADDR_AVAILABLE 1 +#elif defined HAVE_PTHREAD_GETTHRDS_NP +#define STACKADDR_AVAILABLE 1 #endif #ifdef STACKADDR_AVAILABLE @@ -240,6 +242,16 @@ get_stack(void **addr, size_t *size) # endif *addr = stk.ss_sp; *size = stk.ss_size; +#elif defined HAVE_PTHREAD_GETTHRDS_NP + pthread_t th = pthread_self(); + struct __pthrdsinfo thinfo; + char reg[256]; + int regsiz=sizeof(reg); + CHECK_ERR(pthread_getthrds_np(&th, PTHRDSINFO_QUERY_ALL, + &thinfo, sizeof(thinfo), + ®, ®siz)); + *addr = thinfo.__pi_stackaddr; + *size = thinfo.__pi_stacksize; #endif return 0; #undef CHECK_ERR -- cgit v1.2.3