[][src]Struct libbpf_rs::Program

pub struct Program { /* fields omitted */ }

Represents a loaded Program.

This struct is not safe to clone because the underlying libbpf resource cannot currently be protected from data races.

If you attempt to attach a Program with the wrong attach method, the attach_* method will fail with the appropriate error.

Implementations

impl Program[src]

pub fn name(&self) -> &str[src]

pub fn section(&self) -> &str[src]

Name of the section this Program belongs to.

pub fn prog_type(&self) -> ProgramType[src]

pub fn fd(&self) -> i32[src]

Returns a file descriptor to the underlying program.

pub fn attach_type(&self) -> ProgramAttachType[src]

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

Pin this program to bpffs.

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

Unpin this program from bpffs

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

Auto-attach based on prog section

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

Attach this program to a cgroup.

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

Attach this program to a perf event.

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

Attach this program to a userspace probe.

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

Attach this program to a kernel probe.

pub fn attach_tracepoint<T: AsRef<str>>(
    &mut self,
    tp_category: T,
    tp_name: T
) -> Result<Link>
[src]

Attach this program to a kernel tracepoint.

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

Attach this program to a raw kernel tracepoint.

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

Attach to an LSM hook

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

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

Attach a verdict/parser to a sockmap/sockhash

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.