From 02e249f30bfe08b8a5cde1226ca0161f9e370927 Mon Sep 17 00:00:00 2001 From: LoGin Date: Sun, 12 Nov 2023 14:11:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0uid=E3=80=81gid=E7=9A=84?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=B0=83=E7=94=A8=EF=BC=88=E6=9A=B4=E5=8A=9B?= =?UTF-8?q?=E5=B0=81=E8=A3=85=E8=BF=94=E5=9B=9E0=EF=BC=89=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/src/process/syscall.rs | 20 ++++++++++++++++++++ kernel/src/syscall/mod.rs | 25 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/kernel/src/process/syscall.rs b/kernel/src/process/syscall.rs index 08bbaf77..aa820a75 100644 --- a/kernel/src/process/syscall.rs +++ b/kernel/src/process/syscall.rs @@ -300,4 +300,24 @@ impl Syscall { let pcb = ProcessManager::current_pcb(); Ok(pcb.pid) } + + pub fn getuid() -> Result { + // todo: 增加credit功能之后,需要修改 + return Ok(0); + } + + pub fn getgid() -> Result { + // todo: 增加credit功能之后,需要修改 + return Ok(0); + } + + pub fn geteuid() -> Result { + // todo: 增加credit功能之后,需要修改 + return Ok(0); + } + + pub fn getegid() -> Result { + // todo: 增加credit功能之后,需要修改 + return Ok(0); + } } diff --git a/kernel/src/syscall/mod.rs b/kernel/src/syscall/mod.rs index 29e041b6..65e6be2e 100644 --- a/kernel/src/syscall/mod.rs +++ b/kernel/src/syscall/mod.rs @@ -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), };