Struct Mmap

Source
pub struct Mmap<'a> {
    pub pid: u32,
    pub tid: u32,
    pub addr: u64,
    pub len: u64,
    pub pgoff: u64,
    pub filename: Cow<'a, [u8]>,
}
Expand description

MMAP events record memory mappings.

This struct corresponds to PERF_RECORD_MMAP. See the manpage for more documentation here.

Fields§

§pid: u32

The process ID.

§tid: u32

The thread ID.

§addr: u64

The address that the mapping was placed at in the process’ address space.

§len: u64

The length, in bytes, of the allocated memory.

§pgoff: u64

The page offset of the memory mapping.

§filename: Cow<'a, [u8]>

The path to the file that is being mapped, if there is one.

§Notes

  • Not all memory mappings have a path on the file system. In cases where there is no such path then this will be a label(ish) string from the kernel (e.g. [stack], [heap], [vdso], etc.)
  • Just because the mapping has a path doesn’t necessarily mean that the file at that path was the file that was mapped. The file may have been deleted in the meantime or the process may be under a chroot.

If you need to be able to tell whether the file at the path is the same one as was mapped you will need to use Mmap2 instead.

Implementations§

Source§

impl<'a> Mmap<'a>

Source

pub fn filename_os(&self) -> &OsStr

The path to the file that is being mapped, as an OsStr.

§Notes
  • Not all memory mappings have a path on the file system. In cases where there is no such path then this will be a label(ish) string from the kernel (e.g. [stack], [heap], [vdso], etc.)
  • Just because the mapping has a path doesn’t necessarily mean that the file at that path was the file that was mapped. The file may have been deleted in the meantime or the process may be under a chroot.

If you need to be able to tell whether the file at the path is the same one as was mapped you will need to use Mmap2 instead.

Source

pub fn into_owned(self) -> Mmap<'static>

Convert all the borrowed data in this Mmap into owned data.

Trait Implementations§

Source§

impl<'a> Clone for Mmap<'a>

Source§

fn clone(&self) -> Mmap<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mmap<'_>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> From<Mmap<'a>> for Record<'a>

Source§

fn from(value: Mmap<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Mmap2<'a>> for Mmap<'a>

Source§

fn from(value: Mmap2<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'p> Parse<'p> for Mmap<'p>

Source§

fn parse<B, E>(p: &mut Parser<B, E>) -> ParseResult<Self>
where E: Endian, B: ParseBuf<'p>,

Parse Self using the provided Parser instance.

Auto Trait Implementations§

§

impl<'a> Freeze for Mmap<'a>

§

impl<'a> RefUnwindSafe for Mmap<'a>

§

impl<'a> Send for Mmap<'a>

§

impl<'a> Sync for Mmap<'a>

§

impl<'a> Unpin for Mmap<'a>

§

impl<'a> UnwindSafe for Mmap<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.