From 6461e57784358cf4fd261e5e61d064a315aae924 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 13 Mar 2003 21:51:07 +0000 Subject: [PATCH] * elf/Makefile ($(objpfx)librtld.mk): Tweak regexp so that one-line entries in the map file match too. --- ChangeLog | 5 ++ elf/Makefile | 3 +- nptl/ChangeLog | 23 ++++++++ nptl/allocatestack.c | 8 +-- nptl/pthreadP.h | 4 +- nptl/pthread_create.c | 7 +-- nptl/sysdeps/ia64/td_ta_map_lwp2thr.c | 2 +- nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h | 67 +++++++++--------------- 8 files changed, 66 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2477693..766e332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-03-13 Roland McGrath + + * elf/Makefile ($(objpfx)librtld.mk): Tweak regexp so that one-line + entries in the map file match too. + 2003-03-13 Guido Guenther * sysdeps/unix/sysv/linux/mips/clone.S: introduce and use local diff --git a/elf/Makefile b/elf/Makefile index 205957c..7c3f0f1 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -210,7 +210,8 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a mv -f $@T $@ $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile - sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\))$$@\1 \2@p' $< | \ + sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \ + $< | \ while read lib file; do \ case $$lib in \ libc_pic.a) \ diff --git a/nptl/ChangeLog b/nptl/ChangeLog index f3bc8e9..37464db 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,28 @@ +2003-03-13 Roland McGrath + + * pthread_create.c (start_thread): Set EXITING_BIT after the + event-reporting (and destructors), not before. + 2003-03-13 Jakub Jelinek + * 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 . + 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 ece9511..a43d94a 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 1ab1bad..bb2736e 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 58116f7..519d0c6 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 0931ce9..a823184 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 8fcc7f1..b64bf1c 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; \ }) -- 2.7.4