pub enum MemoryObject {
Vmo(Vmo),
RingBuf(Vmo),
MemoryMappedClock {
koid: Koid,
utc_clock: UtcClock,
},
}Variants§
Vmo(Vmo)
RingBuf(Vmo)
The memory object is a bpf ring buffer. The layout it represents is: |Page1 - Page2 - Page3 .. PageN - Page3 .. PageN| where the vmo is |Page1 - Page2 - Page3 .. PageN|
MemoryMappedClock
A memory mapped clock is backed by kernel memory, not by a VMO. So it is handled specially. The lifecycle of this clock is:
- starts off as an empty unmapped thing.
- a MappedClock is created on
map_in_vmar. - a name is added on
set_zx_name. - most clone/resize operations return errors.
- unmapped at the end of the process lifetime.
Implementations§
Source§impl MemoryObject
impl MemoryObject
pub fn as_vmo(&self) -> Option<&Vmo>
Sourcepub fn is_clock(&self) -> bool
pub fn is_clock(&self) -> bool
Returns true if this MemoryObject is a memory mapped clock.
pub fn into_vmo(self) -> Option<Vmo>
pub fn get_content_size(&self) -> u64
pub fn set_content_size(&self, size: u64) -> Result<(), Status>
pub fn get_size(&self) -> u64
pub fn set_size(&self, size: u64) -> Result<(), Status>
pub fn create_child( &self, option: VmoChildOptions, offset: u64, size: u64, ) -> Result<Self, Status>
pub fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
pub fn read(&self, data: &mut [u8], offset: u64) -> Result<(), Status>
pub fn read_to_array<T: Copy + FromBytes, const N: usize>( &self, offset: u64, ) -> Result<[T; N], Status>
pub fn read_to_vec(&self, offset: u64, length: u64) -> Result<Vec<u8>, Status>
pub fn read_uninit<'a>( &self, data: &'a mut [MaybeUninit<u8>], offset: u64, ) -> Result<&'a mut [u8], Status>
Sourcepub unsafe fn read_raw(
&self,
buffer: *mut u8,
buffer_length: usize,
offset: u64,
) -> Result<(), Status>
pub unsafe fn read_raw( &self, buffer: *mut u8, buffer_length: usize, offset: u64, ) -> Result<(), Status>
Sourcepub fn basic_info(&self) -> HandleBasicInfo
pub fn basic_info(&self) -> HandleBasicInfo
Returns the generic basic handle info.
Sourcepub fn get_koid(&self) -> Koid
pub fn get_koid(&self) -> Koid
Returns the koid of the underlying memory-like object.
Should be cheap to call frequently.
Sourcepub fn info(&self) -> Result<VmoInfo, Errno>
pub fn info(&self) -> Result<VmoInfo, Errno>
Returns zx::VmoInfo for a memory object that supports it.
§Panics
Calling info on a MemoryObject that is not represented by a VMO
will panic. To avoid this in code, call is_clock before attempting.
pub fn set_zx_name(&self, name: &[u8])
pub fn with_zx_name(self, name: &[u8]) -> Self
pub fn op_range(&self, op: VmoOp, offset: u64, size: u64) -> Result<(), Status>
pub fn replace_as_executable(self, vmex: &Resource) -> Result<Self, Status>
pub fn map_in_vmar( &self, vmar: &Vmar, vmar_offset: usize, memory_offset: u64, len: usize, flags: VmarFlags, ) -> Result<usize, Status>
pub fn memmove( &self, options: TransferDataOptions, dst_offset: u64, src_offset: u64, size: u64, ) -> Result<(), Status>
pub fn clone_memory( self: &Arc<Self>, rights: Rights, ) -> Result<Arc<Self>, Errno>
Trait Implementations§
Source§impl Debug for MemoryObject
impl Debug for MemoryObject
Source§impl From<Clock<BootTimeline, UtcTimeline>> for MemoryObject
impl From<Clock<BootTimeline, UtcTimeline>> for MemoryObject
Source§fn from(utc_clock: UtcClock) -> MemoryObject
fn from(utc_clock: UtcClock) -> MemoryObject
Converts to this type from the input type.
Source§impl From<Vmo> for MemoryObject
impl From<Vmo> for MemoryObject
Source§impl PartialEq for MemoryObject
impl PartialEq for MemoryObject
impl Eq for MemoryObject
Auto Trait Implementations§
impl Freeze for MemoryObject
impl RefUnwindSafe for MemoryObject
impl Send for MemoryObject
impl Sync for MemoryObject
impl Unpin for MemoryObject
impl UnwindSafe for MemoryObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.