添加uid、gid的系统调用(暴力封装返回0) (#434)

This commit is contained in:
LoGin 2023-11-12 14:11:33 +08:00 committed by GitHub
parent ea8ad4d42e
commit 02e249f30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 0 deletions

View File

@ -300,4 +300,24 @@ impl Syscall {
let pcb = ProcessManager::current_pcb();
Ok(pcb.pid)
}
pub fn getuid() -> Result<usize, SystemError> {
// todo: 增加credit功能之后需要修改
return Ok(0);
}
pub fn getgid() -> Result<usize, SystemError> {
// todo: 增加credit功能之后需要修改
return Ok(0);
}
pub fn geteuid() -> Result<usize, SystemError> {
// todo: 增加credit功能之后需要修改
return Ok(0);
}
pub fn getegid() -> Result<usize, SystemError> {
// todo: 增加credit功能之后需要修改
return Ok(0);
}
}

View File

@ -401,6 +401,15 @@ pub const SYS_MKDIR: usize = 83;
pub const SYS_GETTIMEOFDAY: usize = 96;
pub const SYS_GETUID: usize = 102;
pub const SYS_SYSLOG: usize = 103;
pub const SYS_GETGID: usize = 104;
pub const SYS_SETUID: usize = 105;
pub const SYS_SETGID: usize = 106;
pub const SYS_GETEUID: usize = 107;
pub const SYS_GETEGID: usize = 108;
pub const SYS_GETPPID: usize = 110;
pub const SYS_GETPGID: usize = 121;
@ -1139,6 +1148,22 @@ impl Syscall {
Ok(0)
}
SYS_GETTID => Self::gettid().map(|tid| tid.into()),
SYS_GETUID => Self::getuid().map(|uid| uid.into()),
SYS_SYSLOG => {
kwarn!("SYS_SYSLOG has not yet been implemented");
Ok(0)
}
SYS_GETGID => Self::getgid().map(|gid| gid.into()),
SYS_SETUID => {
kwarn!("SYS_SETUID has not yet been implemented");
Ok(0)
}
SYS_SETGID => {
kwarn!("SYS_SETGID has not yet been implemented");
Ok(0)
}
SYS_GETEUID => Self::geteuid().map(|euid| euid.into()),
SYS_GETEGID => Self::getegid().map(|egid| egid.into()),
_ => panic!("Unsupported syscall ID: {}", syscall_num),
};