[Xenomai] [PATCH 6/6] cobalt: Fix error code of cobalt_thread_setschedparam_ex

Jan Kiszka jan.kiszka at siemens.com
Mon Jul 16 18:37:54 CEST 2018


From: Jan Kiszka <jan.kiszka at siemens.com>

This aligns the return code with cobalt_sched_setschedparam_ex: If there
is no u_winoff and no thread, we should return ESRCH so that userspace
can easily detect that it should call the standard libc service instead.
Fix the core and remove the related workaround from the userspace lib.

Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
---
 kernel/cobalt/posix/thread.c | 2 +-
 lib/cobalt/thread.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 86f667488c..44f655a300 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -478,7 +478,7 @@ int cobalt_thread_setschedparam_ex(unsigned long pth,
 	thread = thread_lookup(&hkey);
 	if (thread == NULL) {
 		if (u_winoff == NULL)
-			return -EINVAL;
+			return -ESRCH;
 			
 		thread = cobalt_thread_shadow(&hkey, u_winoff);
 		if (IS_ERR(thread))
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index b3c11abbb7..86db6343c9 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -648,7 +648,7 @@ int pthread_setschedparam_ex(pthread_t thread,
 	 * If the kernel has no reference to the target thread. let glibc
 	 * handle the call.
 	 */
-	if (!u_winoff_ptr && ret == EINVAL) {
+	if (ret == ESRCH) {
 		std_policy = cobalt_xlate_schedparam(policy, param_ex,
 						     &std_param);
 		return __STD(pthread_setschedparam(thread, std_policy,
-- 
2.16.4




More information about the Xenomai mailing list