]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
NPTL: Clean up THREAD_SYSINFO macros.
authorRoland McGrath <roland@hack.frob.com>
Fri, 17 Oct 2014 22:03:00 +0000 (15:03 -0700)
committerRoland McGrath <roland@hack.frob.com>
Fri, 17 Oct 2014 22:03:00 +0000 (15:03 -0700)
ChangeLog
nptl/allocatestack.c
nptl/createthread.c
nptl/nptl-init.c
sysdeps/i386/nptl/tls.h
sysdeps/ia64/nptl/tls.h

index 6a8bda433f9263b24adf3d09fb5b7d792be76237..78c2d9606f89aba06d3a97f9598a01a813c06fd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2014-10-17  Roland McGrath  <roland@hack.frob.com>
 
+       * sysdeps/i386/nptl/tls.h
+       (THREAD_SELF_SYSINFO, THREAD_SYSINFO): Macros removed.
+       [NEED_DL_SYSINFO] (SETUP_THREAD_SYSINFO, CHECK_THREAD_SYSINFO):
+       New macros.
+       * sysdeps/ia64/nptl/tls.h [NEED_DL_SYSINFO]
+       (SETUP_THREAD_SYSINFO, CHECK_THREAD_SYSINFO): New macros.
+       * nptl/allocatestack.c (allocate_stack) [NEED_DL_SYSINFO]:
+       Call SETUP_THREAD_SYSINFO instead of doing an assignment.
+       * nptl/createthread.c (create_thread) [NEED_DL_SYSINFO]:
+       Call CHECK_THREAD_SYSINFO instead of doing an assert.
+
        * nptl/nptl-init.c (__pthread_initialize_minimal_internal):
        Conditionalize FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME probes
        on [__NR_futex].
index b19d9b3e95ac15dca5b2f63187c66370c7cc9229..8cf0274ca181c5076ca2d69249ceb6cf1b35b18f 100644 (file)
@@ -430,8 +430,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 #endif
 
 #ifdef NEED_DL_SYSINFO
-      /* Copy the sysinfo value from the parent.  */
-      THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
+      SETUP_THREAD_SYSINFO (pd);
 #endif
 
       /* The process ID is also the same as that of the caller.  */
@@ -567,8 +566,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 #endif
 
 #ifdef NEED_DL_SYSINFO
-         /* Copy the sysinfo value from the parent.  */
-         THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
+         SETUP_THREAD_SYSINFO (pd);
 #endif
 
          /* Don't allow setxid until cloned.  */
index e718e35a11ca6d10cb05e0214c72425c4ccc5d49..9eaf2ce9c337877e36cc26d23950b19922674b05 100644 (file)
@@ -234,7 +234,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
     }
 
 #ifdef NEED_DL_SYSINFO
-  assert (THREAD_SELF_SYSINFO == THREAD_SYSINFO (pd));
+  CHECK_THREAD_SYSINFO (pd);
 #endif
 
   /* Determine whether the newly created threads has to be started
index a39ec9a23d995e87d4bbbc64933fcc5a984bdc43..b7d2197b3e86cf05e696b10e0ec64a90028386ed 100644 (file)
@@ -304,8 +304,10 @@ __pthread_initialize_minimal_internal (void)
 
   /* Minimal initialization of the thread descriptor.  */
   struct pthread *pd = THREAD_SELF;
+#ifdef __NR_set_tid_address
   INTERNAL_SYSCALL_DECL (err);
   pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
+#endif
   THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
   THREAD_SETMEM (pd, user_stack, true);
   if (LLL_LOCK_INITIALIZER != 0)
index d7302ba8aa59c2b5b1e9694138a3345109d35ab1..dd90978f691e1386da0b5522864015012e6095a8 100644 (file)
@@ -141,9 +141,6 @@ union user_desc_init
 # define GET_DTV(descr) \
   (((tcbhead_t *) (descr))->dtv)
 
-#define THREAD_SELF_SYSINFO    THREAD_GETMEM (THREAD_SELF, header.sysinfo)
-#define THREAD_SYSINFO(pd)     ((pd)->header.sysinfo)
-
 /* Macros to load from and store into segment registers.  */
 # ifndef TLS_GET_GS
 #  define TLS_GET_GS() \
@@ -154,9 +151,13 @@ union user_desc_init
   __asm ("movw %w0, %%gs" :: "q" (val))
 # endif
 
-#if defined NEED_DL_SYSINFO
+#ifdef NEED_DL_SYSINFO
 # define INIT_SYSINFO \
   _head->sysinfo = GLRO(dl_sysinfo)
+# define SETUP_THREAD_SYSINFO(pd) \
+  ((pd)->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo))
+# define CHECK_THREAD_SYSINFO(pd) \
+  assert ((pd)->header.sysinfo == THREAD_GETMEM (THREAD_SELF, header.sysinfo))
 #else
 # define INIT_SYSINFO
 #endif
index e38352a97376dda8340f2e91eeb004304cf283be..8805f851e6b352fc0515ffd0f18a54753aee5f2b 100644 (file)
@@ -109,8 +109,12 @@ register struct pthread *__thread_self __asm__("r13");
 #define THREAD_SYSINFO(pd) \
   (((tcbhead_t *) ((char *) (pd) + TLS_PRE_TCB_SIZE))->__private)
 
-#if defined NEED_DL_SYSINFO
+#ifdef NEED_DL_SYSINFO
 # define INIT_SYSINFO   THREAD_SELF_SYSINFO = (void *) GLRO(dl_sysinfo)
+# define SETUP_THREAD_SYSINFO(pd) \
+  (THREAD_SYSINFO (pd) = THREAD_SELF_SYSINFO)
+# define CHECK_THREAD_SYSINFO(pd) \
+  assert (THREAD_SYSINFO (pd) == THREAD_SELF_SYSINFO)
 #else
 # define INIT_SYSINFO   NULL
 #endif