about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-10 08:50:36 +0000
committerRoland McGrath <roland@gnu.org>2003-03-10 08:50:36 +0000
commitd4f64e1ad7d7836fbd9b01f9c5d410db930c38ce (patch)
tree9b74633f12b5a6d7d4cd277aa0b68409cb928c18 /nptl/sysdeps
parentf9cd7dfd6b27129e677f6526b5f86fbb11030044 (diff)
downloadglibc-d4f64e1ad7d7836fbd9b01f9c5d410db930c38ce.tar.gz
glibc-d4f64e1ad7d7836fbd9b01f9c5d410db930c38ce.tar.xz
glibc-d4f64e1ad7d7836fbd9b01f9c5d410db930c38ce.zip
2003-03-10 Roland McGrath <roland@redhat.com>
	* allocatestack.c (allocate_stack) [!TLS_MULTIPLE_THREADS_IN_TCB]:
	Instead of setting PD->multiple_threads, set globals
	__pthread_multiple_threads and __libc_multiple_threads.
	* sysdeps/pthread/createthread.c (create_thread): Likewise.
	* sysdeps/i386/tls.h (TLS_MULTIPLE_THREADS_IN_TCB): Define it.
	* sysdeps/s390/tls.h (TLS_MULTIPLE_THREADS_IN_TCB): Likewise.
	* descr.h (struct pthread): Conditionalize first member on
	[!TLS_DTV_AT_TP].  Replace the `header' member with an anonymous union
	containing an anonymous tcbhead_t.  Move `list' member out.
	[TLS_MULTIPLE_THREADS_IN_TCB]: Define a `multiple_threads' member.
	* allocatestack.c: Remove use of `header.data.' prefix.
	* pthread_create.c: Likewise.
	* init.c (__pthread_initialize_minimal_internal): Likewise.
	* sysdeps/pthread/createthread.c (create_thread): Likewise.
	* sysdeps/i386/tls.h (INSTALL_DTV): Add parens.
	(THREAD_SELF, THREAD_DTV, INSTALL_NEW_DTV): No `header.data.' prefix.
	* sysdeps/x86_64/tls.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/i386/tls.h (tcbhead_t): Remove `list' member.
	* sysdeps/s390/tls.h (tcbhead_t): Likewise.
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/i386/tls.h13
-rw-r--r--nptl/sysdeps/pthread/createthread.c15
-rw-r--r--nptl/sysdeps/s390/tls.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h3
-rw-r--r--nptl/sysdeps/x86_64/tls.h10
6 files changed, 27 insertions, 22 deletions
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 9c4c481ccb..5b70586f27 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -44,9 +44,10 @@ typedef struct
   void *self;		/* Pointer to the thread descriptor.  */
   int multiple_threads;
   uintptr_t sysinfo;
-  list_t list;
 } tcbhead_t;
 
+# define TLS_MULTIPLE_THREADS_IN_TCB 1
+
 #else /* __ASSEMBLER__ */
 # include <tcb-offsets.h>
 #endif
@@ -116,12 +117,12 @@ union user_desc_init
 /* Install the dtv pointer.  The pointer passed is to the element with
    index -1 which contain the length.  */
 # define INSTALL_DTV(descr, dtvp) \
-  ((tcbhead_t *) (descr))->dtv = dtvp + 1
+  ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
 
 /* Install new dtv for current thread.  */
-# define INSTALL_NEW_DTV(dtv) \
+# define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;						      \
-     THREAD_SETMEM (__pd, header.data.dtvp, dtv); })
+     THREAD_SETMEM (__pd, dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -227,7 +228,7 @@ union user_desc_init
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
   ({ struct pthread *__pd;						      \
-     THREAD_GETMEM (__pd, header.data.dtvp); })
+     THREAD_GETMEM (__pd, dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -239,7 +240,7 @@ union user_desc_init
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
      asm ("movl %%gs:%c1,%0" : "=r" (__self)				      \
-	  : "i" (offsetof (struct pthread, header.data.self))); 	      \
+	  : "i" (offsetof (struct pthread, self))); 			      \
      __self;})
 
 
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index beee434c62..2fac2d1a4e 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -42,7 +42,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
   PREPARE_CREATE;
 #endif
 
-  assert (pd->header.data.tcb != NULL);
+  assert (pd->tcb != NULL);
 
 
   if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
@@ -70,8 +70,12 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 	    /* Failed.  */
 	    return errno;
 
+#ifdef TLS_MULTIPLE_THREADS_IN_TCB
 	  /* We now have for sure more than one thread.  */
-	  pd->header.data.multiple_threads = 1;
+	  pd->multiple_threads = 1;
+#else
+	  __pthread_multiple_threads = __libc_multiple_threads = 1;
+#endif
 
 	  /* Now fill in the information about the new thread in
 	     the newly created thread's data structure.  We cannot let
@@ -97,8 +101,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
     }
 
 #ifdef NEED_DL_SYSINFO
-  assert (THREAD_GETMEM (THREAD_SELF, header.data.sysinfo)
-	  == pd->header.data.sysinfo);
+  assert (THREAD_GETMEM (THREAD_SELF, sysinfo) == pd->sysinfo);
 #endif
 
   /* We rely heavily on various flags the CLONE function understands:
@@ -139,8 +142,10 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
     /* Failed.  */
     return errno;
 
+#ifdef TLS_MULTIPLE_THREADS_IN_TCB
   /* We now have for sure more than one thread.  */
-  THREAD_SETMEM (THREAD_SELF, header.data.multiple_threads, 1);
+  THREAD_SETMEM (THREAD_SELF, multiple_threads, 1);
+#endif
 
   return 0;
 }
diff --git a/nptl/sysdeps/s390/tls.h b/nptl/sysdeps/s390/tls.h
index 9b186f657f..4151f7fded 100644
--- a/nptl/sysdeps/s390/tls.h
+++ b/nptl/sysdeps/s390/tls.h
@@ -46,9 +46,10 @@ typedef struct
 #ifdef NEED_DL_SYSINFO
   uintptr_t sysinfo;
 #endif
-  list_t list;
 } tcbhead_t;
 
+# define TLS_MULTIPLE_THREADS_IN_TCB 1
+
 #else /* __ASSEMBLER__ */
 # include <tcb-offsets.h>
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index d9b51a4da5..6abb59a144 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -78,8 +78,7 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
-				   header.data.multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
 # endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 07bac6d35d..27147476e2 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -117,8 +117,7 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
-				   header.data.multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
 	stc gbr,r0; \
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 66e878ef0b..ae1c66e373 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -84,12 +84,12 @@ typedef struct
 /* Install the dtv pointer.  The pointer passed is to the element with
    index -1 which contain the length.  */
 # define INSTALL_DTV(descr, dtvp) \
-  ((tcbhead_t *) (descr))->dtv = dtvp + 1
+  ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
 
 /* Install new dtv for current thread.  */
-# define INSTALL_NEW_DTV(dtv) \
+# define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;						      \
-     THREAD_SETMEM (__pd, header.data.dtvp, dtv); })
+     THREAD_SETMEM (__pd, dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -133,7 +133,7 @@ typedef struct
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
   ({ struct pthread *__pd;						      \
-     THREAD_GETMEM (__pd, header.data.dtvp); })
+     THREAD_GETMEM (__pd, dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -145,7 +145,7 @@ typedef struct
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
      asm ("movq %%fs:%c1,%0" : "=r" (__self)				      \
-	  : "i" (offsetof (struct pthread, header.data.self))); 	      \
+	  : "i" (offsetof (struct pthread, self)));		 	      \
      __self;})