[][src]Struct redbpf::ProgramArray

pub struct ProgramArray<'a> { /* fields omitted */ }

Program array map.

An array of eBPF programs that can be used as a jump table.

To use this from eBPF code, see redbpf_probes::maps::ProgramArray.

Implementations

impl<'base> ProgramArray<'base>[src]

pub fn new(base: &Map) -> Result<ProgramArray<'_>>[src]

pub fn get(&self, index: u32) -> Result<RawFd>[src]

Get the fd of the eBPF program at index.

pub fn set(&mut self, index: u32, fd: RawFd) -> Result<()>[src]

Set the index entry to the given eBPF program fd.

To jump to a program from eBPF, see redbpf_probes::maps::ProgramArray::tail_call.

Example

pub const PROGRAM_PARSE_HTTP: u32 = 0;

use redbpf::{load::Loader, ProgramArray};
let mut loader = Loader::load_file("iotop.elf").expect("error loading probe");
let mut programs = ProgramArray::new(loader.map("program_map").unwrap()).unwrap();

programs.set(
    PROGRAM_PARSE_HTTP,
    loader.program("parse_http").unwrap().fd().unwrap(),
);

Auto Trait Implementations

impl<'a> RefUnwindSafe for ProgramArray<'a>

impl<'a> Send for ProgramArray<'a>

impl<'a> Sync for ProgramArray<'a>

impl<'a> Unpin for ProgramArray<'a>

impl<'a> UnwindSafe for ProgramArray<'a>

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.