mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +00:00
Remove the shim kernel crate
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d76c7a5b1e
commit
dafd16075f
25
kernel/src/syscall/setregid.rs
Normal file
25
kernel/src/syscall/setregid.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::{prelude::*, process::Gid};
|
||||
|
||||
pub fn sys_setregid(rgid: i32, egid: i32, ctx: &Context) -> Result<SyscallReturn> {
|
||||
debug!("rgid = {}, egid = {}", rgid, egid);
|
||||
|
||||
let rgid = if rgid > 0 {
|
||||
Some(Gid::new(rgid as u32))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let egid = if egid > 0 {
|
||||
Some(Gid::new(egid as u32))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let credentials = ctx.posix_thread.credentials_mut();
|
||||
credentials.set_regid(rgid, egid)?;
|
||||
|
||||
Ok(SyscallReturn::Return(0))
|
||||
}
|
Reference in New Issue
Block a user