From 9387fd2c3427fe424eab2ad25851880786918548 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Thu, 9 Jul 2026 20:40:08 +0300 Subject: [PATCH] =?UTF-8?q?relibc:=20implement=20get=5Fsched=5Fparam=20?= =?UTF-8?q?=E2=80=94=20replace=20todo!()=20with=20real=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- src/pthread/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs index 0a5f5082f6..4774bcd8f1 100644 --- a/src/pthread/mod.rs +++ b/src/pthread/mod.rs @@ -422,7 +422,14 @@ pub fn get_cpu_clkid(thread: &Pthread) -> Result { 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?