#[repr(transparent)]pub struct MemoryFlags(pub u32);
Tuple Fields§
§0: u32
Implementations§
Source§impl MemoryFlags
impl MemoryFlags
Sourcepub const ACCESS_READ: u32 = 1u32
pub const ACCESS_READ: u32 = 1u32
Memory is readable.
Sourcepub const ACCESS_WRITE: u32 = 2u32
pub const ACCESS_WRITE: u32 = 2u32
Memory is writable.
Sourcepub const ACCESS_EXECUTE: u32 = 4u32
pub const ACCESS_EXECUTE: u32 = 4u32
Memory is executable.
Sourcepub const ACCESS_RWX: u32 = 7u32
pub const ACCESS_RWX: u32 = 7u32
Memory is readable, writable and executable.
Sourcepub const MMAP_ENABLE_JIT: u32 = 16u32
pub const MMAP_ENABLE_JIT: u32 = 16u32
Use a MAP_JIT
flag available on Apple platforms (introduced by Mojave), which allows JIT code to be
executed in a MAC bundle.
This flag may be turned on by the allocator if there is no other way of allocating executable memory.
§Note
This flag can only be used with [alloc], MAP_JIT
only works on OSX and not on iOS.
When a process uses fork()
the child process has no access to the pages mapped with MAP_JIT
.
Sourcepub const MMAP_MAX_ACCESS_READ: u32 = 32u32
pub const MMAP_MAX_ACCESS_READ: u32 = 32u32
Pass PROT_MAX(PROT_READ)
or PROT_MPROTECT(PROT_READ)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
§Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessRead
is used.
Sourcepub const MMAP_MAX_ACCESS_WRITE: u32 = 64u32
pub const MMAP_MAX_ACCESS_WRITE: u32 = 64u32
Pass PROT_MAX(PROT_WRITE)
or PROT_MPROTECT(PROT_WRITE)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
§Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessWrite
is used.
Sourcepub const MMAP_MAX_ACCESS_EXECUTE: u32 = 128u32
pub const MMAP_MAX_ACCESS_EXECUTE: u32 = 128u32
Pass PROT_MAX(PROT_EXEC)
or PROT_MPROTECT(PROT_EXEC)
to mmap()
on platforms that support it.
This flag allows to set a “maximum access” that the memory page can get during its lifetime. Use protect to change the access flags.
§Note
This flag can only be used with [alloc] and alloc_dual_mapping.
However alloc_dual_mapping may automatically use this if AccessExecute
is used.
pub const MMAP_MAX_ACCESS_RW: u32 = 96u32
pub const MMAP_MAX_ACCESS_RX: u32 = 160u32
pub const MMAP_MAX_ACCESS_RWX: u32 = 224u32
Sourcepub const MAP_SHARED: u32 = 256u32
pub const MAP_SHARED: u32 = 256u32
Use MAP_SHARED
when calling mmap().
§Note
In some cases MAP_SHARED
may be set automatically. For example, some dual mapping implementations must
use MAP_SHARED
instead of MAP_PRIVATE
to ensure that the OS would not apply copy on write on RW page, which
would cause RX page not having the updated content.
Sourcepub const MAPPING_PREFER_TMP: u32 = 2_147_483_648u32
pub const MAPPING_PREFER_TMP: u32 = 2_147_483_648u32
Not an access flag, only used by alloc_dual_mapping()
to override the default allocation strategy to always use
a ‘tmp’ directory instead of “/dev/shm” (on POSIX platforms). Please note that this flag will be ignored if the
operating system allows to allocate an executable memory by a different API than open()
or shm_open()
. For
example on Linux memfd_create()
is preferred and on BSDs shm_open(SHM_ANON, ...)
is used if SHM_ANON is
defined.
§Note
This flag can only be used with [alloc].
Trait Implementations§
Source§impl BitAnd<u32> for MemoryFlags
impl BitAnd<u32> for MemoryFlags
Source§impl BitAnd for MemoryFlags
impl BitAnd for MemoryFlags
Source§impl BitAndAssign<u32> for MemoryFlags
impl BitAndAssign<u32> for MemoryFlags
Source§fn bitand_assign(&mut self, rhs: u32)
fn bitand_assign(&mut self, rhs: u32)
&=
operation. Read moreSource§impl BitAndAssign for MemoryFlags
impl BitAndAssign for MemoryFlags
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moreSource§impl BitOr<u32> for MemoryFlags
impl BitOr<u32> for MemoryFlags
Source§impl BitOr for MemoryFlags
impl BitOr for MemoryFlags
Source§impl BitOrAssign<u32> for MemoryFlags
impl BitOrAssign<u32> for MemoryFlags
Source§fn bitor_assign(&mut self, rhs: u32)
fn bitor_assign(&mut self, rhs: u32)
|=
operation. Read moreSource§impl BitOrAssign for MemoryFlags
impl BitOrAssign for MemoryFlags
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|=
operation. Read moreSource§impl Clone for MemoryFlags
impl Clone for MemoryFlags
Source§fn clone(&self) -> MemoryFlags
fn clone(&self) -> MemoryFlags
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more