mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 08:03:22 +00:00
实现SystemV共享内存 (#690)
* 实现SystemV共享内存 * 测试shm * 添加测试程序 * 完善细节 * 修正shm的时间数据错误的问题 * fix: devfs的metadata权限为0x777的错误 --------- Co-authored-by: longjin <longjin@DragonOS.org>
This commit is contained in:
@ -5,6 +5,7 @@ use system_error::SystemError;
|
||||
|
||||
use crate::{
|
||||
arch::MMArch,
|
||||
ipc::shm::ShmFlags,
|
||||
kerror,
|
||||
libs::align::{check_aligned, page_align_up},
|
||||
mm::MemoryManagementArch,
|
||||
@ -113,6 +114,28 @@ impl From<ProtFlags> for VmFlags {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ShmFlags> for VmFlags {
|
||||
fn from(shm_flags: ShmFlags) -> Self {
|
||||
let mut vm_flags = VmFlags::VM_NONE;
|
||||
|
||||
if shm_flags.contains(ShmFlags::SHM_RDONLY) {
|
||||
vm_flags |= VmFlags::VM_READ;
|
||||
} else {
|
||||
vm_flags |= VmFlags::VM_READ | VmFlags::VM_WRITE;
|
||||
}
|
||||
|
||||
if shm_flags.contains(ShmFlags::SHM_EXEC) {
|
||||
vm_flags |= VmFlags::VM_EXEC;
|
||||
}
|
||||
|
||||
if shm_flags.contains(ShmFlags::SHM_HUGETLB) {
|
||||
vm_flags |= VmFlags::VM_HUGETLB;
|
||||
}
|
||||
|
||||
vm_flags
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VmFlags> for MapFlags {
|
||||
fn from(value: VmFlags) -> Self {
|
||||
let mut map_flags = MapFlags::MAP_NONE;
|
||||
|
Reference in New Issue
Block a user