mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 17:33:23 +00:00
Use SpinLock
on FileTable
for efficiency
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
4a43e317b2
commit
1186fb7ca9
@ -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))
|
||||
}
|
||||
|
Reference in New Issue
Block a user