Move some pthread functions to signal.h.

POSIX specifies that pthread_kill(3) and pthread_sigmask(3) are
supposed to live in signal.h rather than pthread.h.

Since signal.h now needs pthread_t and pthread_attr_t, I've moved
those defintions into include/machine/pthread_types.h to keep the
namespace clean. I also sorted some includes. The combination of these
two things seems to have exploded into a cascade of missing includes,
so this patch also cleans up all those.

Change-Id: Icfa92a39432fe83f542a797e5a113289d7e4ad0c
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 86a1005..24dba1b 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -29,11 +29,12 @@
 #ifndef _PTHREAD_H_
 #define _PTHREAD_H_
 
-#include <time.h>
-#include <signal.h>
-#include <sched.h>
 #include <limits.h>
+#include <machine/pthread_types.h>
+#include <sched.h>
+#include <sys/cdefs.h>
 #include <sys/types.h>
+#include <time.h>
 
 #if defined(__LP64__)
   #define __RESERVED_INITIALIZER , {0}
@@ -76,18 +77,6 @@
 
 #define PTHREAD_COND_INITIALIZER  {0 __RESERVED_INITIALIZER}
 
-typedef struct {
-  uint32_t flags;
-  void* stack_base;
-  size_t stack_size;
-  size_t guard_size;
-  int32_t sched_policy;
-  int32_t sched_priority;
-#ifdef __LP64__
-  char __reserved[16];
-#endif
-} pthread_attr_t;
-
 typedef long pthread_mutexattr_t;
 typedef long pthread_condattr_t;
 
@@ -118,7 +107,6 @@
 #endif
 
 typedef int pthread_key_t;
-typedef long pthread_t;
 
 typedef volatile int pthread_once_t;
 
@@ -195,8 +183,6 @@
 int pthread_key_create(pthread_key_t*, void (*)(void*)) __nonnull((1));
 int pthread_key_delete(pthread_key_t);
 
-int pthread_kill(pthread_t, int);
-
 int pthread_mutexattr_destroy(pthread_mutexattr_t*) __nonnull((1));
 int pthread_mutexattr_getpshared(const pthread_mutexattr_t*, int*) __nonnull((1, 2));
 int pthread_mutexattr_gettype(const pthread_mutexattr_t*, int*) __nonnull((1, 2));
@@ -236,8 +222,6 @@
 
 int pthread_setspecific(pthread_key_t, const void*);
 
-int pthread_sigmask(int, const sigset_t*, sigset_t*);
-
 typedef void (*__pthread_cleanup_func_t)(void*);
 
 typedef struct __pthread_cleanup_t {