Struct aya::programs::RawTracePoint
source · [−]pub struct RawTracePoint { /* private fields */ }
Expand description
A program that can be attached at a pre-defined kernel trace point, but also has an access to kernel internal arguments of trace points, which differentiates them from traditional tracepoint eBPF programs.
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.17.
Examples
use aya::{Bpf, programs::RawTracePoint};
use std::convert::TryInto;
let program: &mut RawTracePoint = bpf.program_mut("sys_enter").unwrap().try_into()?;
program.load()?;
program.attach("sys_enter")?;
Implementations
sourceimpl RawTracePoint
impl RawTracePoint
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,
tp_name: &str
) -> Result<RawTracePointLinkId, ProgramError>
pub fn attach(
&mut self,
tp_name: &str
) -> Result<RawTracePointLinkId, ProgramError>
Attaches the program to the given tracepoint.
The returned value can be used to detach, see RawTracePoint::detach.
sourcepub fn detach(
&mut self,
link_id: RawTracePointLinkId
) -> Result<(), ProgramError>
pub fn detach(
&mut self,
link_id: RawTracePointLinkId
) -> Result<(), ProgramError>
Detaches from a tracepoint.
sourcepub fn take_link(
&mut self,
link_id: RawTracePointLinkId
) -> Result<OwnedLink<RawTracePointLink>, ProgramError>
pub fn take_link(
&mut self,
link_id: RawTracePointLinkId
) -> Result<OwnedLink<RawTracePointLink>, 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 RawTracePoint
impl RawTracePoint
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 RawTracePoint
impl Debug for RawTracePoint
sourceimpl ProgramFd for RawTracePoint
impl ProgramFd for RawTracePoint
sourceimpl ProgramFd for &mut RawTracePoint
impl ProgramFd for &mut RawTracePoint
sourceimpl<'a> TryFrom<&'a Program> for &'a RawTracePoint
impl<'a> TryFrom<&'a Program> for &'a RawTracePoint
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
sourcefn try_from(program: &'a Program) -> Result<&'a RawTracePoint, ProgramError>
fn try_from(program: &'a Program) -> Result<&'a RawTracePoint, ProgramError>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a mut Program> for &'a mut RawTracePoint
impl<'a> TryFrom<&'a mut Program> for &'a mut RawTracePoint
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 RawTracePoint, ProgramError>
fn try_from(
program: &'a mut Program
) -> Result<&'a mut RawTracePoint, ProgramError>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for RawTracePoint
impl Send for RawTracePoint
impl Sync for RawTracePoint
impl Unpin for RawTracePoint
impl UnwindSafe for RawTracePoint
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