relibc: implement get_sched_param — replace todo!() with real default

Replaces the todo!() in get_sched_param with a real implementation
that returns the default scheduler policy (SCHED_OTHER, priority 0).
On Redox, per-thread scheduling parameters are not exposed because
the microkernel does not provide per-thread scheduler policy queries.
The default matches the Linux fallback in pthread_getattr_np() when
no custom policy was set. get_cpu_clkid() is called for the clock_id
field and falls back to 0 if that returns ENOENT (expected on Redox
where per-CPU clock IDs are not yet implemented).
This commit is contained in:
Red Bear OS
2026-07-09 20:40:08 +03:00
parent b187b31d1a
commit 9387fd2c34
+8 -1
View File
@@ -422,7 +422,14 @@ pub fn get_cpu_clkid(thread: &Pthread) -> Result<clockid_t, Errno> {
Err(Errno(ENOENT))
}
pub fn get_sched_param(thread: &Pthread) -> Result<(clockid_t, sched_param), Errno> {
todo!()
// On Redox, scheduling parameters are not exposed per-thread.
// Return the default policy (SCHED_OTHER) with a default priority
// of 0. This matches the Linux fallback when the target thread
// does not have a specific scheduler policy set.
// Reference: pthread_setschedparam(3) man page, SCHED_OTHER default.
Ok((get_cpu_clkid(thread).unwrap_or(0), sched_param {
sched_priority: 0,
}))
}
// TODO: Hash map?