about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-13 21:51:07 +0000
committerRoland McGrath <roland@gnu.org>2003-03-13 21:51:07 +0000
commit6461e57784358cf4fd261e5e61d064a315aae924 (patch)
treec204eb7e9d3a13ead269e965d9856759c9bd946d /nptl
parent0579fabbe81afc3051b74c71907e8b5a76e2ab8a (diff)
downloadglibc-6461e57784358cf4fd261e5e61d064a315aae924.tar.gz
glibc-6461e57784358cf4fd261e5e61d064a315aae924.tar.xz
glibc-6461e57784358cf4fd261e5e61d064a315aae924.zip
* elf/Makefile ($(objpfx)librtld.mk): Tweak regexp so that one-line
	entries in the map file match too.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog23
-rw-r--r--nptl/allocatestack.c8
-rw-r--r--nptl/pthreadP.h4
-rw-r--r--nptl/pthread_create.c7
-rw-r--r--nptl/sysdeps/ia64/td_ta_map_lwp2thr.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h67
6 files changed, 59 insertions, 52 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f3bc8e914b..37464db175 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,28 @@
+2003-03-13  Roland McGrath  <roland@redhat.com>
+
+	* pthread_create.c (start_thread): Set EXITING_BIT after the
+	event-reporting (and destructors), not before.
+
 2003-03-13  Jakub Jelinek  <jakub@redhat.com>
 
+	* sysdeps/unix/sysv/linux/ia64/lowlevellock.h (lll_futex_timed_wait,
+	lll_futex_wake): Declare register variables as long int instead of
+	unsigned long int.  Patch by Ian Wienand <ianw@gelato.unsw.edu.au>.
+	Make syscall arguments clobbered by the syscall.
+	(lll_futex_wait): Define using lll_futex_timed_wait.
+
+	* sysdeps/ia64/td_ta_map_lwp2thr.c (td_ta_map_lwp2thr): Cast regs[13]
+	to void *.
+
+	* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Only declare and set
+	PPID if [! NDEBUG].
+
+	* allocatestack.c (nptl_ncreated): Only declare if
+	COLORING_INCREMENT != 0.
+
+	* pthreadP.h (__pthread_enable_asynccancel_2): New prototype.
+	(__libc_enable_asynccancel_2): Remove prototype.
+
 	* sysdeps/unix/sysv/linux/ia64/fork.c (ARCH_FORK): Swap ptid and
 	ctid to match kernel.
 
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index ece951109f..a43d94a0cd 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -104,8 +104,10 @@ static LIST_HEAD (stack_used);
 list_t __stack_user __attribute__ ((nocommon));
 hidden_def (__stack_user)
 
+#if COLORING_INCREMENT != 0
 /* Number of threads created.  */
 static unsigned int nptl_ncreated;
+#endif
 
 
 /* Check whether the stack is still used or not.  */
@@ -352,7 +354,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       void *mem;
 
 #if COLORING_INCREMENT != 0
-      /* Add one more page for stack coloring.  Don't to it for stacks
+      /* Add one more page for stack coloring.  Don't do it for stacks
 	 with 16 times pagesize or larger.  This might just cause
 	 unnecessary misalignment.  */
       if (size <= 16 * pagesize_m1)
@@ -383,8 +385,8 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	  if (__builtin_expect (mem == MAP_FAILED, 0))
 	    return errno;
 
-	  /* 'size' is guaranteed to be greater than zero.  So we can
-	     never get a NULL pointer back from MMAP.  */
+	  /* SIZE is guaranteed to be greater than zero.
+	     So we can never get a null pointer back from mmap.  */
 	  assert (mem != NULL);
 
 #if COLORING_INCREMENT != 0
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 1ab1badb0c..bb2736ef68 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -314,6 +314,8 @@ extern int __pthread_kill (pthread_t threadid, int signo);
 extern void __pthread_exit (void *value);
 extern int __pthread_setcanceltype (int type, int *oldtype);
 extern int __pthread_enable_asynccancel (void) attribute_hidden;
+extern void __pthread_enable_asynccancel_2 (int *oldvalp)
+     internal_function attribute_hidden;
 extern void __pthread_disable_asynccancel (int oldtype)
      internal_function attribute_hidden;
 
@@ -332,8 +334,6 @@ extern int __pthread_cond_wait_2_0 (pthread_cond_2_0_t *cond,
 
 /* The two functions are in libc.so and not exported.  */
 extern int __libc_enable_asynccancel (void) attribute_hidden;
-extern void __libc_enable_asynccancel_2 (int *oldvalp)
-     internal_function attribute_hidden;
 extern void __libc_disable_asynccancel (int oldtype)
      internal_function attribute_hidden;
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 58116f7925..519d0c6f60 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -227,9 +227,6 @@ start_thread (void *arg)
       THREAD_SETMEM (pd, result, pd->start_routine (pd->arg));
     }
 
-  /* The thread is exiting now.  */
-  atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
-
   /* Clean up any state libc stored in thread-local variables.  */
   __libc_thread_freeres ();
 
@@ -268,6 +265,10 @@ start_thread (void *arg)
 	}
     }
 
+  /* The thread is exiting now.  Don't set this bit until after we've hit
+     the event-reporting breakpoint, so that td_thr_get_info on us while at
+     the breakpoint reports TD_THR_RUN state rather than TD_THR_ZOMBIE.  */
+  atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
 
   /* If the thread is detached free the TCB.  */
   if (IS_DETACHED (pd))
