Expand description
Tracks Fixed Memory Maps within an anonymous memory-mapped fixed-sized arena in the current process.
Fields§
§addr: *mut u8
§size: usize
Implementations§
source§impl MemoryMappingArena
impl MemoryMappingArena
sourcepub fn add_anon_protection(
&mut self,
offset: usize,
size: usize,
prot: Protection
) -> Result<(), Error>
pub fn add_anon_protection(
&mut self,
offset: usize,
size: usize,
prot: Protection
) -> Result<(), Error>
Anonymously maps size
bytes at offset
bytes from the start of the arena
with prot
protections. offset
must be page aligned.
Arguments
offset
- Page aligned offset into the arena in bytes.size
- Size of memory region in bytes.prot
- Protection (e.g. readable/writable) of the memory region.
sourcepub fn add_anon(&mut self, offset: usize, size: usize) -> Result<(), Error>
pub fn add_anon(&mut self, offset: usize, size: usize) -> Result<(), Error>
Anonymously maps size
bytes at offset
bytes from the start of the arena.
offset
must be page aligned.
Arguments
offset
- Page aligned offset into the arena in bytes.size
- Size of memory region in bytes.
sourcepub fn add_fd(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor
) -> Result<(), Error>
pub fn add_fd(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor
) -> Result<(), Error>
Maps size
bytes from the start of the given fd
at offset
bytes from
the start of the arena. offset
must be page aligned.
Arguments
offset
- Page aligned offset into the arena in bytes.size
- Size of memory region in bytes.fd
- File descriptor to mmap from.
sourcepub fn add_fd_offset(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64
) -> Result<(), Error>
pub fn add_fd_offset(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64
) -> Result<(), Error>
Maps size
bytes starting at fs_offset
bytes from within the given fd
at offset
bytes from the start of the arena. offset
must be page aligned.
Arguments
offset
- Page aligned offset into the arena in bytes.size
- Size of memory region in bytes.fd
- File descriptor to mmap from.fd_offset
- Offset in bytes from the beginning offd
to start the mmap.
sourcepub fn add_fd_offset_protection(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64,
prot: Protection
) -> Result<(), Error>
pub fn add_fd_offset_protection(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64,
prot: Protection
) -> Result<(), Error>
Maps size
bytes starting at fs_offset
bytes from within the given fd
at offset
bytes from the start of the arena with prot
protections.
offset
must be page aligned.
Arguments
offset
- Page aligned offset into the arena in bytes.size
- Size of memory region in bytes.fd
- File descriptor to mmap from.fd_offset
- Offset in bytes from the beginning offd
to start the mmap.prot
- Protection (e.g. readable/writable) of the memory region.
Trait Implementations§
source§impl Drop for MemoryMappingArena
impl Drop for MemoryMappingArena
source§impl From<MemoryMapping> for MemoryMappingArena
impl From<MemoryMapping> for MemoryMappingArena
source§fn from(mmap: MemoryMapping) -> Self
fn from(mmap: MemoryMapping) -> Self
source§impl From<MemoryMapping> for MemoryMappingArena
impl From<MemoryMapping> for MemoryMappingArena
source§fn from(mmap: CrateMemoryMapping) -> Self
fn from(mmap: CrateMemoryMapping) -> Self
source§impl MappedRegion for MemoryMappingArena
impl MappedRegion for MemoryMappingArena
source§fn as_ptr(&self) -> *mut u8
fn as_ptr(&self) -> *mut u8
source§fn add_fd_mapping(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64,
prot: Protection
) -> Result<(), Error>
fn add_fd_mapping(
&mut self,
offset: usize,
size: usize,
fd: &dyn AsRawDescriptor,
fd_offset: u64,
prot: Protection
) -> Result<(), Error>
size
bytes starting at fd_offset
bytes from within the given fd
at offset
bytes from the start of the region with prot
protections.
offset
must be page aligned. Read more