实现SystemV共享内存 (#690)

* 实现SystemV共享内存

* 测试shm

* 添加测试程序

* 完善细节

* 修正shm的时间数据错误的问题

* fix: devfs的metadata权限为0x777的错误

---------

Co-authored-by: longjin <longjin@DragonOS.org>
This commit is contained in:
Jomo
2024-04-07 14:04:19 +08:00
committed by GitHub
parent eb49bb993a
commit 6fc066ac11
49 changed files with 1567 additions and 202 deletions

View File

@ -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;