添加prlimit64系统调用 (#438)

注意: 目前仅支持读取默认的rlimit值,尚不支持设置rlimit值.
This commit is contained in:
LoGin
2023-11-12 18:44:15 +08:00
committed by GitHub
parent 4a2d7191a3
commit 0d9b7d9240
6 changed files with 165 additions and 8 deletions

View File

@ -4,8 +4,12 @@ use core::{
};
use crate::{
arch::syscall::SYS_PRLIMIT64,
libs::{futex::constant::FutexFlag, rand::GRandFlags},
process::{fork::KernelCloneArgs, resource::RUsage},
process::{
fork::KernelCloneArgs,
resource::{RLimit64, RUsage},
},
};
use num_traits::{FromPrimitive, ToPrimitive};
@ -1190,6 +1194,16 @@ impl Syscall {
Self::readlink_at(dirfd, pathname, buf, bufsiz)
}
SYS_PRLIMIT64 => {
let pid = args[0];
let pid = Pid::new(pid);
let resource = args[1];
let new_limit = args[2] as *const RLimit64;
let old_limit = args[3] as *mut RLimit64;
Self::prlimit64(pid, resource, new_limit, old_limit)
}
_ => panic!("Unsupported syscall ID: {}", syscall_num),
};
return r;