mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Implement atomic wrapper for integer-like type
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
a7cb71161d
commit
21fedd1b60
@ -1,10 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
use crate::{prelude::*, process::Gid};
|
||||
|
||||
pub fn sys_getegid(ctx: &Context) -> Result<SyscallReturn> {
|
||||
let egid = ctx.posix_thread.credentials().egid();
|
||||
|
||||
Ok(SyscallReturn::Return(egid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(<Gid as Into<u32>>::into(egid) as _))
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
use crate::{prelude::*, process::Uid};
|
||||
|
||||
pub fn sys_geteuid(ctx: &Context) -> Result<SyscallReturn> {
|
||||
let euid = ctx.posix_thread.credentials().euid();
|
||||
|
||||
Ok(SyscallReturn::Return(euid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(<Uid as Into<u32>>::into(euid) as _))
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
use crate::{prelude::*, process::Gid};
|
||||
|
||||
pub fn sys_getgid(ctx: &Context) -> Result<SyscallReturn> {
|
||||
let gid = ctx.posix_thread.credentials().rgid();
|
||||
|
||||
Ok(SyscallReturn::Return(gid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(<Gid as Into<u32>>::into(gid) as _))
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
use crate::{prelude::*, process::Uid};
|
||||
|
||||
pub fn sys_getuid(ctx: &Context) -> Result<SyscallReturn> {
|
||||
let uid = ctx.posix_thread.credentials().ruid();
|
||||
|
||||
Ok(SyscallReturn::Return(uid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(<Uid as Into<u32>>::into(uid) as _))
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ pub fn sys_setfsgid(gid: i32, ctx: &Context) -> Result<SyscallReturn> {
|
||||
credentials.set_fsgid(fsgid)?
|
||||
};
|
||||
|
||||
Ok(SyscallReturn::Return(old_fsgid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(
|
||||
<Gid as Into<u32>>::into(old_fsgid) as _
|
||||
))
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ pub fn sys_setfsuid(uid: i32, ctx: &Context) -> Result<SyscallReturn> {
|
||||
credentials.set_fsuid(fsuid)?
|
||||
};
|
||||
|
||||
Ok(SyscallReturn::Return(old_fsuid.as_u32() as _))
|
||||
Ok(SyscallReturn::Return(
|
||||
<Uid as Into<u32>>::into(old_fsuid) as _
|
||||
))
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ impl From<Metadata> for Stat {
|
||||
st_ino: info.ino,
|
||||
st_nlink: info.nlinks,
|
||||
st_mode: info.type_ as u32 | info.mode.bits() as u32,
|
||||
st_uid: info.uid.as_u32(),
|
||||
st_gid: info.gid.as_u32(),
|
||||
st_uid: info.uid.into(),
|
||||
st_gid: info.gid.into(),
|
||||
__pad0: 0,
|
||||
st_rdev: info.rdev,
|
||||
st_size: info.size as isize,
|
||||
|
Reference in New Issue
Block a user