From b6a0a99693379a0ceb9146bf3c38eb313b977e4c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 24 Feb 2002 04:57:56 +0000 Subject: Update. * attr.c (pthread_getattr_np): Don't take thread descriptor size into account if USE_TLS. * manager.c (pthread_handle_create): Free TLS data structures if call failed. Pass correct stack to clone if USE_TLS. * sysdeps/i386/pt-machine.h: Handle multiple inclusion. * sysdeps/i386/i686/pt-machine.h: Likewise. * sysdeps/i386/tls.h: Unconditionally include . --- linuxthreads/attr.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'linuxthreads/attr.c') 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; -- cgit v1.2.3