[libc] undef _POSIX_THREAD_PRIORITY_SCHEDULING

Posix allows for an implement to choose not to support thread scheduling
by ensuring that _POSIX_THREAD_PRIORITY_SCHEDULING is either not
defined, or defined to be -1.

 * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
 * https://linux.die.net/man/7/posixoptions

Undefine _POSIX_THREAD_PRIORITY_SCHEDULING and remove function
prototypes associated with those functions. These functions are not used
by any fuchsia based caller.

Change-Id: I865743b37f69d2ef5e76e041e9ef41b662286930
diff --git a/third_party/ulib/musl/include/pthread.h b/third_party/ulib/musl/include/pthread.h
index dee7d35..07576e5 100644
--- a/third_party/ulib/musl/include/pthread.h
+++ b/third_party/ulib/musl/include/pthread.h
@@ -90,10 +90,6 @@
 void pthread_testcancel(void);
 int pthread_cancel(pthread_t);
 
-int pthread_getschedparam(pthread_t, int* __restrict, struct sched_param* __restrict);
-int pthread_setschedparam(pthread_t, int, const struct sched_param*);
-int pthread_setschedprio(pthread_t, int);
-
 int pthread_once(pthread_once_t*, void (*)(void));
 
 int pthread_mutex_init(pthread_mutex_t* __restrict, const pthread_mutexattr_t* __restrict);
@@ -153,14 +149,8 @@
 int pthread_attr_getstack(const pthread_attr_t* __restrict, void** __restrict, size_t* __restrict);
 int pthread_attr_setstack(pthread_attr_t*, void*, size_t)
     __attribute__((__deprecated__("pthread_attr_setstack is not available in Fuchsia; perhaps pthread_attr_setstacksize and/or pthread_attr_setguardsize is sufficient for your needs?")));
-int pthread_attr_getscope(const pthread_attr_t* __restrict, int* __restrict);
-int pthread_attr_setscope(pthread_attr_t*, int);
-int pthread_attr_getschedpolicy(const pthread_attr_t* __restrict, int* __restrict);
-int pthread_attr_setschedpolicy(pthread_attr_t*, int);
 int pthread_attr_getschedparam(const pthread_attr_t* __restrict, struct sched_param* __restrict);
 int pthread_attr_setschedparam(pthread_attr_t* __restrict, const struct sched_param* __restrict);
-int pthread_attr_getinheritsched(const pthread_attr_t* __restrict, int* __restrict);
-int pthread_attr_setinheritsched(pthread_attr_t*, int);
 
 int pthread_mutexattr_destroy(pthread_mutexattr_t*);
 int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t* __restrict, int* __restrict);
diff --git a/third_party/ulib/musl/include/unistd.h b/third_party/ulib/musl/include/unistd.h
index 6d69bda..6f9094a0 100644
--- a/third_party/ulib/musl/include/unistd.h
+++ b/third_party/ulib/musl/include/unistd.h
@@ -208,7 +208,7 @@
 #define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
 #define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
 #define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
-#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
+/* #define _POSIX_THREAD_PRIORITY_SCHEDULING -1 */
 #define _POSIX_THREAD_CPUTIME _POSIX_VERSION
 #define _POSIX_TIMERS _POSIX_VERSION
 #define _POSIX_TIMEOUTS _POSIX_VERSION
diff --git a/third_party/ulib/musl/musl-rules.mk b/third_party/ulib/musl/musl-rules.mk
index b0f1ce1..8ef9920 100644
--- a/third_party/ulib/musl/musl-rules.mk
+++ b/third_party/ulib/musl/musl-rules.mk
@@ -55,10 +55,7 @@
     $(LOCAL_DIR)/pthread/pthread_attr_init.c \
     $(LOCAL_DIR)/pthread/pthread_attr_setdetachstate.c \
     $(LOCAL_DIR)/pthread/pthread_attr_setguardsize.c \
-    $(LOCAL_DIR)/pthread/pthread_attr_setinheritsched.c \
     $(LOCAL_DIR)/pthread/pthread_attr_setschedparam.c \
-    $(LOCAL_DIR)/pthread/pthread_attr_setschedpolicy.c \
-    $(LOCAL_DIR)/pthread/pthread_attr_setscope.c \
     $(LOCAL_DIR)/pthread/pthread_attr_setstacksize.c \
     $(LOCAL_DIR)/pthread/pthread_barrier_destroy.c \
     $(LOCAL_DIR)/pthread/pthread_barrier_init.c \
@@ -81,7 +78,6 @@
     $(LOCAL_DIR)/pthread/pthread_getattr_np.c \
     $(LOCAL_DIR)/pthread/pthread_getconcurrency.c \
     $(LOCAL_DIR)/pthread/pthread_getcpuclockid.c \
-    $(LOCAL_DIR)/pthread/pthread_getschedparam.c \
     $(LOCAL_DIR)/pthread/pthread_getspecific.c \
     $(LOCAL_DIR)/pthread/pthread_join.c \
     $(LOCAL_DIR)/pthread/pthread_key_create.c \
