about summary refs log tree commit diff
path: root/linuxthreads/attr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-24 04:57:56 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-24 04:57:56 +0000
commitb6a0a99693379a0ceb9146bf3c38eb313b977e4c (patch)
tree7a96d234a537b8fc0e67a812191df5b06c9db7b9 /linuxthreads/attr.c
parent6370466d5af09a31feb376353bf0ac307774b1bf (diff)
downloadglibc-b6a0a99693379a0ceb9146bf3c38eb313b977e4c.tar.gz
glibc-b6a0a99693379a0ceb9146bf3c38eb313b977e4c.tar.xz
glibc-b6a0a99693379a0ceb9146bf3c38eb313b977e4c.zip
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 <pt-machine.h>.
Diffstat (limited to 'linuxthreads/attr.c')
-rw-r--r--linuxthreads/attr.c17
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;