pub struct UProbe { /* private fields */ }
Expand description
An user space probe.
User probes are eBPF programs that can be attached to any userspace function. They can be of two kinds:
uprobe
: get attached to the start of the target functionsuretprobe
: get attached to the return address of the target functions
Implementations
sourceimpl UProbe
impl UProbe
sourcepub fn load(&mut self) -> Result<(), ProgramError>
pub fn load(&mut self) -> Result<(), ProgramError>
Loads the program inside the kernel.
See also Program::load
.
sourcepub fn kind(&self) -> ProbeKind
pub fn kind(&self) -> ProbeKind
Returns UProbe
if the program is a uprobe
, or URetProbe
if the
program is a uretprobe
.
sourcepub fn attach<T: AsRef<Path>>(
&mut self,
fn_name: Option<&str>,
offset: u64,
target: T,
pid: Option<pid_t>
) -> Result<LinkRef, ProgramError>
pub fn attach<T: AsRef<Path>>(
&mut self,
fn_name: Option<&str>,
offset: u64,
target: T,
pid: Option<pid_t>
) -> Result<LinkRef, ProgramError>
Attaches the program.
Attaches the uprobe to the function fn_name
defined in the target
.
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 executed by the given pid
.
The target
argument can be an absolute path to a binary or library, or
a library name (eg: "libc"
).
If the program is an uprobe
, it is attached to the start address of the target
function. Instead if the program is a kretprobe
, it is attached to the return address of
the target function.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for UProbe
impl !Send for UProbe
impl !Sync for UProbe
impl Unpin for UProbe
impl !UnwindSafe for UProbe
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more