Struct aya::programs::BtfTracePoint
source · [−]pub struct BtfTracePoint { /* private fields */ }
Expand description
Marks a function as a BTF-enabled raw tracepoint eBPF program that can be attached at a pre-defined kernel trace point.
The kernel provides a set of pre-defined trace points that eBPF programs can
be attached to. See /sys/kernel/debug/tracing/events
for a list of which
events can be traced.
Minimum kernel version
The minimum kernel version required to use this feature is 5.5.
Examples
use aya::{Bpf, programs::BtfTracePoint, BtfError, Btf};
use std::convert::TryInto;
let btf = Btf::from_sys_fs()?;
let program: &mut BtfTracePoint = bpf.program_mut("sched_process_fork").unwrap().try_into()?;
program.load("sched_process_fork", &btf)?;
program.attach()?;
Implementations
sourceimpl BtfTracePoint
impl BtfTracePoint
sourcepub fn load(&mut self, tracepoint: &str, btf: &Btf) -> Result<(), ProgramError>
pub fn load(&mut self, tracepoint: &str, btf: &Btf) -> Result<(), ProgramError>
Loads the program inside the kernel.
See also Program::load
.
Arguments
tracepoint
- full name of the tracepoint that we should attach tobtf
- btf information for the target system
sourcepub fn attach(&mut self) -> Result<LinkRef, ProgramError>
pub fn attach(&mut self) -> Result<LinkRef, ProgramError>
Attaches the program.
Trait Implementations
sourceimpl Debug for BtfTracePoint
impl Debug for BtfTracePoint
sourceimpl ProgramFd for BtfTracePoint
impl ProgramFd for BtfTracePoint
sourceimpl ProgramFd for &mut BtfTracePoint
impl ProgramFd for &mut BtfTracePoint
sourceimpl<'a> TryFrom<&'a Program> for &'a BtfTracePoint
impl<'a> TryFrom<&'a Program> for &'a BtfTracePoint
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
sourcefn try_from(program: &'a Program) -> Result<&'a BtfTracePoint, ProgramError>
fn try_from(program: &'a Program) -> Result<&'a BtfTracePoint, ProgramError>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a mut Program> for &'a mut BtfTracePoint
impl<'a> TryFrom<&'a mut Program> for &'a mut BtfTracePoint
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
sourcefn try_from(
program: &'a mut Program
) -> Result<&'a mut BtfTracePoint, ProgramError>
fn try_from(
program: &'a mut Program
) -> Result<&'a mut BtfTracePoint, ProgramError>
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for BtfTracePoint
impl !Send for BtfTracePoint
impl !Sync for BtfTracePoint
impl Unpin for BtfTracePoint
impl !UnwindSafe for BtfTracePoint
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