Add pthread_setschedprio.

Bug: http://b/26204555
Test: ran tests
Change-Id: Ic34062b9b6036a1ce2642a069514bab48a893338
diff --git a/libc/bionic/pthread_setschedparam.cpp b/libc/bionic/pthread_setschedparam.cpp
index 3e80959..10826d1 100644
--- a/libc/bionic/pthread_setschedparam.cpp
+++ b/libc/bionic/pthread_setschedparam.cpp
@@ -27,9 +27,10 @@
  */
 
 #include <errno.h>
+#include <pthread.h>
+#include <sched.h>
 
 #include "private/ErrnoRestorer.h"
-#include "pthread_internal.h"
 
 int pthread_setschedparam(pthread_t t, int policy, const sched_param* param) {
   ErrnoRestorer errno_restorer;
@@ -39,3 +40,13 @@
 
   return (sched_setscheduler(tid, policy, param) == -1) ? errno : 0;
 }
+
+int pthread_setschedprio(pthread_t t, int priority) {
+  ErrnoRestorer errno_restorer;
+
+  pid_t tid = pthread_gettid_np(t);
+  if (tid == -1) return ESRCH;
+
+  sched_param param = { .sched_priority = priority };
+  return (sched_setparam(tid, &param) == -1) ? errno : 0;
+}
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 32315fe..2253e0d 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -220,6 +220,7 @@
 int pthread_setname_np(pthread_t __pthread, const char* __name);
 
 int pthread_setschedparam(pthread_t __pthread, int __policy, const struct sched_param* __param);
+int pthread_setschedprio(pthread_t __pthread, int __priority) __INTRODUCED_IN_FUTURE;
 
 int pthread_setspecific(pthread_key_t __key, const void* __value);
 
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index 82d6872..981dd59 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -1362,6 +1362,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 5dfe93b..29c5235 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -1282,6 +1282,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 8f7b599..eafbbd7 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1387,6 +1387,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index 3a039c5..a32131f 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -1346,6 +1346,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map
index 5dfe93b..29c5235 100644
--- a/libc/libc.mips64.map
+++ b/libc/libc.mips64.map
@@ -1282,6 +1282,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 2b165cc..f1308ea 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -1344,6 +1344,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;
diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map
index 5dfe93b..29c5235 100644
--- a/libc/libc.x86_64.map
+++ b/libc/libc.x86_64.map
@@ -1282,6 +1282,7 @@
     posix_spawn_file_actions_destroy;
     posix_spawn_file_actions_init;
     posix_spawnp;
+    pthread_setschedprio;
     sethostent;
     setnetent;
     setprotoent;