pub struct FEntry { /* private fields */ }
Expand description
A program that can be attached to the entry point of (almost) any kernel function.
FEntry
programs are similar to kprobes, but
the difference is that fentry has practically zero overhead to call before
kernel function. Fentry programs can be also attached to other eBPF
programs.
Minimum kernel version
The minimum kernel version required to use this feature is 5.5.
Examples
use aya::{Bpf, programs::FEntry, BtfError, Btf};
use std::convert::TryInto;
let btf = Btf::from_sys_fs()?;
let program: &mut FEntry = bpf.program_mut("filename_lookup").unwrap().try_into()?;
program.load("filename_lookup", &btf)?;
program.attach()?;
Implementations
sourceimpl FEntry
impl FEntry
sourcepub fn load(&mut self, fn_name: &str, btf: &Btf) -> Result<(), ProgramError>
pub fn load(&mut self, fn_name: &str, btf: &Btf) -> Result<(), ProgramError>
Loads the program inside the kernel.
See also Program::load
.
Loads the program so it’s executed when the kernel function fn_name
is entered. The btf
argument must contain the BTF info for the
running kernel.
sourcepub fn attach(&mut self) -> Result<LinkRef, ProgramError>
pub fn attach(&mut self) -> Result<LinkRef, ProgramError>
Attaches the program
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for FEntry
impl !Send for FEntry
impl !Sync for FEntry
impl Unpin for FEntry
impl !UnwindSafe for FEntry
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