Type Alias libbpf_rs::ProgramMut

source ·
pub type ProgramMut<'obj> = ProgramImpl<'obj, Mut>;
Expand description

A mutable loaded BPF program.

Aliased Type§

struct ProgramMut<'obj> { /* private fields */ }

Implementations§

source§

impl<'obj> ProgramMut<'obj>

source

pub fn new_mut(prog: &'obj mut bpf_program) -> Self

Create a [Program] from a [libbpf_sys::bpf_program]

source

pub fn pin<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Pin this program to bpffs.

source

pub fn unpin<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Unpin this program from bpffs

source

pub fn attach(&mut self) -> Result<Link>

Auto-attach based on prog section

source

pub fn attach_cgroup(&mut self, cgroup_fd: i32) -> Result<Link>

Attach this program to a cgroup.

source

pub fn attach_perf_event(&mut self, pfd: i32) -> Result<Link>

Attach this program to a perf event.

source

pub fn attach_uprobe<T: AsRef<Path>>( &mut self, retprobe: bool, pid: i32, binary_path: T, func_offset: usize, ) -> Result<Link>

Attach this program to a userspace probe.

source

pub fn attach_uprobe_with_opts( &mut self, pid: i32, binary_path: impl AsRef<Path>, func_offset: usize, opts: UprobeOpts, ) -> Result<Link>

Attach this program to a userspace probe, providing additional options.

source

pub fn attach_kprobe<T: AsRef<str>>( &mut self, retprobe: bool, func_name: T, ) -> Result<Link>

Attach this program to a kernel probe.

source

pub fn attach_ksyscall<T: AsRef<str>>( &mut self, retprobe: bool, syscall_name: T, ) -> Result<Link>

Attach this program to the specified syscall

source

pub fn attach_tracepoint( &mut self, tp_category: impl AsRef<str>, tp_name: impl AsRef<str>, ) -> Result<Link>

Attach this program to a kernel tracepoint.

source

pub fn attach_tracepoint_with_opts( &mut self, tp_category: impl AsRef<str>, tp_name: impl AsRef<str>, tp_opts: TracepointOpts, ) -> Result<Link>

Attach this program to a kernel tracepoint, providing additional options.

source

pub fn attach_raw_tracepoint<T: AsRef<str>>( &mut self, tp_name: T, ) -> Result<Link>

Attach this program to a raw kernel tracepoint.

source

pub fn attach_lsm(&mut self) -> Result<Link>

Attach to an LSM hook

source

pub fn attach_trace(&mut self) -> Result<Link>

source

pub fn attach_sockmap(&self, map_fd: i32) -> Result<()>

Attach a verdict/parser to a sockmap/sockhash

source

pub fn attach_xdp(&mut self, ifindex: i32) -> Result<Link>

Attach this program to XDP

source

pub fn attach_netns(&mut self, netns_fd: i32) -> Result<Link>

Attach this program to netns-based programs

source

pub fn attach_usdt( &mut self, pid: i32, binary_path: impl AsRef<Path>, usdt_provider: impl AsRef<str>, usdt_name: impl AsRef<str>, ) -> Result<Link>

Attach this program to a USDT probe point. The entry point of the program must be defined with SEC("usdt").

source

pub fn attach_usdt_with_opts( &mut self, pid: i32, binary_path: impl AsRef<Path>, usdt_provider: impl AsRef<str>, usdt_name: impl AsRef<str>, usdt_opts: UsdtOpts, ) -> Result<Link>

Attach this program to a USDT probe point, providing additional options. The entry point of the program must be defined with SEC("usdt").

source

pub fn attach_iter(&mut self, map_fd: BorrowedFd<'_>) -> Result<Link>

Attach this program to a BPF Iterator. The entry point of the program must be defined with SEC("iter") or SEC("iter.s").

source

pub fn test_run<'dat>(&mut self, input: Input<'dat>) -> Result<Output<'dat>>

Test run the program with the given input data.

This function uses the BPF_PROG_RUN facility.

Trait Implementations§

source§

impl<'obj> Deref for ProgramMut<'obj>

§

type Target = ProgramImpl<'obj>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.