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:
+8
-1
@@ -422,7 +422,14 @@ pub fn get_cpu_clkid(thread: &Pthread) -> Result<clockid_t, Errno> {
|
|||||||
Err(Errno(ENOENT))
|
Err(Errno(ENOENT))
|
||||||
}
|
}
|
||||||
pub fn get_sched_param(thread: &Pthread) -> Result<(clockid_t, sched_param), Errno> {
|
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?
|
// TODO: Hash map?
|
||||||
|
|||||||
Reference in New Issue
Block a user