Struct aya::programs::KProbe[][src]

pub struct KProbe { /* fields omitted */ }
Expand description

A kernel probe.

Kernel probes are eBPF programs that can be attached to almost any function inside the kernel. They can be of two kinds:

  • kprobe: get attached to the start of the target functions
  • kretprobe: get attached to the return address of the target functions

Examples

use aya::{Bpf, programs::KProbe};
use std::convert::TryInto;

let program: &mut KProbe = bpf.program_mut("intercept_wakeups")?.try_into()?;
program.attach("try_to_wake_up", 0, None)?;

Implementations

Loads the program inside the kernel.

See also Program::load.

Returns the name of the program.

Returns KProbe if the program is a kprobe, or KRetProbe if the program is a kretprobe.

Attaches the program.

Attaches the probe to the given function name inside the kernel. If offset is non-zero, it is added to the address of the target function. If pid is not None, the program executes only when the target function is triggered by the given pid.

If the program is a kprobe, it is attached to the start address of the target function. Conversely if the program is a kretprobe, it is attached to the return address of the target function.

Trait Implementations

Formats the value using the given formatter. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.