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