From 98624c374646a050556bdc402b55b792fefa7e55 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 15 Oct 2013 16:51:17 -0700 Subject: [PATCH] Make pthread_create report sched_setscheduler failures on LP64. We couldn't fix this for 32-bit because there's too much broken code out there. (Pretty much everyone asks for real-time scheduling for all their threads, and the kernel says "don't be stupid".) Change-Id: I43c5271e6b6bb91278b9a19eec08cbf05391e3c4 --- libc/bionic/pthread_create.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp index 8338ad577..d03b8269c 100644 --- a/libc/bionic/pthread_create.cpp +++ b/libc/bionic/pthread_create.cpp @@ -91,8 +91,10 @@ int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) { struct sched_param param; param.sched_priority = thread->attr.sched_priority; if (sched_setscheduler(thread->tid, thread->attr.sched_policy, ¶m) == -1) { - // For backwards compatibility reasons, we just warn about failures here. - // error = errno; +#if __LP64__ + // For backwards compatibility reasons, we only report failures on 64-bit devices. + error = errno; +#endif __libc_format_log(ANDROID_LOG_WARN, "libc", "pthread_create sched_setscheduler call failed: %s", strerror(errno)); }