Commit 7be01870 authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum
Browse files

lib/cobalt: Pass setsched requests for unknown threads to glibc



This aligns the implementation with the documentation: If we get an
error from the kernel that suggests the thread is unknown to it, let
glibc deal with it.

Note that pthread_setschedparam_ex currently returns an invalid error
code, EINVAL rather than ESRCH, so that we try to detect the remote
thread case with some heuristic.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 4a1e4467
......@@ -308,6 +308,16 @@ int sched_setscheduler_ex(pid_t pid,
pid, policy, param_ex,
&u_winoff, &promoted);
/*
* If the kernel has no reference to the target thread, let glibc
* handle the call.
*/
if (ret == ESRCH) {
std_policy = cobalt_xlate_schedparam(policy, param_ex,
&std_param);
return __STD(sched_setscheduler(pid, std_policy, &std_param));
}
if (ret == 0 && promoted) {
cobalt_sigshadow_install_once();
cobalt_set_tsd(u_winoff);
......
......@@ -644,6 +644,17 @@ int pthread_setschedparam_ex(pthread_t thread,
thread, policy, param_ex,
u_winoff_ptr, &promoted);
/*
* If the kernel has no reference to the target thread. let glibc
* handle the call.
*/
if (!u_winoff_ptr && ret == EINVAL) {
std_policy = cobalt_xlate_schedparam(policy, param_ex,
&std_param);
return __STD(pthread_setschedparam(thread, std_policy,
&std_param));
}
if (ret == 0 && promoted) {
cobalt_sigshadow_install_once();
cobalt_set_tsd(u_winoff);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment