Skip to main content

MemoryRegion

Struct MemoryRegion 

Source
pub struct MemoryRegion {
    pub start: usize,
    pub end: usize,
    pub permissions: RegionPermissions,
    pub offset: usize,
    pub dev_major: u8,
    pub dev_minor: u8,
    pub inode: usize,
    pub path: Option<String>,
}
Expand description

Each row in /proc/[pid]/maps describes a region of contiguous virtual memory in a process or thread.

Fields§

§start: usize

This is the starting address of the region in the process’s address space.

§end: usize

This is the ending address of the region in the process’s address space.

§permissions: RegionPermissions

This describes how pages in the region can be accessed.
There are four different permissions: read, write, execute, and shared.
If read/write/execute are disabled, a - will appear instead of the r/w/x .
If a region is not shared, it is private, so a p will appear instead of an s .
If the process attempts to access memory in a way that is not permitted,
a segmentation fault is generated.

Permissions can be changed using the mprotect(2) system call.

§offset: usize

If the region was mapped from a file (using mmap), this is the offset in the file
where the mapping begins. If the memory was not mapped from a file, it’s just 0.

§dev_major: u8

If the region was mapped from a file, this is the
major device number (in hex) where the file lives.

§dev_minor: u8

If the region was mapped from a file, this is the
minor device number (in hex) where the file lives.

§inode: usize

If the region was mapped from a file, this is the file number.

§path: Option<String>

If the region was mapped from a file, this is the name of the file.
This field is None for anonymous mapped regions.
There are also special regions with names like
[heap], [stack], or [vdso] .
The last one stands for virtual dynamic shared object.
It’s used by system calls to switch to kernel mode.

Trait Implementations§

Source§

impl Debug for MemoryRegion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.