Pass caller names to __pthread_internal_find for better errors.
On http://b/122082295 we had this abort:
12-27 15:29:31.237 10222 10814 10848 F libc : invalid pthread_t 0xb1907960 passed to libc
This wasn't super helpful. We can do better. Now you get something like
this instead:
03-27 02:34:58.754 25329 25329 W libc : invalid pthread_t (0) passed to pthread_join
Test: adb shell crasher
Bug: http://b/123255692
Change-Id: I1d545665a233308480cc3747ec3120e2b6de0453
diff --git a/libc/bionic/pthread_setschedparam.cpp b/libc/bionic/pthread_setschedparam.cpp
index 10826d1..8a02728 100644
--- a/libc/bionic/pthread_setschedparam.cpp
+++ b/libc/bionic/pthread_setschedparam.cpp
@@ -31,11 +31,12 @@
#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;
- pid_t tid = pthread_gettid_np(t);
+ pid_t tid = __pthread_internal_gettid(t, "pthread_setschedparam");
if (tid == -1) return ESRCH;
return (sched_setscheduler(tid, policy, param) == -1) ? errno : 0;
@@ -44,7 +45,7 @@
int pthread_setschedprio(pthread_t t, int priority) {
ErrnoRestorer errno_restorer;
- pid_t tid = pthread_gettid_np(t);
+ pid_t tid = __pthread_internal_gettid(t, "pthread_setschedprio");
if (tid == -1) return ESRCH;
sched_param param = { .sched_priority = priority };