diff --git a/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c b/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c
index 0931ce944d..a8231848ea 100644
--- a/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c
+++ b/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c
@@ -35,7 +35,7 @@ td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
     return TD_ERR;
 
   /* IA-64 thread register is r13.  */
-  th->th_unique = regs[13];
+  th->th_unique = (void *) regs[13];
 
   /* Found it.  Now complete the `td_thrhandle_t' object.  */
   th->th_ta_p = (td_thragent_t *) ta;
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
index 8fcc7f15ac..b64bf1ca15 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h
@@ -46,42 +46,23 @@
   "b6", "b7",								      \
   "memory"
 
-#define lll_futex_wait(futex, val) \
-  ({									      \
-     register unsigned long int __o0 asm ("out0")			      \
-       = (unsigned long int) (futex);					      \
-     register unsigned long int __o1 asm ("out1") = FUTEX_WAIT;		      \
-     register unsigned long int __o2 asm ("out2") = (unsigned long int) (val);\
-     register unsigned long int __o3 asm ("out3") = 0ul;		      \
-     register unsigned long int __r8 asm ("r8");			      \
-     register unsigned long int __r10 asm ("r10");			      \
-     register unsigned long int __r15 asm ("r15") = SYS_futex;		      \
-									      \
-     __asm __volatile ("break %3;;"					      \
-		       : "=r" (__r8), "=r" (__r10), "=r" (__r15)	      \
-		       : "i" (0x100000), "2" (__r15), "r" (__o0), "r" (__o1), \
-		 	"r" (__o2), "r" (__o3)				      \
-		       : lll_futex_clobbers);				      \
-     __r10 == -1 ? -__r8 : __r8;					      \
-  })
-
+#define lll_futex_wait(futex, val) lll_futex_timed_wait (futex, val, 0)
 
 #define lll_futex_timed_wait(futex, val, timespec) \
   ({									      \
-     register unsigned long int __o0 asm ("out0")			      \
-       = (unsigned long int) (futex);					      \
-     register unsigned long int __o1 asm ("out1") = FUTEX_WAIT;		      \
-     register unsigned long int __o2 asm ("out2") = (unsigned long int) (val);\
-     register unsigned long int __o3 asm ("out3")			      \
-       = (unsigned long int) (timespec);				      \
-     register unsigned long int __r8 asm ("r8");			      \
-     register unsigned long int __r10 asm ("r10");			      \
-     register unsigned long int __r15 asm ("r15") = SYS_futex;		      \
+     register long int __o0 asm ("out0") = (long int) (futex);		      \
+     register long int __o1 asm ("out1") = FUTEX_WAIT;			      \
+     register long int __o2 asm ("out2") = (long int) (val);		      \
+     register long int __o3 asm ("out3") = (long int) (timespec);	      \
+     register long int __r8 asm ("r8");					      \
+     register long int __r10 asm ("r10");				      \
+     register long int __r15 asm ("r15") = SYS_futex;			      \
 									      \
-     __asm __volatile ("break %3;;"					      \
-		       : "=r" (__r8), "=r" (__r10), "=r" (__r15)	      \
-		       : "i" (0x100000), "2" (__r15), "r" (__o0), "r" (__o1), \
-			 "r" (__o2), "r" (__o3)				      \
+     __asm __volatile ("break %7;;"					      \
+		       : "=r" (__r8), "=r" (__r10), "=r" (__r15),	      \
+			 "=r" (__o0), "=r" (__o1), "=r" (__o2), "=r" (__o3)   \
+		       : "i" (0x100000), "2" (__r15), "3" (__o0), "4" (__o1), \
+		 	 "5" (__o2), "6" (__o3)				      \
 		       : lll_futex_clobbers);				      \
      __r10 == -1 ? -__r8 : __r8;					      \
   })
@@ -89,18 +70,18 @@
 
 #define lll_futex_wake(futex, nr) \
   ({									      \
-     register unsigned long int __o0 asm ("out0")			      \
-       = (unsigned long int) (futex);					      \
-     register unsigned long int __o1 asm ("out1") = FUTEX_WAKE;		      \
-     register unsigned long int __o2 asm ("out2") = (unsigned long int) (nr); \
-     register unsigned long int __r8 asm ("r8");			      \
-     register unsigned long int __r10 asm ("r10");			      \
-     register unsigned long int __r15 asm ("r15") = SYS_futex;		      \
+     register long int __o0 asm ("out0") = (long int) (futex);		      \
+     register long int __o1 asm ("out1") = FUTEX_WAKE;			      \
+     register long int __o2 asm ("out2") = (long int) (nr);		      \
+     register long int __r8 asm ("r8");					      \
+     register long int __r10 asm ("r10");				      \
+     register long int __r15 asm ("r15") = SYS_futex;			      \
 									      \
-     __asm __volatile ("break %3;;"					      \
-		       : "=r" (__r8), "=r" (__r10), "=r" (__r15)	      \
-		       : "i" (0x100000), "2" (__r15), "r" (__o0), "r" (__o1), \
-			 "r" (__o2)					      \
+     __asm __volatile ("break %6;;"					      \
+		       : "=r" (__r8), "=r" (__r10), "=r" (__r15),	      \
+			 "=r" (__o0), "=r" (__o1), "=r" (__o2)		      \
+		       : "i" (0x100000), "2" (__r15), "3" (__o0), "4" (__o1), \
+		 	 "5" (__o2)					      \
 		       : "out3", lll_futex_clobbers);			      \
      __r10 == -1 ? -__r8 : __r8;					      \
   })