map_shm

Function map_shm 

Source
pub fn map_shm(shm: ShmHandle) -> Status
Expand description

Map a shared memory in the caller’s memory layout

§Usage

Maps a given shared identified by its handle (see get_shm_handle).

The memory mapping system is responsible for verifying that there is enough space in the caller’s memory layout, and if yes, do map, synchronously, the shared memory in the caller’s memory. The memory access policy is based on the SHM policy defined for the caller through the shm_set_credential syscall. The SHM mapping is synchronous.

Any shared memory can be unmapped (see unmap_shm).

This syscall returns Status::Ok if the device is successfully mapped by the kernel.

If the shared memory handle is not associated to the caller (neither own nor previously declared as user), the syscall returns Status::Denied If the shared memory handle is not found, or the shared memory is already mapped, the syscall returns Status::Invalid. If the shared memory can’t be mapped (e.g. if the task memory layout is already full) the syscall returns Status::Busy.

§Example

match map_shm(shmh) {
   Status::Ok => (),
   Status::Busy => (unmap_other()),
   any_err => return(any_err),
}