about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread/createthread.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-11 09:20:36 +0000
committerRoland McGrath <roland@gnu.org>2003-03-11 09:20:36 +0000
commit5d5d5969b17422e3b1af6f88436e91f32a36fd58 (patch)
treec21636b58c8ee0370e69bee0ee7e6562fea0cec3 /nptl/sysdeps/pthread/createthread.c
parentd0aacb47f9899e89b5b54139915c873934bf9c91 (diff)
downloadglibc-5d5d5969b17422e3b1af6f88436e91f32a36fd58.tar.gz
glibc-5d5d5969b17422e3b1af6f88436e91f32a36fd58.tar.xz
glibc-5d5d5969b17422e3b1af6f88436e91f32a36fd58.zip
2003-03-11 Jakub Jelinek <jakub@redhat.com>
	* sysdeps/pthread/createthread.c (ARCH_CLONE): Define if not defined.
	(create_thread): Only assert PD->tcb != NULL under [TLS_TCB_AT_TP].
	Use ARCH_CLONE.
	* allocatestack.c (ALLOCATE_STACK_PARMS): New macro.
	[NEED_SEPARATE_REGISTER_STACK] (STACK_VARIABLES,
	STACK_VARIABLES_ARGS, STACK_VARIABLES_PARMS, ALLOCATE_STACK_PARMS,
	ALLOCATE_STACK): New macros.
	(TLS_TPADJ): New macro.
	(get_cached_stack, queue_stack, __deallocate_stack): Use TLS_TPADJ.
	(allocate_stack): Handle TLS_DTV_AT_TP and
	NEED_SEPARATE_REGISTER_STACK.  Use TLS_TPADJ.
	* pthread_create.c (__pthread_create_2_1) [! TLS_TCB_AT_TP]:
	Don't set PD->self.
	* init.c [__ia64__] (__NR_set_tid_address): Define.
Diffstat (limited to 'nptl/sysdeps/pthread/createthread.c')
-rw-r--r--nptl/sysdeps/pthread/createthread.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index 2fac2d1a4e..0223fa868f 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -34,6 +34,10 @@
 # define TLS_VALUE pd
 #endif
 
+#ifndef ARCH_CLONE
+# define ARCH_CLONE __clone
+#endif
+
 
 static int
 create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
@@ -42,8 +46,9 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
   PREPARE_CREATE;
 #endif
 
+#ifdef TLS_TCB_AT_TP
   assert (pd->tcb != NULL);
-
+#endif
 
   if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
     {
@@ -62,11 +67,11 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 	  lll_lock (pd->lock);
 
 	  /* Create the thread.  */
-	  if (__clone (start_thread_debug, STACK_VARIABLES_ARGS,
-		       CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL |
-		       CLONE_SETTLS | CLONE_PARENT_SETTID |
-		       CLONE_CHILD_CLEARTID | CLONE_DETACHED | 0,
-		       pd, &pd->tid, TLS_VALUE, &pd->tid) == -1)
+	  if (ARCH_CLONE (start_thread_debug, STACK_VARIABLES_ARGS,
+			  CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL |
+			  CLONE_SETTLS | CLONE_PARENT_SETTID |
+			  CLONE_CHILD_CLEARTID | CLONE_DETACHED | 0,
+			  pd, &pd->tid, TLS_VALUE, &pd->tid) == -1)
 	    /* Failed.  */
 	    return errno;
 
@@ -135,10 +140,10 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
 
      The termination signal is chosen to be zero which means no signal
      is sent.  */
-  if (__clone (start_thread, STACK_VARIABLES_ARGS,
-	       CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL |
-	       CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
-	       CLONE_DETACHED | 0, pd, &pd->tid, TLS_VALUE, &pd->tid) == -1)
+  if (ARCH_CLONE (start_thread, STACK_VARIABLES_ARGS,
+		  CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL |
+		  CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
+		  CLONE_DETACHED | 0, pd, &pd->tid, TLS_VALUE, &pd->tid) == -1)
     /* Failed.  */
     return errno;