Struct aya::programs::trace_point::TracePoint
source · [−]pub struct TracePoint { /* private fields */ }
Expand description
A 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 4.7.
Examples
use std::convert::TryInto;
use aya::programs::TracePoint;
let prog: &mut TracePoint = bpf.program_mut("trace_context_switch").unwrap().try_into()?;
prog.load()?;
prog.attach("sched", "sched_switch")?;
Implementations
sourceimpl TracePoint
impl TracePoint
sourcepub fn load(&mut self) -> Result<(), ProgramError>
pub fn load(&mut self) -> Result<(), ProgramError>
Loads the program inside the kernel.
sourcepub fn attach(
&mut self,
category: &str,
name: &str
) -> Result<TracePointLinkId, ProgramError>
pub fn attach(
&mut self,
category: &str,
name: &str
) -> Result<TracePointLinkId, ProgramError>
Attaches to a given trace point.
For a list of the available event categories and names, see
/sys/kernel/debug/tracing/events
.
The returned value can be used to detach, see TracePoint::detach.
sourcepub fn detach(&mut self, link_id: TracePointLinkId) -> Result<(), ProgramError>
pub fn detach(&mut self, link_id: TracePointLinkId) -> Result<(), ProgramError>
Detaches from a trace point.
See TracePoint::attach.
sourcepub fn take_link(
&mut self,
link_id: TracePointLinkId
) -> Result<OwnedLink<TracePointLink>, ProgramError>
pub fn take_link(
&mut self,
link_id: TracePointLinkId
) -> Result<OwnedLink<TracePointLink>, ProgramError>
Takes ownership of the link referenced by the provided link_id.
The link will be detached on Drop
and the caller is now responsible
for managing its lifetime.
sourceimpl TracePoint
impl TracePoint
sourcepub fn unload(&mut self) -> Result<(), ProgramError>
pub fn unload(&mut self) -> Result<(), ProgramError>
Unloads the program from the kernel.
Links will be detached before unloading the program. Note
that owned links obtained using take_link()
will not be
detached.
Trait Implementations
sourceimpl Debug for TracePoint
impl Debug for TracePoint
sourceimpl ProgramFd for TracePoint
impl ProgramFd for TracePoint
sourceimpl ProgramFd for &mut TracePoint
impl ProgramFd for &mut TracePoint
sourceimpl<'a> TryFrom<&'a Program> for &'a TracePoint
impl<'a> TryFrom<&'a Program> for &'a TracePoint
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
sourcefn try_from(program: &'a Program) -> Result<&'a TracePoint, ProgramError>
fn try_from(program: &'a Program) -> Result<&'a TracePoint, ProgramError>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a mut Program> for &'a mut TracePoint
impl<'a> TryFrom<&'a mut Program> for &'a mut TracePoint
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 TracePoint, ProgramError>
fn try_from(
program: &'a mut Program
) -> Result<&'a mut TracePoint, ProgramError>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for TracePoint
impl Send for TracePoint
impl Sync for TracePoint
impl Unpin for TracePoint
impl UnwindSafe for TracePoint
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