pub struct ProgramLoader { /* private fields */ }Expand description
Prepares helper tables and loads eBPF programs.
Implementations§
Source§impl ProgramLoader
impl ProgramLoader
Sourcepub fn new(
rng: &mut impl Rng,
event_listener: Arc<dyn ProgramEventListener>,
raw_helpers: &[&[(&'static str, Helper)]],
) -> Self
pub fn new( rng: &mut impl Rng, event_listener: Arc<dyn ProgramEventListener>, raw_helpers: &[&[(&'static str, Helper)]], ) -> Self
Creates a new ProgramLoader to load eBPF code.
Sourcepub fn with_code_size_limit(self, limit: usize) -> Self
pub fn with_code_size_limit(self, limit: usize) -> Self
Sets the maximum total size of JIT-compiled native code per program.
Must be a non-zero multiple of 64 KiB so the code region stays page-aligned on all supported page sizes.
Note for arm64: conditional branches and literal loads emitted by the JIT have a ±1 MiB range, and a section’s helper calls reference a literal pool at the end of that section’s code. Any single ELF section whose jitted code exceeds ~1 MiB is therefore rejected at load time (“ubpf: code translation failed”) regardless of this limit; raising it past 1 MiB only adds room for more or larger sections within that per-section ceiling. x86-64 has no such per-section constraint.
Auto Trait Implementations§
impl !RefUnwindSafe for ProgramLoader
impl !UnwindSafe for ProgramLoader
impl Freeze for ProgramLoader
impl Send for ProgramLoader
impl Sync for ProgramLoader
impl Unpin for ProgramLoader
impl UnsafeUnpin for ProgramLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more