Type Alias libbpf_rs::Program

source ·
pub type Program<'obj> = ProgramImpl<'obj>;
Expand description

An immutable loaded BPF program.

Aliased Type§

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

Implementations§

source§

impl<'obj> Program<'obj>

source

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

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

source

pub fn name(&self) -> &OsStr

Retrieve the name of this Program.

source

pub fn section(&self) -> &OsStr

Retrieve the name of the section this Program belongs to.

source

pub fn prog_type(&self) -> ProgramType

Retrieve the type of the program.

source

pub fn get_fd_by_id(id: u32) -> Result<OwnedFd>

Returns program fd by id

source

pub fn get_id_by_fd(fd: BorrowedFd<'_>) -> Result<u32>

Returns program id by fd

source

pub fn flags(&self) -> u32

Returns flags that have been set for the program.

source

pub fn attach_type(&self) -> ProgramAttachType

Retrieve the attach type of the program.

source

pub fn autoload(&self) -> bool

Return true if the bpf program is set to autoload, false otherwise.

source

pub fn log_level(&self) -> u32

Return the bpf program’s log level.

source

pub fn insn_cnt(&self) -> usize

Returns the number of instructions that form the program.

Please see note in [OpenProgram::insn_cnt].

source

pub fn insns(&self) -> &[bpf_insn]

Gives read-only access to BPF program’s underlying BPF instructions.

Please see note in [OpenProgram::insns].