Struct Interceptor

Source
pub struct Interceptor { /* private fields */ }
Expand description

Provide the main functionality for intercepting.

Implementations§

Source§

impl Interceptor

Source

pub fn new(cmd: Command) -> Result<Self>

create child process by specific a std::process::Command

Examples found in repository?
examples/demo.rs (line 15)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let args = args().collect::<Vec<_>>();
11    let mut cmd = Command::new(&args[0]);
12    if let Some(args) = args.get(1..) {
13        cmd.args(args);
14    }
15    Interceptor::new(cmd)?.on(&openat).run()?;
16    Ok(())
17}
Source

pub fn on<R, A1, A2, A3, A4, A5, A6>( &mut self, syscall: &'static SysCall<R, A1, A2, A3, A4, A5, A6>, ) -> &mut Self
where R: Number, A1: Read, A2: Read, A3: Read, A4: Read, A5: Read, A6: Read, MayBePtr<<A1 as Read>::InnerType>: Write<A1> + Ptr<A1>, MayBePtr<<A2 as Read>::InnerType>: Write<A2> + Ptr<A2>, MayBePtr<<A3 as Read>::InnerType>: Write<A3> + Ptr<A3>, MayBePtr<<A4 as Read>::InnerType>: Write<A4> + Ptr<A4>, MayBePtr<<A5 as Read>::InnerType>: Write<A5> + Ptr<A5>, MayBePtr<<A6 as Read>::InnerType>: Write<A6> + Ptr<A6>,

register syscall to interceptor

Examples found in repository?
examples/demo.rs (line 15)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let args = args().collect::<Vec<_>>();
11    let mut cmd = Command::new(&args[0]);
12    if let Some(args) = args.get(1..) {
13        cmd.args(args);
14    }
15    Interceptor::new(cmd)?.on(&openat).run()?;
16    Ok(())
17}
Source

pub fn run(&mut self) -> Result<()>

run the child process and begin intercepting

Examples found in repository?
examples/demo.rs (line 15)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let args = args().collect::<Vec<_>>();
11    let mut cmd = Command::new(&args[0]);
12    if let Some(args) = args.get(1..) {
13        cmd.args(args);
14    }
15    Interceptor::new(cmd)?.on(&openat).run()?;
16    Ok(())
17}

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more