]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2003-03-14 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@gnu.org>
Fri, 14 Mar 2003 22:34:02 +0000 (22:34 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 14 Mar 2003 22:34:02 +0000 (22:34 +0000)
* descr.h (struct pthread): Move the union out of [!TLS_DTV_AT_TP], so
we always define the padding space.
[!TLS_DTV_AT_TP]: Give tcbhead_t field a name, `header', since GCC
stopped supporting its own extensions fully.
[TLS_MULTIPLE_THREADS_IN_TCB]: Put `multiple_threads' inside a wrapper
struct also called `header', so `header.multiple_threads' is the field
name to use on all machines.
* allocatestack.c (allocate_stack): Use `header.' prefix.
* sysdeps/pthread/createthread.c (create_thread): Likewise.
* pthread_create.c (__pthread_create_2_1): Likewise.
* sysdeps/i386/tls.h (INSTALL_NEW_DTV, THREAD_DTV): Likewise.
(THREAD_SELF): Likewise.
* 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/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.

nptl/allocatestack.c
nptl/descr.h
nptl/pthread_create.c
nptl/sysdeps/i386/tls.h
nptl/sysdeps/pthread/createthread.c
nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
nptl/sysdeps/x86_64/tls.h

index 14a2ab09df67f3f8f10fdc66571aeac4a235ccb9..8e77543927a338c4e87ab389fc2217ec8e0c85a4 100644 (file)
@@ -321,14 +321,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
       /* This is at least the second thread.  */
-      pd->multiple_threads = 1;
+      pd->header.multiple_threads = 1;
 #else
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
 #ifdef NEED_DL_SYSINFO
       /* Copy the sysinfo value from the parent.  */
-      pd->sysinfo = THREAD_GETMEM (THREAD_SELF, sysinfo);
+      pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
 #endif
 
       /* Allocate the DTV for this thread.  */
@@ -446,14 +446,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
          /* This is at least the second thread.  */
-         pd->multiple_threads = 1;
+         pd->header.multiple_threads = 1;
 #else
          __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
 #ifdef NEED_DL_SYSINFO
          /* Copy the sysinfo value from the parent.  */
-         pd->sysinfo = THREAD_GETMEM (THREAD_SELF, sysinfo);
+         pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
 #endif
 
          /* Allocate the DTV for this thread.  */
index cbaa38fc3cee3444c731a5b15ea6a72232d094a0..5a4c99c42f1a3e66fdd2d4049df0de2871f52409 100644 (file)
 /* Thread descriptor data structure.  */
 struct pthread
 {
-#if !TLS_DTV_AT_TP
-  /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads.  */
   union
   {
-    tcbhead_t;
-    void *__padding[16];
-  };
+#if !TLS_DTV_AT_TP
+    /* This overlaps the TCB as used for TLS without threads (see tls.h).  */
+    tcbhead_t header;
 #elif TLS_MULTIPLE_THREADS_IN_TCB
-  int multiple_threads;
+    struct
+    {
+      int multiple_threads;
+    } header;
 #endif
 
+    /* This extra padding has no special purpose, and this structure layout
+       is private and subject to change without affecting the official ABI.
+       We just have it here in case it might be convenient for some
+       implementation-specific instrumentation hack or suchlike.  */
+    void *__padding[16];
+  };
+
   /* This descriptor's link on the `stack_used' or `__stack_user' list.  */
   list_t list;
 
index 0eb7dc7c81f872d39223edf54035845b632b41d9..ec004194b2b8854fe36688b1c445c32ba2be057d 100644 (file)
@@ -347,10 +347,10 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
 
 #ifdef TLS_TCB_AT_TP
   /* Reference to the TCB itself.  */
-  pd->self = pd;
+  pd->header.self = pd;
 
   /* Self-reference for TLS.  */
-  pd->tcb = pd;
+  pd->header.tcb = pd;
 #endif
 
   /* Store the address of the start routine and the parameter.  Since
index 6fb6adca3088088f74004c387dbed01e810aee5e..eea5e3010d0969ed245a50b6510f3574c6eeb6b9 100644 (file)
@@ -122,7 +122,7 @@ union user_desc_init
 /* Install new dtv for current thread.  */
 # define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;                                                   \
-     THREAD_SETMEM (__pd, dtv, (dtvp)); })
+     THREAD_SETMEM (__pd, header.dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -228,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, dtv); })
+     THREAD_GETMEM (__pd, header.dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -240,7 +240,7 @@ union user_desc_init
 # define THREAD_SELF \
   ({ struct pthread *__self;                                                 \
      asm ("movl %%gs:%c1,%0" : "=r" (__self)                                 \
-         : "i" (offsetof (struct pthread, self)));                           \
+         : "i" (offsetof (struct pthread, header.self)));                            \
      __self;})
 
 
