Enable sched params change

This commit is contained in:
R Aadarsh
2026-06-10 21:18:13 +05:30
parent 484fe42c0e
commit 58fefac9f5
6 changed files with 31 additions and 22 deletions
Generated
+4 -2
View File
@@ -462,7 +462,8 @@ dependencies = [
[[package]]
name = "redox_event"
version = "0.4.7"
source = "git+https://gitlab.redox-os.org/EuclidDivisionLemma/event?branch=spawn#9126b9b1166e4633877feacf109720481e814e2e"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c07d0d6d291e3a951bd847b1cd4af32fc6243d64116cf7702838c02797688b7"
dependencies = [
"bitflags",
"libredox",
@@ -472,7 +473,8 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.8.1"
source = "git+https://gitlab.redox-os.org/redox-os/syscall/#79cb6d9057642be31623677458a93aa88145864f"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b44b894f2a6e36457d665d1e08c3866add6ed5e70050c1b4ba8a8ddedb02ce7"
dependencies = [
"bitflags",
]
+1 -4
View File
@@ -121,9 +121,7 @@ sc = "0.2.7"
redox_syscall.workspace = true
redox-rt = { path = "redox-rt" }
redox-path.workspace = true
redox_event = { git = "https://gitlab.redox-os.org/EuclidDivisionLemma/event", branch = "spawn", default-features = false, features = [
"redox_syscall",
] }
redox_event = { version = "0.4.7", default-features = false, features = ["redox_syscall"] }
ioslice.workspace = true
redox-ioctl = { path = "redox-ioctl" }
redox_protocols.workspace = true
@@ -145,4 +143,3 @@ panic = "abort"
[patch.crates-io]
cc-11 = { git = "https://github.com/tea/cc-rs", branch = "riscv-abi-arch-fix", package = "cc" }
redox_syscall = {git = "https://gitlab.redox-os.org/redox-os/syscall/"}
-3
View File
@@ -10,7 +10,4 @@ description = "Ioctl definitions and (de)serialization for Redox"
drm-sys = "0.8.0"
redox_syscall = "0.8.1"
[patch.crates-io]
redox_syscall = {git = "https://gitlab.redox-os.org/EuclidDivisionLemma/syscall/", branch = "spawn"}
[features]
+1 -1
View File
@@ -1,4 +1,4 @@
sys_includes = ["sched.h", "bits/sigset-t.h", "bits/mode-t.h"]
sys_includes = ["sched.h", "bits/sigset-t.h", "bits/mode-t.h", "bits/size-t.h"]
include_guard = "_RELIBC_SPAWN_H"
language = "C"
cpp_compat = true
+2 -8
View File
@@ -3,7 +3,7 @@ use core::ptr;
use crate::{
header::errno::EBADF,
platform::types::{c_char, c_int, mode_t, size_t},
platform::types::{c_char, c_int, c_uchar, mode_t, size_t},
};
#[derive(Debug, Clone)]
@@ -25,7 +25,7 @@ struct FileActions(Vec<Action>);
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct posix_spawn_file_actions_t {
__relibc_internal_size: [u8; 24],
__relibc_internal_size: [c_uchar; 24],
__relibc_internal_align: size_t,
}
@@ -124,9 +124,6 @@ pub unsafe extern "C" fn posix_spawn_file_actions_addopen(
mode: mode_t,
) -> c_int {
let file_actions = unsafe { file_actions.as_mut().expect("file_actions cannot be NULL") };
if path.is_null() {
panic!("path cannot be NULL");
}
if fd < 0 {
return EBADF;
}
@@ -174,9 +171,6 @@ pub unsafe extern "C" fn posix_spawn_file_actions_addchdir(
path: *const c_char,
) -> c_int {
let file_actions = unsafe { file_actions.as_mut().expect("file_actions cannot be NULL") };
if path.is_null() {
panic!("path cannot be NULL");
}
file_actions.add_action(Action::Chdir(unsafe {
if path.is_null() {
CString::new("").unwrap()
+23 -4
View File
@@ -44,7 +44,7 @@ use crate::{
sys_file,
sys_mman::{MAP_ANONYMOUS, PROT_READ, PROT_WRITE},
sys_random,
sys_resource::{RLIM_INFINITY, rlimit, rusage},
sys_resource::{PRIO_PROCESS, RLIM_INFINITY, rlimit, rusage, setpriority},
sys_select::timeval,
sys_stat::{S_ISGID, S_ISUID, S_ISVTX, stat},
sys_statvfs::statvfs,
@@ -60,7 +60,7 @@ use crate::{
ld_so::tcb::OsSpecific,
out::Out,
platform::{
free,
ERRNO, free,
sys::timer::{TIMERS, timer_routine, timer_update_wake_time},
},
sync::rwlock::RwLock,
@@ -1358,8 +1358,27 @@ impl Pal for Sys {
}
}
if flags.contains(Flags::POSIX_SPAWN_SETSCHEDPARAM) {
todo!()
let set_schedparam = || -> Result<()> {
if setpriority(
PRIO_PROCESS,
proc_fd.as_raw_fd() as id_t,
attr.param.sched_priority,
) as usize
!= 0
{
Err(Errno(ERRNO.get()))
} else {
Ok(())
}
};
let set_scheduler = || -> Result<()> { todo!() };
// scheduling paramters must be set regardless of whether the flag POSIX_SPAWN_SETSCHEDPARAM is set
if flags.contains(Flags::POSIX_SPAWN_SETSCHEDULER) {
set_schedparam()?;
set_scheduler()?;
} else if flags.contains(Flags::POSIX_SPAWN_SETSCHEDPARAM) {
set_schedparam()?;
}
let set_resugid = || -> Result<()> {