pub struct FExit { /* private fields */ }
Expand description
A program that can be attached to the exit point of (almost) anny kernel function.
FExit
programs are similar to kretprobes,
but the difference is that fexit has practically zero overhead to call
before kernel function. Fexit 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::FExit, BtfError, Btf};
use std::convert::TryInto;
let btf = Btf::from_sys_fs()?;
let program: &mut FExit = bpf.program_mut("filename_lookup").unwrap().try_into()?;
program.load("filename_lookup", &btf)?;
program.attach()?;
Implementations
sourceimpl FExit
impl FExit
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.
Loads the program so it’s executed when the kernel function fn_name
is exited. The btf
argument must contain the BTF info for the running
kernel.
sourcepub fn attach(&mut self) -> Result<FExitLinkId, ProgramError>
pub fn attach(&mut self) -> Result<FExitLinkId, ProgramError>
Attaches the program.
The returned value can be used to detach, see FExit::detach.
sourcepub fn detach(&mut self, link_id: FExitLinkId) -> Result<(), ProgramError>
pub fn detach(&mut self, link_id: FExitLinkId) -> Result<(), ProgramError>
Detaches the program.
See FExit::attach.
sourcepub fn take_link(
&mut self,
link_id: FExitLinkId
) -> Result<OwnedLink<FExitLink>, ProgramError>
pub fn take_link(
&mut self,
link_id: FExitLinkId
) -> Result<OwnedLink<FExitLink>, 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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FExit
impl Send for FExit
impl Sync for FExit
impl Unpin for FExit
impl UnwindSafe for FExit
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