pub struct ProgramInfo(/* private fields */);Expand description
Provides metadata information about a loaded eBPF program.
Introduced in kernel v4.13.
Implementations§
Source§impl ProgramInfo
impl ProgramInfo
Sourcepub fn program_type(&self) -> bpf_prog_type
pub fn program_type(&self) -> bpf_prog_type
The type of program.
Introduced in kernel v4.13.
Sourcepub const fn tag(&self) -> u64
pub const fn tag(&self) -> u64
The program tag.
The tag is a SHA sum of the program’s instructions which be used as an alternative to
Self::id(). A program’s ID can vary every time it’s loaded or unloaded, but the tag
will remain the same.
Introduced in kernel v4.13.
Sourcepub const fn size_jitted(&self) -> u32
pub const fn size_jitted(&self) -> u32
The size in bytes of the program’s JIT-compiled machine code.
Note that this field is only updated when BPF JIT compiler is enabled. Kernels v4.15 and above may already have it enabled by default.
Introduced in kernel v4.13.
Sourcepub fn size_translated(&self) -> Option<u32>
pub fn size_translated(&self) -> Option<u32>
The size in bytes of the program’s translated eBPF bytecode.
The translated bytecode is after it has been passed though the verifier where it was possibly modified by the kernel.
None is returned if the field is not available.
Introduced in kernel v4.15.
Sourcepub fn loaded_at(&self) -> Option<SystemTime>
pub fn loaded_at(&self) -> Option<SystemTime>
The time when the program was loaded.
None is returned if the field is not available.
Introduced in kernel v4.15.
Sourcepub fn created_by_uid(&self) -> Option<u32>
pub fn created_by_uid(&self) -> Option<u32>
The user ID of the process who loaded the program.
None is returned if the field is not available.
Introduced in kernel v4.15.
Sourcepub fn map_ids(&self) -> Result<Option<Vec<u32>>, ProgramError>
pub fn map_ids(&self) -> Result<Option<Vec<u32>>, ProgramError>
The IDs of the maps used by the program.
None is returned if the field is not available.
Introduced in kernel v4.15.
Sourcepub fn name(&self) -> &[u8] ⓘ
pub fn name(&self) -> &[u8] ⓘ
The name of the program as was provided when it was load. This is limited to 16 bytes.
Introduced in kernel v4.15.
Sourcepub fn name_as_str(&self) -> Option<&str>
pub fn name_as_str(&self) -> Option<&str>
The name of the program as a &str.
None is returned if the name was not valid unicode or if field is not available.
Introduced in kernel v4.15.
Sourcepub fn gpl_compatible(&self) -> Option<bool>
pub fn gpl_compatible(&self) -> Option<bool>
Returns true if the program is defined with a GPL-compatible license.
None is returned if the field is not available.
Introduced in kernel v4.18.
Sourcepub const fn run_time(&self) -> Duration
pub const fn run_time(&self) -> Duration
The accumulated time that the program has been actively running.
This is not to be confused with the duration since the program was first loaded on the host.
Note this field is only updated for as long as
enable_stats is enabled
with Stats::RunTime.
Introduced in kernel v5.1.
Sourcepub const fn run_count(&self) -> u64
pub const fn run_count(&self) -> u64
The accumulated execution count of the program.
Note this field is only updated for as long as
enable_stats is enabled
with Stats::RunTime.
Introduced in kernel v5.1.
Sourcepub fn verified_instruction_count(&self) -> Option<u32>
pub fn verified_instruction_count(&self) -> Option<u32>
The number of verified instructions in the program.
This may be less than the total number of instructions in the compiled program due to dead code elimination in the verifier.
None is returned if the field is not available.
Introduced in kernel v5.16.
Sourcepub fn memory_locked(&self) -> Result<u32, ProgramError>
pub fn memory_locked(&self) -> Result<u32, ProgramError>
How much memory in bytes has been allocated and locked for the program.
Sourcepub fn fd(&self) -> Result<ProgramFd, ProgramError>
pub fn fd(&self) -> Result<ProgramFd, ProgramError>
Returns a file descriptor referencing the program.
The returned file descriptor can be closed at any time and doing so does not influence the life cycle of the program.
Uses kernel v4.13 features.