From 280236537e06c7accaffabf8fb407f93dd1c834f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 12 Aug 2016 13:18:32 -0700 Subject: [PATCH] POSIX says should make all the pthread_* types available. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html Change-Id: I606194e15ceaa3129f266a9a460c358eaa8bf686 --- libc/include/bits/pthread_types.h | 56 +++++++++++++++++++++++++++++-- libc/include/pthread.h | 52 ---------------------------- libc/include/sys/types.h | 2 ++ 3 files changed, 56 insertions(+), 54 deletions(-) diff --git a/libc/include/bits/pthread_types.h b/libc/include/bits/pthread_types.h index 194a49b5c..7fc379b6a 100644 --- a/libc/include/bits/pthread_types.h +++ b/libc/include/bits/pthread_types.h @@ -32,8 +32,6 @@ #include #include -typedef long pthread_t; - typedef struct { uint32_t flags; void* stack_base; @@ -46,4 +44,58 @@ typedef struct { #endif } pthread_attr_t; +typedef struct { +#if defined(__LP64__) + int64_t __private[4]; +#else + int32_t __private[8]; +#endif +} pthread_barrier_t; + +typedef int pthread_barrierattr_t; + +typedef struct { +#if defined(__LP64__) + int32_t __private[12]; +#else + int32_t __private[1]; +#endif +} pthread_cond_t; + +typedef long pthread_condattr_t; + +typedef int pthread_key_t; + +typedef struct { +#if defined(__LP64__) + int32_t __private[10]; +#else + int32_t __private[1]; +#endif +} pthread_mutex_t; + +typedef long pthread_mutexattr_t; + +typedef int pthread_once_t; + +typedef struct { +#if defined(__LP64__) + int32_t __private[14]; +#else + int32_t __private[10]; +#endif +} pthread_rwlock_t; + +typedef long pthread_rwlockattr_t; + +typedef struct { +#if defined(__LP64__) + int64_t __private; +#else + int32_t __private[2]; +#endif +} pthread_spinlock_t; + +typedef long pthread_t; + #endif diff --git a/libc/include/pthread.h b/libc/include/pthread.h index 47dc15313..85b8cd9aa 100644 --- a/libc/include/pthread.h +++ b/libc/include/pthread.h @@ -43,16 +43,6 @@ __BEGIN_DECLS #pragma clang diagnostic ignored "-Wnullability-completeness" #endif -typedef struct { -#if defined(__LP64__) - int32_t __private[10]; -#else - int32_t __private[1]; -#endif -} pthread_mutex_t; - -typedef long pthread_mutexattr_t; - enum { PTHREAD_MUTEX_NORMAL = 0, PTHREAD_MUTEX_RECURSIVE = 1, @@ -68,28 +58,8 @@ enum { #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_RECURSIVE & 3) << 14) } } #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_ERRORCHECK & 3) << 14) } } -typedef struct { -#if defined(__LP64__) - int32_t __private[12]; -#else - int32_t __private[1]; -#endif -} pthread_cond_t; - -typedef long pthread_condattr_t; - #define PTHREAD_COND_INITIALIZER { { 0 } } -typedef struct { -#if defined(__LP64__) - int32_t __private[14]; -#else - int32_t __private[10]; -#endif -} pthread_rwlock_t; - -typedef long pthread_rwlockattr_t; - #define PTHREAD_RWLOCK_INITIALIZER { { 0 } } enum { @@ -97,32 +67,10 @@ enum { PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP = 1, }; -typedef int pthread_key_t; - -typedef int pthread_once_t; - #define PTHREAD_ONCE_INIT 0 -typedef struct { -#if defined(__LP64__) - int64_t __private[4]; -#else - int32_t __private[8]; -#endif -} pthread_barrier_t; - -typedef int pthread_barrierattr_t; - #define PTHREAD_BARRIER_SERIAL_THREAD -1 -typedef struct { -#if defined(__LP64__) - int64_t __private; -#else - int32_t __private[2]; -#endif -} pthread_spinlock_t; - #if defined(__LP64__) #define PTHREAD_STACK_MIN (4 * PAGE_SIZE) #else diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h index 28950576b..8188f898e 100644 --- a/libc/include/sys/types.h +++ b/libc/include/sys/types.h @@ -35,6 +35,8 @@ #include #include +#include + /* gids, uids, and pids are all 32-bit. */ typedef __kernel_gid32_t __gid_t; typedef __gid_t gid_t;