platform_bionic/libc/private
Elliott Hughes b30aff405a Revert "Revert "Lose the hand-written futex assembler.""
The problem with the original patch was that using syscall(3) means that
errno can be set, but pthread_create(3) was abusing the TLS errno slot as
a pthread_mutex_t for the thread startup handshake.

There was also a mistake in the check for syscall failures --- it should
have checked against -1 instead of 0 (not just because that's the default
idiom, but also here because futex(2) can legitimately return values > 0).

This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to
pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) >
sizeof(uintptr_t), so we could potentially clobber other TLS slots too.)

I've also rewritten the LP32 compatibility stubs to directly reuse the
code from the .h file.

This reverts commit 75c55ff84e.

Bug: 15195455
Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
2014-05-28 18:31:15 -07:00
..
__get_tls.h AArch64: Add initial support for AArch64 2013-12-16 17:00:22 -08:00
bionic_asm.h Unify our assembler macros. 2014-02-20 13:51:26 -08:00
bionic_atomic_arm.h ARM: Change dmb domain for bionic_atomic_barrier() 2013-12-19 11:39:01 -08:00
bionic_atomic_arm64.h bionic: rename aarch64 target to arm64 2014-01-23 18:35:39 -08:00
bionic_atomic_gcc_builtin.h ARM: Change dmb domain for bionic_atomic_barrier() 2013-12-19 11:39:01 -08:00
bionic_atomic_inline.h bionic: rename aarch64 target to arm64 2014-01-23 18:35:39 -08:00
bionic_atomic_mips.h Clean up the pthread-only atomic stuff a little. 2013-12-16 10:18:11 -08:00
bionic_atomic_x86.h Clean up the pthread-only atomic stuff a little. 2013-12-16 10:18:11 -08:00
bionic_auxv.h Switch <elf.h> over to linux uapi under the covers. 2014-02-10 18:22:24 -08:00
bionic_futex.h Revert "Revert "Lose the hand-written futex assembler."" 2014-05-28 18:31:15 -07:00
bionic_macros.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
bionic_name_mem.h Clean up various warnings in bionic. 2014-02-18 12:04:54 -08:00
bionic_pthread.h <pthread.h> fixes and pthread cleanup. 2013-10-31 12:31:16 -07:00
bionic_ssp.h Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces. 2013-02-14 14:37:34 -08:00
bionic_time.h Ensure header files using __BEGIN_DECLS include sys/cdefs.h. 2013-06-05 17:58:08 -07:00
bionic_time_conversions.h Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls. 2013-10-24 15:48:32 -07:00
bionic_tls.h Revert "Revert "Lose the hand-written futex assembler."" 2014-05-28 18:31:15 -07:00
ErrnoRestorer.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
kernel_sigset_t.h Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls. 2013-10-24 15:48:32 -07:00
KernelArgumentBlock.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
libc_events.h Add stpcpy/stpncpy. 2014-04-07 16:41:53 -07:00
libc_logging.h Fix LOG_ID_CRASH build failure. 2014-05-07 17:12:40 -07:00
NetdClientDispatch.h Mark sockets on creation (socket()) and accept4(). 2014-05-19 15:19:16 -07:00
ScopedPthreadMutexLocker.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
ScopedReaddir.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
thread_private.h Clean up <stdio.h> macros. 2014-03-13 14:54:53 -07:00
ThreadLocalBuffer.h Revert "Revert "More pthreads cleanup."" 2013-02-12 15:27:18 -08:00