From a032a6587011cbdac8c2f7e11f15dc4e592bbb55 Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Tue, 16 Feb 2010 12:27:18 -0800 Subject: mass sync with glibc nptl Signed-off-by: Austin Foxley --- libpthread/nptl/sysdeps/arm/tls.h | 1 - libpthread/nptl/sysdeps/generic/lowlevellock.h | 21 +- libpthread/nptl/sysdeps/i386/pthread_spin_lock.c | 3 +- libpthread/nptl/sysdeps/i386/tcb-offsets.sym | 4 + libpthread/nptl/sysdeps/i386/tls.h | 77 +- libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym | 4 + libpthread/nptl/sysdeps/powerpc/tls.h | 42 +- libpthread/nptl/sysdeps/pthread/Makefile.in | 9 +- libpthread/nptl/sysdeps/pthread/allocalim.h | 5 +- libpthread/nptl/sysdeps/pthread/bits/libc-lock.h | 54 +- libpthread/nptl/sysdeps/pthread/bits/sigthread.h | 8 +- libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h | 14 +- libpthread/nptl/sysdeps/pthread/createthread.c | 18 +- .../nptl/sysdeps/pthread/librt-cancellation.c | 91 +-- libpthread/nptl/sysdeps/pthread/list.h | 15 +- libpthread/nptl/sysdeps/pthread/malloc-machine.h | 25 +- libpthread/nptl/sysdeps/pthread/pt-initfini.c | 4 +- libpthread/nptl/sysdeps/pthread/pt-longjmp.c | 2 - .../nptl/sysdeps/pthread/pthread-functions.h | 20 +- libpthread/nptl/sysdeps/pthread/pthread.h | 374 +++++++--- .../nptl/sysdeps/pthread/pthread_barrier_wait.c | 17 +- .../nptl/sysdeps/pthread/pthread_cond_broadcast.c | 28 +- .../nptl/sysdeps/pthread/pthread_cond_signal.c | 21 +- .../nptl/sysdeps/pthread/pthread_cond_timedwait.c | 29 +- .../nptl/sysdeps/pthread/pthread_cond_wait.c | 51 +- libpthread/nptl/sysdeps/pthread/pthread_once.c | 8 +- .../nptl/sysdeps/pthread/pthread_rwlock_rdlock.c | 18 +- .../sysdeps/pthread/pthread_rwlock_timedrdlock.c | 14 +- .../sysdeps/pthread/pthread_rwlock_timedwrlock.c | 12 +- .../nptl/sysdeps/pthread/pthread_rwlock_unlock.c | 16 +- .../nptl/sysdeps/pthread/pthread_rwlock_wrlock.c | 16 +- .../nptl/sysdeps/pthread/pthread_spin_destroy.c | 3 +- libpthread/nptl/sysdeps/pthread/setxid.h | 7 +- libpthread/nptl/sysdeps/pthread/sigaction.c | 13 +- libpthread/nptl/sysdeps/pthread/sigfillset.c | 2 +- libpthread/nptl/sysdeps/pthread/tpp.c | 172 +++++ .../nptl/sysdeps/pthread/unwind-forcedunwind.c | 80 +- libpthread/nptl/sysdeps/pthread/unwind-resume.c | 10 +- libpthread/nptl/sysdeps/sh/tcb-offsets.sym | 4 + libpthread/nptl/sysdeps/sh/tls.h | 54 +- libpthread/nptl/sysdeps/sparc/tcb-offsets.sym | 1 + libpthread/nptl/sysdeps/sparc/tls.h | 52 +- .../nptl/sysdeps/unix/sysv/linux/Makefile.in | 43 +- .../nptl/sysdeps/unix/sysv/linux/alpha/Versions | 13 - .../sysdeps/unix/sysv/linux/alpha/bits/local_lim.h | 13 +- .../unix/sysv/linux/alpha/bits/pthreadtypes.h | 8 +- .../sysdeps/unix/sysv/linux/alpha/bits/semaphore.h | 3 - .../sysdeps/unix/sysv/linux/alpha/lowlevellock.h | 255 ++++--- .../sysdeps/unix/sysv/linux/alpha/pthread_once.c | 8 +- .../sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h | 14 +- .../nptl/sysdeps/unix/sysv/linux/alpha/vfork.S | 2 +- .../nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h | 114 ++- .../unix/sysv/linux/arm/bits/pthreadtypes.h | 16 +- .../sysdeps/unix/sysv/linux/arm/bits/semaphore.h | 5 +- .../sysdeps/unix/sysv/linux/arm/lowlevellock.c | 55 +- .../sysdeps/unix/sysv/linux/arm/lowlevellock.h | 407 +++++----- .../sysdeps/unix/sysv/linux/arm/pthread_once.c | 6 +- .../sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | 60 +- .../unix/sysv/linux/arm/unwind-forcedunwind.c | 133 ++-- .../sysdeps/unix/sysv/linux/arm/unwind-resume.c | 92 ++- .../nptl/sysdeps/unix/sysv/linux/arm/unwind.h | 7 +- .../nptl/sysdeps/unix/sysv/linux/bits/local_lim.h | 13 +- .../nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h | 94 ++- libpthread/nptl/sysdeps/unix/sysv/linux/fork.c | 23 +- libpthread/nptl/sysdeps/unix/sysv/linux/fork.h | 10 +- libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c | 9 +- .../sysdeps/unix/sysv/linux/i386/Makefile.arch | 3 +- .../unix/sysv/linux/i386/bits/pthreadtypes.h | 9 +- .../sysdeps/unix/sysv/linux/i386/bits/semaphore.h | 3 - .../nptl/sysdeps/unix/sysv/linux/i386/fork.c | 2 +- .../unix/sysv/linux/i386/i486/libc-lowlevellock.S | 12 +- .../unix/sysv/linux/i386/i486/lowlevellock.S | 349 ++++++--- .../unix/sysv/linux/i386/i486/lowlevelrobustlock.S | 233 ++++++ .../sysv/linux/i386/i486/pthread_barrier_wait.S | 71 +- .../sysv/linux/i386/i486/pthread_cond_broadcast.S | 152 +++- .../sysv/linux/i386/i486/pthread_cond_signal.S | 155 +++- .../sysv/linux/i386/i486/pthread_cond_timedwait.S | 384 ++++++++-- .../unix/sysv/linux/i386/i486/pthread_cond_wait.S | 383 ++++++++-- .../sysv/linux/i386/i486/pthread_rwlock_rdlock.S | 74 +- .../linux/i386/i486/pthread_rwlock_timedrdlock.S | 96 ++- .../linux/i386/i486/pthread_rwlock_timedwrlock.S | 92 ++- .../sysv/linux/i386/i486/pthread_rwlock_unlock.S | 59 +- .../sysv/linux/i386/i486/pthread_rwlock_wrlock.S | 69 +- .../sysdeps/unix/sysv/linux/i386/i486/sem_post.S | 76 +- .../unix/sysv/linux/i386/i486/sem_timedwait.S | 266 +++++-- .../unix/sysv/linux/i386/i486/sem_trywait.S | 12 +- .../sysdeps/unix/sysv/linux/i386/i486/sem_wait.S | 243 ++++-- .../unix/sysv/linux/i386/i586/lowlevelrobustlock.S | 20 + .../unix/sysv/linux/i386/i686/lowlevelrobustlock.S | 20 + .../sysdeps/unix/sysv/linux/i386/lowlevellock.h | 703 ++++++++++++------ .../nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h | 51 +- .../nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S | 34 +- .../sysdeps/unix/sysv/linux/i386/pthread_once.S | 32 +- libpthread/nptl/sysdeps/unix/sysv/linux/i386/smp.h | 38 +- .../sysdeps/unix/sysv/linux/i386/sysdep-cancel.h | 18 +- .../nptl/sysdeps/unix/sysv/linux/i386/vfork.S | 2 +- .../nptl/sysdeps/unix/sysv/linux/internaltypes.h | 23 +- .../nptl/sysdeps/unix/sysv/linux/jmp-unwind.c | 12 +- .../sysdeps/unix/sysv/linux/libc_pthread_init.c | 44 +- .../sysdeps/unix/sysv/linux/lowlevelbarrier.sym | 1 + .../nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym | 2 +- .../nptl/sysdeps/unix/sysv/linux/lowlevellock.c | 64 +- .../sysdeps/unix/sysv/linux/lowlevelrobustlock.sym | 6 + .../sysdeps/unix/sysv/linux/lowlevelrwlock.sym | 2 + .../unix/sysv/linux/mips/bits/pthreadtypes.h | 26 +- .../sysdeps/unix/sysv/linux/mips/bits/semaphore.h | 5 +- .../sysdeps/unix/sysv/linux/mips/lowlevellock.h | 269 ++++--- .../sysdeps/unix/sysv/linux/mips/pthread_once.c | 6 +- .../sysdeps/unix/sysv/linux/mips/sysdep-cancel.h | 59 +- .../nptl/sysdeps/unix/sysv/linux/mq_notify.c | 5 +- .../nptl/sysdeps/unix/sysv/linux/powerpc/Versions | 5 - .../unix/sysv/linux/powerpc/bits/pthreadtypes.h | 15 +- .../unix/sysv/linux/powerpc/bits/semaphore.h | 3 - .../sysdeps/unix/sysv/linux/powerpc/lowlevellock.h | 251 ++++--- .../unix/sysv/linux/powerpc/powerpc32/clone.S | 12 +- .../sysv/linux/powerpc/powerpc32/sysdep-cancel.h | 37 +- .../unix/sysv/linux/powerpc/powerpc32/vfork.S | 2 +- .../unix/sysv/linux/powerpc/powerpc64/Versions | 7 - .../unix/sysv/linux/powerpc/powerpc64/clone.S | 12 +- .../sysv/linux/powerpc/powerpc64/sysdep-cancel.h | 16 +- .../unix/sysv/linux/powerpc/powerpc64/vfork.S | 2 +- .../sysdeps/unix/sysv/linux/powerpc/pthread_once.c | 8 +- .../unix/sysv/linux/powerpc/pthread_spin_unlock.c | 29 + .../sysdeps/unix/sysv/linux/powerpc/sem_post.c | 19 +- libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c | 9 +- .../sysdeps/unix/sysv/linux/pthread-pi-defines.sym | 8 + .../unix/sysv/linux/pthread_attr_getaffinity.c | 3 +- .../unix/sysv/linux/pthread_attr_setaffinity.c | 7 +- .../sysdeps/unix/sysv/linux/pthread_getaffinity.c | 1 + .../unix/sysv/linux/pthread_getcpuclockid.c | 56 +- .../nptl/sysdeps/unix/sysv/linux/pthread_kill.c | 18 +- .../unix/sysv/linux/pthread_mutex_cond_lock.c | 10 +- .../sysdeps/unix/sysv/linux/pthread_setaffinity.c | 13 +- .../sysdeps/unix/sysv/linux/pthread_sigqueue.c | 83 +++ libpthread/nptl/sysdeps/unix/sysv/linux/raise.c | 9 +- .../nptl/sysdeps/unix/sysv/linux/register-atfork.c | 52 +- libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c | 30 +- .../nptl/sysdeps/unix/sysv/linux/sem_timedwait.c | 62 +- libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c | 54 +- .../nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch | 5 +- .../sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h | 19 +- .../sysdeps/unix/sysv/linux/sh/bits/semaphore.h | 3 - libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c | 1 - .../sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S | 2 +- .../sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h | 12 +- .../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S | 421 ++++++++--- .../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 311 +++++--- .../unix/sysv/linux/sh/lowlevelrobustlock.S | 264 +++++++ .../nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h | 83 +-- .../nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c | 21 +- .../unix/sysv/linux/sh/pthread_barrier_wait.S | 49 +- .../unix/sysv/linux/sh/pthread_cond_broadcast.S | 99 ++- .../unix/sysv/linux/sh/pthread_cond_signal.S | 119 ++- .../unix/sysv/linux/sh/pthread_cond_timedwait.S | 184 +++-- .../sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S | 220 ++++-- .../nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S | 68 +- .../unix/sysv/linux/sh/pthread_rwlock_rdlock.S | 62 +- .../sysv/linux/sh/pthread_rwlock_timedrdlock.S | 70 +- .../sysv/linux/sh/pthread_rwlock_timedwrlock.S | 67 +- .../unix/sysv/linux/sh/pthread_rwlock_unlock.S | 48 +- .../unix/sysv/linux/sh/pthread_rwlock_wrlock.S | 58 +- .../nptl/sysdeps/unix/sysv/linux/sh/sem_post.S | 50 +- .../sysdeps/unix/sysv/linux/sh/sem_timedwait.S | 266 +++++-- .../nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S | 9 +- .../nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S | 265 +++++-- .../sysdeps/unix/sysv/linux/sh/sysdep-cancel.h | 128 +--- libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S | 2 +- libpthread/nptl/sysdeps/unix/sysv/linux/smp.h | 30 +- .../sysdeps/unix/sysv/linux/sparc/Makefile.arch | 3 +- .../nptl/sysdeps/unix/sysv/linux/sparc/Versions | 6 - .../sysdeps/unix/sysv/linux/sparc/bits/local_lim.h | 13 +- .../unix/sysv/linux/sparc/bits/pthreadtypes.h | 13 +- .../sysdeps/unix/sysv/linux/sparc/bits/semaphore.h | 3 - .../sysdeps/unix/sysv/linux/sparc/internaltypes.h | 34 + .../sysdeps/unix/sysv/linux/sparc/lowlevellock.c | 37 +- .../sysdeps/unix/sysv/linux/sparc/lowlevellock.h | 166 +++-- .../sysdeps/unix/sysv/linux/sparc/not-cancel.h | 1 + .../sysv/linux/sparc/pthread_barrier_destroy.c | 45 ++ .../unix/sysv/linux/sparc/pthread_barrier_init.c | 55 ++ .../sysdeps/unix/sysv/linux/sparc/pthread_once.c | 8 +- .../nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c | 57 ++ .../linux/sparc/sparc32/pthread_barrier_wait.c | 94 +++ .../unix/sysv/linux/sparc/sparc32/sem_post.c | 55 ++ .../unix/sysv/linux/sparc/sparc32/sem_timedwait.c | 148 ++++ .../unix/sysv/linux/sparc/sparc32/sem_trywait.c | 54 ++ .../unix/sysv/linux/sparc/sparc32/sem_wait.c | 127 ++++ .../unix/sysv/linux/sparc/sparc32/sysdep-cancel.h | 91 +-- .../sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S | 2 +- .../sysdeps/unix/sysv/linux/sparc/sparc64/Versions | 7 - .../nptl/sysdeps/unix/sysv/linux/structsem.sym | 12 + .../nptl/sysdeps/unix/sysv/linux/timer_create.c | 21 +- .../nptl/sysdeps/unix/sysv/linux/timer_delete.c | 26 +- .../nptl/sysdeps/unix/sysv/linux/timer_getoverr.c | 3 +- .../nptl/sysdeps/unix/sysv/linux/timer_routines.c | 59 +- .../sysdeps/unix/sysv/linux/unregister-atfork.c | 26 +- .../nptl/sysdeps/unix/sysv/linux/x86_64/Versions | 7 - .../unix/sysv/linux/x86_64/bits/semaphore.h | 3 - .../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 334 +++++++-- .../sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 718 ++++++++++++------ .../nptl/sysdeps/unix/sysv/linux/x86_64/pt-vfork.S | 2 + .../unix/sysv/linux/x86_64/pthread_barrier_wait.S | 40 +- .../sysv/linux/x86_64/pthread_cond_broadcast.S | 81 +- .../unix/sysv/linux/x86_64/pthread_cond_signal.S | 93 ++- .../sysv/linux/x86_64/pthread_cond_timedwait.S | 819 +++++++++++++++------ .../unix/sysv/linux/x86_64/pthread_cond_wait.S | 470 +++++++----- .../sysdeps/unix/sysv/linux/x86_64/pthread_once.S | 152 ++-- .../unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S | 47 +- .../sysv/linux/x86_64/pthread_rwlock_timedrdlock.S | 121 ++- .../sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | 120 ++- .../unix/sysv/linux/x86_64/pthread_rwlock_unlock.S | 43 +- .../unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S | 47 +- .../nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S | 57 +- .../sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S | 327 ++++++-- .../sysdeps/unix/sysv/linux/x86_64/sem_trywait.S | 11 +- .../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S | 187 +++-- libpthread/nptl/sysdeps/x86_64/Makefile | 27 - libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym | 16 + libpthread/nptl/sysdeps/x86_64/tls.h | 3 +- 219 files changed, 10971 insertions(+), 4697 deletions(-) create mode 100644 libpthread/nptl/sysdeps/pthread/tpp.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/alpha/Versions create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.sym delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Versions delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_spin_unlock.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Versions create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/internaltypes.h create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/not-cancel.h create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Versions create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/structsem.sym delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Versions delete mode 100644 libpthread/nptl/sysdeps/x86_64/Makefile (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/arm/tls.h b/libpthread/nptl/sysdeps/arm/tls.h index b8efd59b3..29200a1d2 100644 --- a/libpthread/nptl/sysdeps/arm/tls.h +++ b/libpthread/nptl/sysdeps/arm/tls.h @@ -21,7 +21,6 @@ #define _TLS_H 1 #ifndef __ASSEMBLER__ -#include # include # include diff --git a/libpthread/nptl/sysdeps/generic/lowlevellock.h b/libpthread/nptl/sysdeps/generic/lowlevellock.h index 7f95daada..0600e1794 100644 --- a/libpthread/nptl/sysdeps/generic/lowlevellock.h +++ b/libpthread/nptl/sysdeps/generic/lowlevellock.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Low level locking macros used in NPTL implementation. Stub version. + Copyright (C) 2002, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -20,16 +21,6 @@ #include -/* Implement generic mutex. Basic futex syscall support is required: - - lll_futex_wait(futex, value) - call sys_futex with FUTEX_WAIT - and third parameter VALUE - - lll_futex_wake(futex, value) - call sys_futex with FUTEX_WAKE - and third parameter VALUE -*/ - - /* Mutex lock counter: bit 31 clear means unlocked; bit 31 set means locked. @@ -65,7 +56,9 @@ __generic_mutex_lock (int *mutex) if (v >= 0) continue; - lll_futex_wait (mutex, v); + lll_futex_wait (mutex, v, + // XYZ check mutex flag + LLL_SHARED); } } @@ -81,7 +74,9 @@ __generic_mutex_unlock (int *mutex) /* There are other threads waiting for this mutex, wake one of them up. */ - lll_futex_wake (mutex, 1); + lll_futex_wake (mutex, 1, + // XYZ check mutex flag + LLL_SHARED); } diff --git a/libpthread/nptl/sysdeps/i386/pthread_spin_lock.c b/libpthread/nptl/sysdeps/i386/pthread_spin_lock.c index a6b1cf403..34cd525dc 100644 --- a/libpthread/nptl/sysdeps/i386/pthread_spin_lock.c +++ b/libpthread/nptl/sysdeps/i386/pthread_spin_lock.c @@ -29,7 +29,8 @@ int -pthread_spin_lock (pthread_spinlock_t *lock) +pthread_spin_lock ( + pthread_spinlock_t *lock) { __asm__ ("\n" "1:\t" LOCK_PREFIX "decl %0\n\t" diff --git a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym index 4e0444ba3..69f9deb36 100644 --- a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym +++ b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym @@ -11,3 +11,7 @@ SYSINFO_OFFSET offsetof (tcbhead_t, sysinfo) CLEANUP offsetof (struct pthread, cleanup) CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev) MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) +POINTER_GUARD offsetof (tcbhead_t, pointer_guard) +#ifndef __ASSUME_PRIVATE_FUTEX +PRIVATE_FUTEX offsetof (tcbhead_t, private_futex) +#endif diff --git a/libpthread/nptl/sysdeps/i386/tls.h b/libpthread/nptl/sysdeps/i386/tls.h index 52bde9eec..5f27d8fec 100644 --- a/libpthread/nptl/sysdeps/i386/tls.h +++ b/libpthread/nptl/sysdeps/i386/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. nptl/i386 version. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,6 +26,8 @@ # include # include # include +# include +# include /* Type for the dtv. */ @@ -49,6 +51,15 @@ typedef struct int multiple_threads; uintptr_t sysinfo; uintptr_t stack_guard; + uintptr_t pointer_guard; + int gscope_flag; +#ifndef __ASSUME_PRIVATE_FUTEX + int private_futex; +#else + int __unused1; +#endif + /* Reservation of some values for the TM ABI. */ + void *__private_tm[5]; } tcbhead_t; # define TLS_MULTIPLE_THREADS_IN_TCB 1 @@ -64,7 +75,8 @@ typedef struct #define HAVE_TLS_MODEL_ATTRIBUTE 1 /* Signal that TLS support is available. */ -#define USE_TLS 1 +#define USE_TLS 1 + /* Alignment requirement for the stack. For IA-32 this is governed by the SSE memory functions. */ @@ -99,6 +111,9 @@ union user_desc_init }; +/* Get the thread descriptor definition. */ +# include + /* This is the size of the initial TCB. Can't be just sizeof (tcbhead_t), because NPTL getpid, __libc_alloca_cutoff etc. need (almost) the whole struct pthread even when not linked with -lpthread. */ @@ -113,9 +128,6 @@ union user_desc_init /* Alignment requirements for the TCB. */ # define TLS_TCB_ALIGN __alignof__ (struct pthread) -/* Get the thread descriptor definition. */ -#include - /* The TCB can have any size and the memory following the address the thread pointer points to is unspecified. Allocate the TCB there. */ # define TLS_TCB_AT_TP 1 @@ -220,7 +232,7 @@ union user_desc_init _segdescr.vals[3] = 0x51; \ \ /* Install the TLS. */ \ - __asm__ volatile (TLS_LOAD_EBX \ + __asm__ volatile (TLS_LOAD_EBX \ "int $0x80\n\t" \ TLS_LOAD_EBX \ : "=a" (_result), "=m" (_segdescr.desc.entry_number) \ @@ -256,7 +268,7 @@ union user_desc_init do not get optimized away. */ # define THREAD_SELF \ ({ struct pthread *__self; \ - __asm__ ("movl %%gs:%c1,%0" : "=r" (__self) \ + __asm__ ("movl %%gs:%c1,%0" : "=r" (__self) \ : "i" (offsetof (struct pthread, header.self))); \ __self;}) @@ -270,11 +282,11 @@ union user_desc_init # define THREAD_GETMEM(descr, member) \ ({ __typeof (descr->member) __value; \ if (sizeof (__value) == 1) \ - __asm__ volatile ("movb %%gs:%P2,%b0" \ + __asm__ volatile ("movb %%gs:%P2,%b0" \ : "=q" (__value) \ : "0" (0), "i" (offsetof (struct pthread, member))); \ else if (sizeof (__value) == 4) \ - __asm__ volatile ("movl %%gs:%P1,%0" \ + __asm__ volatile ("movl %%gs:%P1,%0" \ : "=r" (__value) \ : "i" (offsetof (struct pthread, member))); \ else \ @@ -297,12 +309,12 @@ union user_desc_init # define THREAD_GETMEM_NC(descr, member, idx) \ ({ __typeof (descr->member[0]) __value; \ if (sizeof (__value) == 1) \ - __asm__ volatile ("movb %%gs:%P2(%3),%b0" \ + __asm__ volatile ("movb %%gs:%P2(%3),%b0" \ : "=q" (__value) \ : "0" (0), "i" (offsetof (struct pthread, member[0])), \ "r" (idx)); \ else if (sizeof (__value) == 4) \ - __asm__ volatile ("movl %%gs:%P1(,%2,4),%0" \ + __asm__ volatile ("movl %%gs:%P1(,%2,4),%0" \ : "=r" (__value) \ : "i" (offsetof (struct pthread, member[0])), \ "r" (idx)); \ @@ -350,7 +362,7 @@ union user_desc_init /* Set member of the thread descriptor directly. */ # define THREAD_SETMEM_NC(descr, member, idx, value) \ ({ if (sizeof (descr->member[0]) == 1) \ - __asm__ volatile ("movb %b0,%%gs:%P1(%2)" : \ + __asm__ volatile ("movb %b0,%%gs:%P1(%2)" : \ : "iq" (value), \ "i" (offsetof (struct pthread, member)), \ "r" (idx)); \ @@ -366,7 +378,7 @@ union user_desc_init 4 or 8. */ \ abort (); \ \ - __asm__ volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t" \ + __asm__ volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t" \ "movl %%edx,%%gs:4+%P1(,%2,8)" : \ : "A" (value), \ "i" (offsetof (struct pthread, member)), \ @@ -389,6 +401,17 @@ union user_desc_init __ret; }) +/* Atomic logical and. */ +#define THREAD_ATOMIC_AND(descr, member, val) \ + (void) ({ if (sizeof ((descr)->member) == 4) \ + __asm__ volatile (LOCK_PREFIX "andl %1, %%gs:%P0" \ + :: "i" (offsetof (struct pthread, member)), \ + "ir" (val)); \ + else \ + /* Not necessary for other sizes in the moment. */ \ + abort (); }) + + /* Atomic set bit. */ #define THREAD_ATOMIC_BIT_SET(descr, member, bit) \ (void) ({ if (sizeof ((descr)->member) == 4) \ @@ -424,6 +447,34 @@ union user_desc_init = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) +/* Set the pointer guard field in the TCB head. */ +#define THREAD_SET_POINTER_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value) +#define THREAD_COPY_POINTER_GUARD(descr) \ + ((descr)->header.pointer_guard \ + = THREAD_GETMEM (THREAD_SELF, header.pointer_guard)) + + +/* Get and set the global scope generation counter in the TCB head. */ +#define THREAD_GSCOPE_FLAG_UNUSED 0 +#define THREAD_GSCOPE_FLAG_USED 1 +#define THREAD_GSCOPE_FLAG_WAIT 2 +#define THREAD_GSCOPE_RESET_FLAG() \ + do \ + { int __res; \ + __asm__ volatile ("xchgl %0, %%gs:%P1" \ + : "=r" (__res) \ + : "i" (offsetof (struct pthread, header.gscope_flag)), \ + "0" (THREAD_GSCOPE_FLAG_UNUSED)); \ + if (__res == THREAD_GSCOPE_FLAG_WAIT) \ + lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \ + } \ + while (0) +#define THREAD_GSCOPE_SET_FLAG() \ + THREAD_SETMEM (THREAD_SELF, header.gscope_flag, THREAD_GSCOPE_FLAG_USED) +#define THREAD_GSCOPE_WAIT() \ + GL(dl_wait_lookup_done) () + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ diff --git a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym index 3962edbd5..8ac133dfd 100644 --- a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym +++ b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym @@ -14,3 +14,7 @@ MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) #endif PID thread_offsetof (pid) TID thread_offsetof (tid) +POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) +#ifndef __ASSUME_PRIVATE_FUTEX +PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex) +#endif diff --git a/libpthread/nptl/sysdeps/powerpc/tls.h b/libpthread/nptl/sysdeps/powerpc/tls.h index 1157116a3..ce5559eef 100644 --- a/libpthread/nptl/sysdeps/powerpc/tls.h +++ b/libpthread/nptl/sysdeps/powerpc/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. NPTL/PowerPC version. - Copyright (C) 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,7 +47,7 @@ typedef union dtv #endif /* Signal that TLS support is available. */ -# define USE_TLS 1 +# define USE_TLS 1 #ifndef __ASSEMBLER__ @@ -64,9 +64,11 @@ typedef union dtv # include /* The stack_guard is accessed directly by GCC -fstack-protector code, - so it is a part of public ABI. The dtv field is private. */ + so it is a part of public ABI. The dtv and pointer_guard fields + are private. */ typedef struct { + uintptr_t pointer_guard; uintptr_t stack_guard; dtv_t *dtv; } tcbhead_t; @@ -164,10 +166,44 @@ register void *__thread_register __asm__ ("r13"); = ((tcbhead_t *) ((char *) __thread_register \ - TLS_TCB_OFFSET))[-1].stack_guard) +/* Set the stack guard field in TCB head. */ +# define THREAD_GET_POINTER_GUARD() \ + (((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].pointer_guard) +# define THREAD_SET_POINTER_GUARD(value) \ + (THREAD_GET_POINTER_GUARD () = (value)) +# define THREAD_COPY_POINTER_GUARD(descr) \ + (((tcbhead_t *) ((char *) (descr) \ + + TLS_PRE_TCB_SIZE))[-1].pointer_guard \ + = THREAD_GET_POINTER_GUARD()) + /* l_tls_offset == 0 is perfectly valid on PPC, so we have to use some different value to mean unset l_tls_offset. */ # define NO_TLS_OFFSET -1 +/* Get and set the global scope generation counter in struct pthread. */ +#define THREAD_GSCOPE_FLAG_UNUSED 0 +#define THREAD_GSCOPE_FLAG_USED 1 +#define THREAD_GSCOPE_FLAG_WAIT 2 +#define THREAD_GSCOPE_RESET_FLAG() \ + do \ + { int __res \ + = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \ + THREAD_GSCOPE_FLAG_UNUSED); \ + if (__res == THREAD_GSCOPE_FLAG_WAIT) \ + lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \ + } \ + while (0) +#define THREAD_GSCOPE_SET_FLAG() \ + do \ + { \ + THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \ + atomic_write_barrier (); \ + } \ + while (0) +#define THREAD_GSCOPE_WAIT() \ + GL(dl_wait_lookup_done) () + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index 0d1097929..9497789ab 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -18,7 +18,7 @@ libpthread_CSRC = pthread_barrier_wait.c pthread_cond_broadcast.c \ pthread_rwlock_wrlock.c pthread_sigmask.c \ pthread_spin_destroy.c pthread_spin_init.c \ pthread_spin_unlock.c pt-sigfillset.c \ - pt-longjmp.c + pt-longjmp.c tpp.c ifeq ($(TARGET_ARCH),i386) @@ -43,6 +43,13 @@ SH_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \ libpthread_CSRC := $(filter-out $(SH_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) endif +ifeq ($(TARGET_ARCH),sparc) +SPARC_PTHREAD_EXCLUDE_LIST = pthread_barrier_init.c pthread_barrier_wait.c \ + pthread_barrier_destroy.c + +libpthread_CSRC := $(filter-out $(SPARC_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) +endif + ifeq ($(TARGET_ARCH),x86_64) X64_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \ pthread_barrier_wait.c pthread_cond_broadcast.c \ diff --git a/libpthread/nptl/sysdeps/pthread/allocalim.h b/libpthread/nptl/sysdeps/pthread/allocalim.h index 35224ec74..f13c3a330 100644 --- a/libpthread/nptl/sysdeps/pthread/allocalim.h +++ b/libpthread/nptl/sysdeps/pthread/allocalim.h @@ -1,5 +1,5 @@ /* Determine whether block of given size can be allocated on the stack or not. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,8 @@ #include -extern inline int +extern int +__always_inline __libc_use_alloca (size_t size) { return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1) diff --git a/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h b/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h index c59e3a0cc..70fe6762f 100644 --- a/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. NPTL version. - Copyright (C) 1996-2001, 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2003, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -150,13 +150,17 @@ typedef pthread_key_t __libc_key_t; /* Call thread functions through the function pointer table. */ #if defined SHARED && !defined NOT_IN_libc -# define PTF(NAME) __libc_pthread_functions.ptr_##NAME +# define PTFAVAIL(NAME) __libc_pthread_functions_init # define __libc_ptf_call(FUNC, ARGS, ELSE) \ - (PTF(FUNC) != NULL ? PTF(FUNC) ARGS : ELSE) + (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + PTHFCT_CALL (ptr_##FUNC, ARGS) #else -# define PTF(NAME) NAME +# define PTFAVAIL(NAME) (NAME != NULL) # define __libc_ptf_call(FUNC, ARGS, ELSE) \ __libc_maybe_call (FUNC, ARGS, ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + FUNC ARGS #endif @@ -168,8 +172,15 @@ typedef pthread_key_t __libc_key_t; # define __libc_lock_init(NAME) \ __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) #endif -#define __libc_rwlock_init(NAME) \ +#if defined SHARED && !defined NOT_IN_libc +/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER, 0) is + inefficient. */ +# define __libc_rwlock_init(NAME) \ + (__builtin_memset (&(NAME), '\0', sizeof (NAME)), 0) +#else +# define __libc_rwlock_init(NAME) \ __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) +#endif /* Same as last but this time we initialize a recursive mutex. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) @@ -210,8 +221,12 @@ typedef pthread_key_t __libc_key_t; # define __libc_lock_fini(NAME) \ __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) #endif -#define __libc_rwlock_fini(NAME) \ +#if defined SHARED && !defined NOT_IN_libc +# define __libc_rwlock_fini(NAME) ((void) 0) +#else +# define __libc_rwlock_fini(NAME) \ __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0) +#endif /* Finalize recursive named lock. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) @@ -224,7 +239,7 @@ typedef pthread_key_t __libc_key_t; /* Lock the named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # define __libc_lock_lock(NAME) \ - ({ lll_lock (NAME); 0; }) + ({ lll_lock (NAME, LLL_PRIVATE); 0; }) #else # define __libc_lock_lock(NAME) \ __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) @@ -241,7 +256,7 @@ typedef pthread_key_t __libc_key_t; void *self = THREAD_SELF; \ if ((NAME).owner != self) \ { \ - lll_lock ((NAME).lock); \ + lll_lock ((NAME).lock, LLL_PRIVATE); \ (NAME).owner = self; \ } \ ++(NAME).cnt; \ @@ -295,7 +310,7 @@ typedef pthread_key_t __libc_key_t; /* Unlock the named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) # define __libc_lock_unlock(NAME) \ - lll_unlock (NAME) + lll_unlock (NAME, LLL_PRIVATE) #else # define __libc_lock_unlock(NAME) \ __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) @@ -311,7 +326,7 @@ typedef pthread_key_t __libc_key_t; if (--(NAME).cnt == 0) \ { \ (NAME).owner = NULL; \ - lll_unlock ((NAME).lock); \ + lll_unlock ((NAME).lock, LLL_PRIVATE); \ } \ } while (0) #else @@ -353,8 +368,9 @@ typedef pthread_key_t __libc_key_t; /* Call handler iff the first call. */ #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ do { \ - if (PTF(__pthread_once) != NULL) \ - PTF(__pthread_once) (&(ONCE_CONTROL), INIT_FUNCTION); \ + if (PTFAVAIL (__pthread_once)) \ + __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ + INIT_FUNCTION)); \ else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ INIT_FUNCTION (); \ (ONCE_CONTROL) |= 2; \ @@ -380,9 +396,10 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer { struct _pthread_cleanup_buffer _buffer; \ int _avail; \ if (DOIT) { \ - _avail = PTF(_pthread_cleanup_push_defer) != NULL; \ + _avail = PTFAVAIL (_pthread_cleanup_push_defer); \ if (_avail) { \ - PTF(_pthread_cleanup_push_defer) (&_buffer, FCT, ARG); \ + __libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \ + ARG)); \ } else { \ _buffer.__routine = (FCT); \ _buffer.__arg = (ARG); \ @@ -394,7 +411,7 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) \ if (_avail) { \ - PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ + __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ } else if (DOIT) \ _buffer.__routine (_buffer.__arg); \ } @@ -402,15 +419,12 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer /* Sometimes we have to exit the block in the middle. */ #define __libc_cleanup_end(DOIT) \ if (_avail) { \ - PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ + __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ } else if (DOIT) \ _buffer.__routine (_buffer.__arg) /* Normal cleanup handling, based on C cleanup attribute. */ -__extern_inline void -__libc_cleanup_routine (struct __pthread_cleanup_frame *f); - __extern_inline void __libc_cleanup_routine (struct __pthread_cleanup_frame *f) { @@ -531,6 +545,7 @@ weak_extern (__pthread_key_create) weak_extern (__pthread_setspecific) weak_extern (__pthread_getspecific) weak_extern (__pthread_once) +weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) #ifdef SHARED weak_extern (_pthread_cleanup_push_defer) @@ -556,6 +571,7 @@ weak_extern (pthread_setcancelstate) # pragma weak __pthread_setspecific # pragma weak __pthread_getspecific # pragma weak __pthread_once +# pragma weak __pthread_initialize # pragma weak __pthread_atfork # pragma weak _pthread_cleanup_push_defer # pragma weak _pthread_cleanup_pop_restore diff --git a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h index 960bde18a..9a524e57d 100644 --- a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h +++ b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,4 +35,10 @@ extern int pthread_sigmask (int __how, /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; +#ifdef __USE_GNU +/* Queue signal and data to a thread. */ +extern int pthread_sigqueue (pthread_t __threadid, int __signo, + const union sigval __value) __THROW; +#endif + #endif /* bits/sigthread.h */ diff --git a/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h b/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h index cd64bc37e..b8efdd8d5 100644 --- a/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h +++ b/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h @@ -1,5 +1,5 @@ /* Thread package specific definitions of stream lock type. NPTL version. - Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; void *__self = THREAD_SELF; \ if ((_name).owner != __self) \ { \ - lll_lock ((_name).lock); \ + lll_lock ((_name).lock, LLL_PRIVATE); \ (_name).owner = __self; \ } \ ++(_name).cnt; \ @@ -72,7 +72,7 @@ typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; if (--(_name).cnt == 0) \ { \ (_name).owner = NULL; \ - lll_unlock ((_name).lock); \ + lll_unlock ((_name).lock, LLL_PRIVATE); \ } \ } while (0) @@ -94,9 +94,15 @@ typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; __attribute__((cleanup (_IO_acquire_lock_fct))) \ = (_fp); \ _IO_flockfile (_IO_acquire_lock_file); - +# define _IO_acquire_lock_clear_flags2(_fp) \ + do { \ + _IO_FILE *_IO_acquire_lock_file \ + __attribute__((cleanup (_IO_acquire_lock_clear_flags2_fct))) \ + = (_fp); \ + _IO_flockfile (_IO_acquire_lock_file); # else # define _IO_acquire_lock(_fp) _IO_acquire_lock_needs_exceptions_enabled +# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp) # endif # define _IO_release_lock(_fp) ; } while (0) diff --git a/libpthread/nptl/sysdeps/pthread/createthread.c b/libpthread/nptl/sysdeps/pthread/createthread.c index 88ffe09d3..a676e277f 100644 --- a/libpthread/nptl/sysdeps/pthread/createthread.c +++ b/libpthread/nptl/sysdeps/pthread/createthread.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -56,11 +56,11 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, PREPARE_CREATE; #endif - if (stopped) - /* We Make sure the thread does not run far by forcing it to get a + if (__builtin_expect (stopped != 0, 0)) + /* We make sure the thread does not run far by forcing it to get a lock. We lock it here too so that the new thread cannot continue until we tell it to. */ - lll_lock (pd->lock); + lll_lock (pd->lock, LLL_PRIVATE); /* One more thread. We cannot have the thread do this itself, since it might exist but not have been scheduled yet by the time we've returned @@ -84,7 +84,8 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, if (IS_DETACHED (pd)) __deallocate_stack (pd); - return errno; + /* We have to translate error codes. */ + return errno == ENOMEM ? EAGAIN : errno; } /* Now we have the possibility to set scheduling parameters etc. */ @@ -97,7 +98,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, if (attr->cpuset != NULL) { res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, - sizeof (cpu_set_t), attr->cpuset); + attr->cpusetsize, attr->cpuset); if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0)) { @@ -223,7 +224,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, __nptl_create_event (); /* And finally restart the new thread. */ - lll_unlock (pd->lock); + lll_unlock (pd->lock, LLL_PRIVATE); } return res; @@ -242,6 +243,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, || (attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)) stopped = true; pd->stopped_start = stopped; + pd->parent_cancelhandling = THREAD_GETMEM (THREAD_SELF, cancelhandling); /* Actually create the thread. */ int res = do_clone (pd, attr, clone_flags, start_thread, @@ -249,7 +251,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, if (res == 0 && stopped) /* And finally restart the new thread. */ - lll_unlock (pd->lock); + lll_unlock (pd->lock, LLL_PRIVATE); return res; } diff --git a/libpthread/nptl/sysdeps/pthread/librt-cancellation.c b/libpthread/nptl/sysdeps/pthread/librt-cancellation.c index 753a2d831..ad189e81a 100644 --- a/libpthread/nptl/sysdeps/pthread/librt-cancellation.c +++ b/libpthread/nptl/sysdeps/pthread/librt-cancellation.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -17,92 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include #include "pthreadP.h" -#include "atomic.h" -#ifdef IS_IN_librt -/* The next two functions are similar to pthread_setcanceltype() but - more specialized for the use in the cancelable functions like write(). - They do not need to check parameters etc. */ -int -attribute_hidden -__librt_enable_asynccancel (void) -{ - struct pthread *self = THREAD_SELF; - int oldval = THREAD_GETMEM (self, cancelhandling); - - while (1) - { - int newval = oldval | CANCELTYPE_BITMASK; - - if (__builtin_expect ((oldval & CANCELED_BITMASK) != 0, 0)) - { - /* If we are already exiting or if PTHREAD_CANCEL_DISABLED, - stop right here. */ - if ((oldval & (EXITING_BITMASK | CANCELSTATE_BITMASK)) != 0) - break; - - int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, - newval, oldval); - if (__builtin_expect (curval != oldval, 0)) - { - /* Somebody else modified the word, try again. */ - oldval = curval; - continue; - } - - THREAD_SETMEM (self, result, PTHREAD_CANCELED); - - __do_cancel (); - - /* NOTREACHED */ - } - - int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval, - oldval); - if (__builtin_expect (curval == oldval, 1)) - break; - - /* Prepare the next round. */ - oldval = curval; - } - - return oldval; -} - - -void -internal_function attribute_hidden -__librt_disable_asynccancel (int oldtype) -{ - /* If asynchronous cancellation was enabled before we do not have - anything to do. */ - if (oldtype & CANCELTYPE_BITMASK) - return; - - struct pthread *self = THREAD_SELF; - int oldval = THREAD_GETMEM (self, cancelhandling); - - while (1) - { - int newval = oldval & ~CANCELTYPE_BITMASK; - - if (newval == oldval) - break; - - int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval, - oldval); - if (__builtin_expect (curval == oldval, 1)) - break; - - /* Prepare the next round. */ - oldval = curval; - } -} - - -#endif +#define __pthread_enable_asynccancel __librt_enable_asynccancel +#define __pthread_disable_asynccancel __librt_disable_asynccancel +#include "cancellation.c" diff --git a/libpthread/nptl/sysdeps/pthread/list.h b/libpthread/nptl/sysdeps/pthread/list.h index 43186a2d5..6ddccb9fb 100644 --- a/libpthread/nptl/sysdeps/pthread/list.h +++ b/libpthread/nptl/sysdeps/pthread/list.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -46,24 +46,13 @@ typedef struct list_head static inline void list_add (list_t *newp, list_t *head) { - head->next->prev = newp; newp->next = head->next; newp->prev = head; + head->next->prev = newp; head->next = newp; } -/* Add new element at the tail of the list. */ -static inline void -list_add_tail (list_t *newp, list_t *head) -{ - head->prev->next = newp; - newp->next = head; - newp->prev = head->prev; - head->prev = newp; -} - - /* Remove element from list. */ static inline void list_del (list_t *elem) diff --git a/libpthread/nptl/sysdeps/pthread/malloc-machine.h b/libpthread/nptl/sysdeps/pthread/malloc-machine.h index efab230aa..e99aaa781 100644 --- a/libpthread/nptl/sysdeps/pthread/malloc-machine.h +++ b/libpthread/nptl/sysdeps/pthread/malloc-machine.h @@ -1,6 +1,6 @@ /* Basic platform-independent macro definitions for mutexes, thread-specific data and parameters for malloc. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -38,13 +38,24 @@ extern void *__dso_handle __attribute__ ((__weak__)); #include +#define ATFORK_MEM static struct fork_handler atfork_mem + #ifdef SHARED # define thread_atfork(prepare, parent, child) \ - __register_atfork (prepare, parent, child, __dso_handle) + atfork_mem.prepare_handler = prepare; \ + atfork_mem.parent_handler = parent; \ + atfork_mem.child_handler = child; \ + atfork_mem.dso_handle = __dso_handle; \ + atfork_mem.refcntr = 1; \ + __linkin_atfork (&atfork_mem) #else # define thread_atfork(prepare, parent, child) \ - __register_atfork (prepare, parent, child, \ - &__dso_handle == NULL ? NULL : __dso_handle) + atfork_mem.prepare_handler = prepare; \ + atfork_mem.parent_handler = parent; \ + atfork_mem.child_handler = child; \ + atfork_mem.dso_handle = &__dso_handle == NULL ? NULL : __dso_handle; \ + atfork_mem.refcntr = 1; \ + __linkin_atfork (&atfork_mem) #endif /* thread specific data for glibc */ @@ -52,10 +63,10 @@ extern void *__dso_handle __attribute__ ((__weak__)); #include typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */ -__libc_tsd_define (static, MALLOC) /* declaration/common definition */ +__libc_tsd_define (static, void *, MALLOC) /* declaration/common definition */ #define tsd_key_create(key, destr) ((void) (key)) -#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data)) -#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC)) +#define tsd_setspecific(key, data) __libc_tsd_set (void *, MALLOC, (data)) +#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (void *, MALLOC)) #include diff --git a/libpthread/nptl/sysdeps/pthread/pt-initfini.c b/libpthread/nptl/sysdeps/pthread/pt-initfini.c index 5955a7efc..b26a50456 100644 --- a/libpthread/nptl/sysdeps/pthread/pt-initfini.c +++ b/libpthread/nptl/sysdeps/pthread/pt-initfini.c @@ -72,7 +72,7 @@ call_initialize_minimal (void) } SECTION (".init"); -extern void _init (void); +extern void __attribute__ ((section (".init"))) _init (void); void _init (void) { @@ -93,7 +93,7 @@ asm ("\n/*@_init_EPILOG_ENDS*/"); asm ("\n/*@_fini_PROLOG_BEGINS*/"); SECTION (".fini"); -extern void _fini (void); +extern void __attribute__ ((section (".fini"))) _fini (void); void _fini (void) { diff --git a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c index b4106fdba..f161380ea 100644 --- a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c +++ b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c @@ -21,8 +21,6 @@ #include #include "pthreadP.h" -extern void __libc_longjmp (sigjmp_buf env, int val) - __attribute__ ((noreturn)); void longjmp (jmp_buf env, int val) { diff --git a/libpthread/nptl/sysdeps/pthread/pthread-functions.h b/libpthread/nptl/sysdeps/pthread/pthread-functions.h index 813d55621..0c404fcbb 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread-functions.h +++ b/libpthread/nptl/sysdeps/pthread/pthread-functions.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2003. @@ -23,6 +23,7 @@ #include #include #include +#include struct xid_command; @@ -72,12 +73,8 @@ struct pthread_functions int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); int (*ptr_pthread_mutex_init) (pthread_mutex_t *, const pthread_mutexattr_t *); - int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); - int (*ptr_pthread_mutexattr_init) (pthread_mutexattr_t *attr); - int (*ptr_pthread_mutexattr_destroy) (pthread_mutexattr_t *attr); - int (*ptr_pthread_mutexattr_settype) (pthread_mutexattr_t *attr, int kind); pthread_t (*ptr_pthread_self) (void); int (*ptr_pthread_setcancelstate) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *); @@ -99,9 +96,22 @@ struct pthread_functions __attribute ((noreturn)) __cleanup_fct_attribute; void (*ptr__nptl_deallocate_tsd) (void); int (*ptr__nptl_setxid) (struct xid_command *); + void (*ptr_freeres) (void); }; /* Variable in libc.so. */ extern struct pthread_functions __libc_pthread_functions attribute_hidden; +extern int __libc_pthread_functions_init attribute_hidden; + +#ifdef PTR_DEMANGLE +# define PTHFCT_CALL(fct, params) \ + ({ __typeof (__libc_pthread_functions.fct) __p; \ + __p = __libc_pthread_functions.fct; \ + PTR_DEMANGLE (__p); \ + __p params; }) +#else +# define PTHFCT_CALL(fct, params) \ + __libc_pthread_functions.fct params +#endif #endif /* pthread-functions.h */ diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h index c4bfc0e81..deb74309a 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread.h +++ b/libpthread/nptl/sysdeps/pthread/pthread.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,6 +21,7 @@ #define _PTHREAD_H 1 #include +#include #include #include @@ -50,7 +52,7 @@ enum PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_ADAPTIVE_NP -#ifdef __USE_UNIX98 +#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 , PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, @@ -63,6 +65,30 @@ enum #endif }; + +#ifdef __USE_XOPEN2K +/* Robust mutex or not flags. */ +enum +{ + PTHREAD_MUTEX_STALLED, + PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, + PTHREAD_MUTEX_ROBUST, + PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST +}; +#endif + + +#ifdef __USE_UNIX98 +/* Mutex protocols. */ +enum +{ + PTHREAD_PRIO_NONE, + PTHREAD_PRIO_INHERIT, + PTHREAD_PRIO_PROTECT +}; +#endif + + /* Mutex initializers. */ #if __WORDSIZE == 64 # define PTHREAD_MUTEX_INITIALIZER \ @@ -88,6 +114,7 @@ enum # endif #endif + /* Read-write lock types. */ #if defined __USE_UNIX98 || defined __USE_XOPEN2K enum @@ -99,21 +126,23 @@ enum }; /* Read-write lock initializers. */ -# if __WORDSIZE == 64 -# define PTHREAD_RWLOCK_INITIALIZER \ +# define PTHREAD_RWLOCK_INITIALIZER \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -# else -# define PTHREAD_RWLOCK_INITIALIZER \ - { { 0, 0, 0, 0, 0, 0, 0, 0 } } -# endif # ifdef __USE_GNU # if __WORDSIZE == 64 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } # else -# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ - { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0 } } +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ + { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, \ + 0, 0, 0, 0 } } +# else +# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ + { { 0, 0, 0, 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,\ + 0 } } +# endif # endif # endif #endif /* Unix98 or XOpen2K */ @@ -201,7 +230,7 @@ __BEGIN_DECLS extern int pthread_create (pthread_t *__restrict __newthread, __const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *), - void *__restrict __arg) __THROW; + void *__restrict __arg) __THROW __nonnull ((1, 3)); /* Terminate calling thread. @@ -251,71 +280,78 @@ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW; /* Initialize thread attribute *ATTR with default attributes (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, no user-provided stack). */ -extern int pthread_attr_init (pthread_attr_t *__attr) __THROW; +extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); /* Destroy thread attribute *ATTR. */ -extern int pthread_attr_destroy (pthread_attr_t *__attr) __THROW; +extern int pthread_attr_destroy (pthread_attr_t *__attr) + __THROW __nonnull ((1)); /* Get detach state attribute. */ extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr, - int *__detachstate) __THROW; + int *__detachstate) + __THROW __nonnull ((1, 2)); /* Set detach state attribute. */ extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, - int __detachstate) __THROW; + int __detachstate) + __THROW __nonnull ((1)); /* Get the size of the guard area created for stack overflow protection. */ extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr, - size_t *__guardsize) __THROW; + size_t *__guardsize) + __THROW __nonnull ((1, 2)); /* Set the size of the guard area created for stack overflow protection. */ extern int pthread_attr_setguardsize (pthread_attr_t *__attr, - size_t __guardsize) __THROW; + size_t __guardsize) + __THROW __nonnull ((1)); /* Return in *PARAM the scheduling parameters of *ATTR. */ extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict __attr, struct sched_param *__restrict __param) - __THROW; + __THROW __nonnull ((1, 2)); /* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, __const struct sched_param *__restrict - __param) __THROW; + __param) __THROW __nonnull ((1, 2)); /* Return in *POLICY the scheduling policy of *ATTR. */ extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict __attr, int *__restrict __policy) - __THROW; + __THROW __nonnull ((1, 2)); /* Set scheduling policy in *ATTR according to POLICY. */ extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) - __THROW; + __THROW __nonnull ((1)); /* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict __attr, int *__restrict __inherit) - __THROW; + __THROW __nonnull ((1, 2)); /* Set scheduling inheritance mode in *ATTR according to INHERIT. */ extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, - int __inherit) __THROW; + int __inherit) + __THROW __nonnull ((1)); /* Return in *SCOPE the scheduling contention scope of *ATTR. */ extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr, - int *__restrict __scope) __THROW; + int *__restrict __scope) + __THROW __nonnull ((1, 2)); /* Set scheduling contention scope in *ATTR according to SCOPE. */ extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) - __THROW; + __THROW __nonnull ((1)); /* Return the previously set address for the stack. */ extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) - __THROW __attribute_deprecated__; + __THROW __nonnull ((1, 2)) __attribute_deprecated__; /* Set the starting address of the stack of the thread to be created. Depending on whether the stack grows up or down the value must either @@ -323,30 +359,32 @@ extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict minimal size of the block must be PTHREAD_STACK_MIN. */ extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr) - __THROW __attribute_deprecated__; + __THROW __nonnull ((1)) __attribute_deprecated__; /* Return the currently used minimal stack size. */ extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) - __THROW; + __THROW __nonnull ((1, 2)); /* Add information about the minimum stack size needed for the thread to be started. This size must never be less than PTHREAD_STACK_MIN and must also not exceed the system limits. */ extern int pthread_attr_setstacksize (pthread_attr_t *__attr, - size_t __stacksize) __THROW; + size_t __stacksize) + __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Return the previously set address for the stack. */ extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr, - size_t *__restrict __stacksize) __THROW; + size_t *__restrict __stacksize) + __THROW __nonnull ((1, 2, 3)); /* The following two interfaces are intended to replace the last two. They require setting the address as well as the size since only setting the address will make the implementation on some architectures impossible. */ extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, - size_t __stacksize) __THROW; + size_t __stacksize) __THROW __nonnull ((1)); #endif #ifdef __USE_GNU @@ -354,19 +392,22 @@ extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, the processors represented in CPUSET. */ extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, size_t __cpusetsize, - __const cpu_set_t *__cpuset) __THROW; + __const cpu_set_t *__cpuset) + __THROW __nonnull ((1, 3)); /* Get bit set in CPUSET representing the processors threads created with ATTR can run on. */ extern int pthread_attr_getaffinity_np (__const pthread_attr_t *__attr, size_t __cpusetsize, - cpu_set_t *__cpuset) __THROW; + cpu_set_t *__cpuset) + __THROW __nonnull ((1, 3)); /* Initialize thread attribute *ATTR with attributes corresponding to the - already running thread TH. It shall be called on unitialized ATTR + already running thread TH. It shall be called on uninitialized ATTR and destroyed with pthread_attr_destroy when no longer needed. */ -extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW; +extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) + __THROW __nonnull ((2)); #endif @@ -376,13 +417,13 @@ extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW; and *PARAM. */ extern int pthread_setschedparam (pthread_t __target_thread, int __policy, __const struct sched_param *__param) - __THROW; + __THROW __nonnull ((3)); /* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ extern int pthread_getschedparam (pthread_t __target_thread, int *__restrict __policy, struct sched_param *__restrict __param) - __THROW; + __THROW __nonnull ((2, 3)); /* Set the scheduling priority for TARGET_THREAD. */ extern int pthread_setschedprio (pthread_t __target_thread, int __prio) @@ -408,11 +449,13 @@ extern int pthread_yield (void) __THROW; /* Limit specified thread TH to run only on the processors represented in CPUSET. */ extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, - __const cpu_set_t *__cpuset) __THROW; + __const cpu_set_t *__cpuset) + __THROW __nonnull ((3)); /* Get bit set in CPUSET representing the processors TH can run on. */ extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, - cpu_set_t *__cpuset) __THROW; + cpu_set_t *__cpuset) + __THROW __nonnull ((3)); #endif @@ -426,7 +469,7 @@ extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, The initialization functions might throw exception which is why this function is not marked with __THROW. */ extern int pthread_once (pthread_once_t *__once_control, - void (*__init_routine) (void)); + void (*__init_routine) (void)) __nonnull ((1, 2)); /* Functions for handling cancellation. @@ -538,9 +581,6 @@ class __pthread_cleanup_class function the compiler is free to decide inlining the change when needed or fall back on the copy which must exist somewhere else. */ -__extern_inline void -__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame); - __extern_inline v