Skip to main content

Req

Struct Req 

Source
pub(crate) struct Req<'a> {
    pub ctx: &'a Ctx,
    pub listener: i32,
    pub id: u64,
    pub pid: u32,
    pub args: [u64; 6],
    pub raw_nr: i32,
    pub abi: Abi,
    pub variant: Variant,
    view: OnceCell<Arc<View>>,
}
Expand description

One notification plus the shared state needed to serve it.

Fields§

§ctx: &'a Ctx§listener: i32§id: u64§pid: u32§args: [u64; 6]§raw_nr: i32

Syscall number as the tracee issued it, in its own ABI.

§abi: Abi

ABI the request came through; 32-bit pointers are already zero-extended.

§variant: Variant

How an i386 request differs from the x86_64 number it was mapped to.

§view: OnceCell<Arc<View>>

The caller’s view, looked up once per request.

Implementations§

Source§

impl<'a> Req<'a>

Source

pub fn arg(&self, i: usize) -> u64

Source

pub fn view(&self) -> &View

The view the calling process lives in.

Source

pub fn fs(&self) -> &Fs

The calling process’s filesystem view.

Source

fn arg_i64(&self, i: usize) -> i64

Source

fn dirfd(&self, i: usize) -> i32

Source

pub fn tgid(&self) -> i32

Thread-group id of the calling thread.

Source

pub fn path(&self, i: usize) -> Result<Vec<u8>, i32>

Reads the NUL-terminated path in argument i, rewriting /proc/self and /proc/thread-self to the tracee’s own entries since the supervisor would otherwise see its own.

Source

pub fn translate( &self, dirfd: i32, path: &[u8], deref_final: bool, ) -> Result<Resolved, i32>

Translates path relative to dirfd into the object to act on.

Source

pub fn translate_or_dirfd( &self, dirfd: i32, path: &[u8], deref_final: bool, ) -> Result<Resolved, i32>

Translates like Req::translate, except that an empty path names dirfd itself.

AT_EMPTY_PATH asks for that, and readlinkat always takes it; for AT_FDCWD it is the tracee’s working directory.

§Arguments
  • dirfd - Base descriptor for a relative path, or libc::AT_FDCWD.
  • path - Path bytes as read from the tracee, without NUL.
  • deref_final - Follow a symlink in the final component.
§Errors

As Req::translate, or the errno of reading the descriptor’s path.

Source

pub fn valid(&self) -> Result<(), i32>

Re-validates the notification; Err(DROPPED) when the tracee is gone.

Source

pub fn check_writable(&self, resolved: &Resolved) -> Result<(), i32>

Refuses with EROFS when the resolved path lies under a read-only binding.

Source

pub fn write(&self, addr: u64, data: &[u8]) -> Result<(), i32>

Source

pub fn read(&self, addr: u64, len: usize) -> Result<Vec<u8>, i32>

Auto Trait Implementations§

§

impl<'a> !Freeze for Req<'a>

§

impl<'a> !RefUnwindSafe for Req<'a>

§

impl<'a> !Sync for Req<'a>

§

impl<'a> Send for Req<'a>

§

impl<'a> Unpin for Req<'a>

§

impl<'a> UnsafeUnpin for Req<'a>

§

impl<'a> UnwindSafe for Req<'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> 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.