@@ -116,8 +112,6 @@
     $(LOCAL_DIR)/pthread/pthread_setcancelstate.c \
     $(LOCAL_DIR)/pthread/pthread_setcanceltype.c \
     $(LOCAL_DIR)/pthread/pthread_setconcurrency.c \
-    $(LOCAL_DIR)/pthread/pthread_setschedparam.c \
-    $(LOCAL_DIR)/pthread/pthread_setschedprio.c \
     $(LOCAL_DIR)/pthread/pthread_setspecific.c \
     $(LOCAL_DIR)/pthread/pthread_sigmask.c \
     $(LOCAL_DIR)/pthread/pthread_spin_destroy.c \
diff --git a/third_party/ulib/musl/pthread/pthread_attr_get.c b/third_party/ulib/musl/pthread/pthread_attr_get.c
index 84290f2..7376087 100644
--- a/third_party/ulib/musl/pthread/pthread_attr_get.c
+++ b/third_party/ulib/musl/pthread/pthread_attr_get.c
@@ -9,27 +9,12 @@
     return 0;
 }
 
-int pthread_attr_getinheritsched(const pthread_attr_t* restrict a, int* restrict inherit) {
-    *inherit = a->_a_sched;
-    return 0;
-}
-
 int pthread_attr_getschedparam(const pthread_attr_t* restrict a,
                                struct sched_param* restrict param) {
     param->sched_priority = a->_a_prio;
     return 0;
 }
 
-int pthread_attr_getschedpolicy(const pthread_attr_t* restrict a, int* restrict policy) {
-    *policy = a->_a_policy;
-    return 0;
-}
-
-int pthread_attr_getscope(const pthread_attr_t* restrict a, int* restrict scope) {
-    *scope = PTHREAD_SCOPE_SYSTEM;
-    return 0;
-}
-
 int pthread_attr_getstack(const pthread_attr_t* restrict a, void** restrict addr,
                           size_t* restrict size) {
     if (a->_a_stackaddr == NULL)
diff --git a/third_party/ulib/musl/pthread/pthread_attr_setinheritsched.c b/third_party/ulib/musl/pthread/pthread_attr_setinheritsched.c
deleted file mode 100644
index f547e01..0000000
--- a/third_party/ulib/musl/pthread/pthread_attr_setinheritsched.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_attr_setinheritsched(pthread_attr_t* a, int inherit) {
-    if (inherit != PTHREAD_INHERIT_SCHED &&
-        inherit != PTHREAD_EXPLICIT_SCHED)
-        return EINVAL;
-    a->_a_sched = inherit;
-    return 0;
-}
diff --git a/third_party/ulib/musl/pthread/pthread_attr_setschedpolicy.c b/third_party/ulib/musl/pthread/pthread_attr_setschedpolicy.c
deleted file mode 100644
index 1a26424..0000000
--- a/third_party/ulib/musl/pthread/pthread_attr_setschedpolicy.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_attr_setschedpolicy(pthread_attr_t* a, int policy) {
-    a->_a_policy = policy;
-    return 0;
-}
diff --git a/third_party/ulib/musl/pthread/pthread_attr_setscope.c b/third_party/ulib/musl/pthread/pthread_attr_setscope.c
deleted file mode 100644
index f464200..0000000
--- a/third_party/ulib/musl/pthread/pthread_attr_setscope.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_attr_setscope(pthread_attr_t* a, int scope) {
-    switch (scope) {
-    case PTHREAD_SCOPE_SYSTEM:
-        return 0;
-    case PTHREAD_SCOPE_PROCESS:
-        return ENOTSUP;
-    default:
-        return EINVAL;
-    }
-}
diff --git a/third_party/ulib/musl/pthread/pthread_getschedparam.c b/third_party/ulib/musl/pthread/pthread_getschedparam.c
deleted file mode 100644
index 83afb78..0000000
--- a/third_party/ulib/musl/pthread/pthread_getschedparam.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_getschedparam(pthread_t t, int* restrict policy, struct sched_param* restrict param) {
-    return ENOSYS;
-}
diff --git a/third_party/ulib/musl/pthread/pthread_setschedparam.c b/third_party/ulib/musl/pthread/pthread_setschedparam.c
deleted file mode 100644
index ae13a1c..0000000
--- a/third_party/ulib/musl/pthread/pthread_setschedparam.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_setschedparam(pthread_t t, int policy, const struct sched_param* param) {
-    return ENOSYS;
-}
diff --git a/third_party/ulib/musl/pthread/pthread_setschedprio.c b/third_party/ulib/musl/pthread/pthread_setschedprio.c
deleted file mode 100644
index 674b64b..0000000
--- a/third_party/ulib/musl/pthread/pthread_setschedprio.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "pthread_impl.h"
-
-int pthread_setschedprio(pthread_t t, int prio) {
-    return ENOSYS;
-}