Commit 4e5c96d5 authored by Jan Kiszka's avatar Jan Kiszka

lib/cobalt: Use new thread_setschedprio syscall

Switch the implementation of pthread_setschedprio to the new cobalt
syscall in order to avoid scheduler setting corruptions for SCHED_QUOTA
and similar complex policies.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent fcbfaf4b
......@@ -666,11 +666,36 @@ int pthread_setschedparam_ex(pthread_t thread,
COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio))
struct sched_param_ex param_ex = {
.sched_priority = prio,
__u32 u_winoff, *u_winoff_ptr;
int ret, promoted;
return pthread_setschedparam_ex(thread, __SCHED_CURRENT, &param_ex);
/* See pthread_setschedparam_ex. */
if (cobalt_eager_setsched()) {
ret = __STD(pthread_setschedprio(thread, prio));
if (ret)
return ret;
/* only request promotion when this targets the current thread */
u_winoff_ptr = thread == pthread_self() ? &u_winoff : NULL;
ret = -XENOMAI_SYSCALL4(sc_cobalt_thread_setschedprio,
thread, prio, u_winoff_ptr, &promoted);
* If the kernel has no reference to the target thread. let glibc
* handle the call.
if (ret == ESRCH)
return __STD(pthread_setschedprio(thread, prio));
if (ret == 0 && promoted) {
return ret;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment