diff options
Diffstat (limited to 'linuxthreads/attr.c')
-rw-r--r-- | linuxthreads/attr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c index 4b3a8f4342..8b7e8ce81c 100644 --- a/linuxthreads/attr.c +++ b/linuxthreads/attr.c @@ -283,10 +283,19 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) attr->__inheritsched = descr->p_inheritsched; attr->__scope = PTHREAD_SCOPE_SYSTEM; #ifdef _STACK_GROWS_DOWN +# ifdef USE_TLS + attr->__stacksize = descr->p_stackaddr - (char *)descr->p_guardaddr + - descr->p_guardsize; +# else attr->__stacksize = (char *)(descr + 1) - (char *)descr->p_guardaddr - descr->p_guardsize; +# endif #else +# ifdef USE_TLS + attr->__stacksize = (char *)descr->p_guardaddr - descr->p_stackaddr; +# else attr->__stacksize = (char *)descr->p_guardaddr - (char *)descr; +# endif #endif attr->__guardsize = descr->p_guardsize; attr->__stackaddr_set = descr->p_userstack; @@ -298,10 +307,14 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) otherwise the range of the stack area cannot be computed. */ attr->__stacksize += attr->__guardsize; #endif -#ifndef _STACK_GROWS_UP - attr->__stackaddr = (char *)(descr + 1); +#ifdef USE_TLS + attr->__stackaddr = descr->p_stackaddr; #else +# ifndef _STACK_GROWS_UP + attr->__stackaddr = (char *)(descr + 1); +# else attr->__stackaddr = (char *)descr; +# endif #endif return 0; |