From f0850889d21af7745fd616d358f92d12ac355de6 Mon Sep 17 00:00:00 2001 From: auronandace Date: Thu, 4 Dec 2025 09:08:14 +0000 Subject: [PATCH 1/2] update and add spec links to locale and sched --- src/header/locale/mod.rs | 7 ++++++- src/header/sched/mod.rs | 21 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/header/locale/mod.rs b/src/header/locale/mod.rs index c77facb84d..53cadcdfa4 100644 --- a/src/header/locale/mod.rs +++ b/src/header/locale/mod.rs @@ -1,4 +1,6 @@ -//! locale implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/locale.h.html +//! `locale.h` implementation. +//! +//! See . use core::ptr; @@ -8,6 +10,7 @@ const EMPTY_PTR: *const c_char = "\0" as *const _ as *const c_char; // Can't use &str because of the mutability static mut C_LOCALE: [c_char; 2] = [b'C' as c_char, 0]; +/// See . #[repr(C)] pub struct lconv { currency_symbol: *const c_char, @@ -54,11 +57,13 @@ static mut CURRENT_LOCALE: lconv = lconv { thousands_sep: EMPTY_PTR, }; +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn localeconv() -> *mut lconv { &raw mut CURRENT_LOCALE as *mut _ } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn setlocale(_option: c_int, _val: *const c_char) -> *mut c_char { // TODO actually implement diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs index 7dc80800db..8ff560bd2a 100644 --- a/src/header/sched/mod.rs +++ b/src/header/sched/mod.rs @@ -1,4 +1,6 @@ -//! sched.h implementation for Redox, following https://pubs.opengroup.org/onlinepubs/7908799/xsh/sched.h.html +//! `sched.h` implementation. +//! +//! See . use crate::{ error::ResultExt, @@ -6,35 +8,50 @@ use crate::{ platform::{Pal, Sys, types::*}, }; +/// See . #[derive(Clone, Copy, Debug)] pub struct sched_param { pub sched_priority: c_int, } +/// See . pub const SCHED_FIFO: c_int = 0; +/// See . pub const SCHED_RR: c_int = 1; +/// See . pub const SCHED_OTHER: c_int = 2; +/// See . // #[unsafe(no_mangle)] pub extern "C" fn sched_get_priority_max(policy: c_int) -> c_int { todo!() } + +/// See . // #[unsafe(no_mangle)] pub extern "C" fn sched_get_priority_min(policy: c_int) -> c_int { todo!() } + +/// See . // #[unsafe(no_mangle)] pub unsafe extern "C" fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int { todo!() } + +/// See . // #[unsafe(no_mangle)] pub extern "C" fn sched_rr_get_interval(pid: pid_t, time: *const timespec) -> c_int { todo!() } + +/// See . // #[unsafe(no_mangle)] pub unsafe extern "C" fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int { todo!() } + +/// See . // #[unsafe(no_mangle)] pub extern "C" fn sched_setscheduler( pid: pid_t, @@ -43,6 +60,8 @@ pub extern "C" fn sched_setscheduler( ) -> c_int { todo!() } + +/// See . #[unsafe(no_mangle)] pub extern "C" fn sched_yield() -> c_int { Sys::sched_yield().map(|()| 0).or_minus_one_errno() From 1ce298eaa9dce4c8079d3399af61b8948338a18d Mon Sep 17 00:00:00 2001 From: auronandace Date: Thu, 4 Dec 2025 09:11:57 +0000 Subject: [PATCH 2/2] only import needed types in locale and sched --- src/header/locale/mod.rs | 2 +- src/header/sched/mod.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/header/locale/mod.rs b/src/header/locale/mod.rs index 53cadcdfa4..ba07c07ece 100644 --- a/src/header/locale/mod.rs +++ b/src/header/locale/mod.rs @@ -4,7 +4,7 @@ use core::ptr; -use crate::platform::types::*; +use crate::platform::types::{c_char, c_int}; const EMPTY_PTR: *const c_char = "\0" as *const _ as *const c_char; // Can't use &str because of the mutability diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs index 8ff560bd2a..2363edcaa0 100644 --- a/src/header/sched/mod.rs +++ b/src/header/sched/mod.rs @@ -5,7 +5,10 @@ use crate::{ error::ResultExt, header::time::timespec, - platform::{Pal, Sys, types::*}, + platform::{ + Pal, Sys, + types::{c_int, pid_t}, + }, }; /// See .