Implementation of load average calculation and corresponding /proc entry

Moved everything into the kernel side. Add a SchedulerStats trait

Use 'fixed' to represent fixed-point numbers

Make the loadavg calculation lazy
This commit is contained in:
Champii1
2024-10-18 18:46:58 +02:00
committed by Tate, Hongliang Tian
parent efd49a96e3
commit 4701eaf0cb
12 changed files with 256 additions and 3 deletions

View File

@ -46,7 +46,7 @@ fn handle_getfd(fd: FileDesc, ctx: &Context) -> Result<SyscallReturn> {
}
fn handle_setfd(fd: FileDesc, arg: u64, ctx: &Context) -> Result<SyscallReturn> {
let flags = if arg > u8::MAX.into() {
let flags = if arg > u64::from(u8::MAX) {
return_errno_with_message!(Errno::EINVAL, "invalid fd flags");
} else {
FdFlags::from_bits(arg as u8).ok_or(Error::with_message(Errno::EINVAL, "invalid flags"))?