Use SpinLock on FileTable for efficiency

This commit is contained in:
Shaowei Song
2024-09-13 03:36:33 +00:00
committed by Tate, Hongliang Tian
parent 4a43e317b2
commit 1186fb7ca9
14 changed files with 108 additions and 66 deletions

View File

@ -13,8 +13,10 @@ use crate::{
pub fn sys_fchmod(fd: FileDesc, mode: u16, ctx: &Context) -> Result<SyscallReturn> {
debug!("fd = {}, mode = 0o{:o}", fd, mode);
let file_table = ctx.process.file_table().lock();
let file = file_table.get_file(fd)?;
let file = {
let file_table = ctx.process.file_table().lock();
file_table.get_file(fd)?.clone()
};
file.set_mode(InodeMode::from_bits_truncate(mode))?;
Ok(SyscallReturn::Return(0))
}