pub struct Mm { /* private fields */ }Expand description
A wrapper for the kernel’s struct mm_struct.
This represents the address space of a userspace process, so each process has one Mm
instance. It may hold many VMAs internally.
There is a counter called mm_users that counts the users of the address space; this includes
the userspace process itself, but can also include kernel threads accessing the address space.
Once mm_users reaches zero, this indicates that the address space can be destroyed. To access
the address space, you must prevent mm_users from reaching zero while you are accessing it.
The MmWithUser type represents an address space where this is guaranteed, and you can
create one using mmget_not_zero.
The ARef<Mm> smart pointer holds an mmgrab refcount. Its destructor may sleep.
§Invariants
Values of this type are always refcounted using mmgrab.
Implementations§
Source§impl Mm
impl Mm
Sourcepub unsafe fn from_raw<'a>(ptr: *const mm_struct) -> &'a Mm
pub unsafe fn from_raw<'a>(ptr: *const mm_struct) -> &'a Mm
Obtain a reference from a raw pointer.
§Safety
The caller must ensure that ptr points at an mm_struct, and that it is not deallocated
during the lifetime ’a.
Sourcepub fn mmget_not_zero(&self) -> Option<ARef<MmWithUser>>
pub fn mmget_not_zero(&self) -> Option<ARef<MmWithUser>>
Calls mmget_not_zero and returns a handle if it succeeds.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Mm
impl !RefUnwindSafe for Mm
impl !Unpin for Mm
impl !UnsafeUnpin for Mm
impl UnwindSafe for Mm
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
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot. Read more