POSIX says <sys/types.h> should make all the pthread_* types available.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Change-Id: I606194e15ceaa3129f266a9a460c358eaa8bf686
diff --git a/libc/include/bits/pthread_types.h b/libc/include/bits/pthread_types.h
index 194a49b..7fc379b 100644
--- a/libc/include/bits/pthread_types.h
+++ b/libc/include/bits/pthread_types.h
@@ -32,8 +32,6 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-typedef long pthread_t;
-
 typedef struct {
   uint32_t flags;
   void* stack_base;
@@ -46,4 +44,58 @@
 #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 47dc153..85b8cd9 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -43,16 +43,6 @@
 #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 @@
 #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 @@
   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 2895057..8188f89 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -35,6 +35,8 @@
 #include <linux/types.h>
 #include <linux/posix_types.h>
 
+#include <bits/pthread_types.h>
+
 /* gids, uids, and pids are all 32-bit. */
 typedef __kernel_gid32_t __gid_t;
 typedef __gid_t gid_t;