libbpf_rs

Type Alias 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

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>

👎Deprecated: renamed to Program::fd_from_id
Source

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

Returns program file descriptor given a program ID.

Source

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

👎Deprecated: renamed to Program::id_from_fd
Source

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

Returns program ID given a file descriptor.

Source

pub fn fd_from_pinned_path<P: AsRef<Path>>(path: P) -> Result<OwnedFd>

Returns fd of a previously pinned program

Returns error, if the pinned path doesn’t represent an eBPF program.

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.