index 4ee92afec4532b927ec4eb105d627ee4ed5f8ebf..797176d0b6523a4daa5f914abc9b2fb42f7f7f42 100644 (file)
@@ -55,7 +55,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 #endif
 
 #ifdef TLS_TCB_AT_TP
-  assert (pd->tcb != NULL);
+  assert (pd->header.tcb != NULL);
 #endif
 
   if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
@@ -85,7 +85,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
          /* We now have for sure more than one thread.  */
-         pd->multiple_threads = 1;
+         pd->header.multiple_threads = 1;
 #else
          __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
@@ -114,7 +114,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
     }
 
 #ifdef NEED_DL_SYSINFO
-  assert (THREAD_GETMEM (THREAD_SELF, sysinfo) == pd->sysinfo);
+  assert (THREAD_GETMEM (THREAD_SELF, header.sysinfo) == pd->header.sysinfo);
 #endif
 
   /* We rely heavily on various flags the CLONE function understands:
@@ -157,7 +157,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
   /* We now have for sure more than one thread.  */
-  THREAD_SETMEM (THREAD_SELF, multiple_threads, 1);
+  THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
 #endif
 
   return 0;
index 6abb59a1445230ba21976877afab18b3e76af0bc..35f05e1cc25e99d78c4cc15671ca5f9cfa2685ef 100644 (file)
@@ -78,7 +78,8 @@
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+                                  header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
 # endif
index 5b999678fc2e9e1167d68388fac7551edcc466c7..5a3ae51c23509c6fc1aab5767de35957352f28db 100644 (file)
@@ -81,7 +81,7 @@ L(pseudo_end):
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
   __builtin_expect (THREAD_GETMEM (THREAD_SELF,                                      \
-                                  header.data.multiple_threads) == 0, 1)
+                                  header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
        ear     %r1,%a0;                                                      \
index 27147476e25fe28f6b7c9bb5528c3e2c70c7cd50..16f8ad5e0f437d3ce3aee9696117d244c839e94e 100644 (file)
 
 # ifndef __ASSEMBLER__
 #  define SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, multiple_threads) == 0, 1)
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+                                  header.multiple_threads) == 0, 1)
 # else
 #  define SINGLE_THREAD_P \
        stc gbr,r0; \
index fb35b7b40a2c5133799ab3b3cdd1cd5ab9196599..e7fab7a1b26c8f4f5fd6a74c97e1355c0a15ae38 100644 (file)
@@ -92,7 +92,7 @@ typedef struct
 /* Install new dtv for current thread.  */
 # define INSTALL_NEW_DTV(dtvp) \
   ({ struct pthread *__pd;                                                   \
-     THREAD_SETMEM (__pd, dtv, (dtvp)); })
+     THREAD_SETMEM (__pd, header.dtv, (dtvp)); })
 
 /* Return dtv of given thread descriptor.  */
 # define GET_DTV(descr) \
@@ -136,7 +136,7 @@ typedef struct
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
   ({ struct pthread *__pd;                                                   \
-     THREAD_GETMEM (__pd, dtv); })
+     THREAD_GETMEM (__pd, header.dtv); })
 
 
 /* Return the thread descriptor for the current thread.
@@ -148,7 +148,7 @@ typedef struct
 # define THREAD_SELF \
   ({ struct pthread *__self;                                                 \
      asm ("movq %%fs:%c1,%q0" : "=r" (__self)                                \
-         : "i" (offsetof (struct pthread, self)));                           \
+         : "i" (offsetof (struct pthread, header.self)));                    \
      __self;})