pub trait KernelAuxiliaryOps:
Send
+ Sync
+ 'static {
Show 14 methods
// Required methods
fn get_unified_map_from_ptr<F, R>(ptr: *const u8, func: F) -> LinuxResult<R>
where F: FnOnce(&mut UnifiedMap) -> LinuxResult<R>;
fn get_unified_map_from_fd<F, R>(map_fd: u32, func: F) -> LinuxResult<R>
where F: FnOnce(&mut UnifiedMap) -> LinuxResult<R>;
fn get_unified_map_ptr_from_fd(map_fd: u32) -> LinuxResult<*const u8>;
fn copy_from_user(
src: *const u8,
size: usize,
dst: &mut [u8],
) -> LinuxResult<()>;
fn copy_to_user(dest: *mut u8, size: usize, src: &[u8]) -> LinuxResult<()>;
fn current_cpu_id() -> u32;
fn perf_event_output(
ctx: *mut c_void,
fd: u32,
flags: u32,
data: &[u8],
) -> LinuxResult<()>;
fn string_from_user_cstr(ptr: *const u8) -> LinuxResult<String>;
fn ebpf_write_str(str: &str) -> LinuxResult<()>;
fn ebpf_time_ns() -> LinuxResult<u64>;
fn alloc_page() -> LinuxResult<usize>;
fn free_page(phys_addr: usize);
fn vmap(phys_addrs: &[usize]) -> LinuxResult<usize>;
fn unmap(vaddr: usize);
}Expand description
The KernelAuxiliaryOps trait provides auxiliary operations which should be implemented by the kernel or a kernel-like environment.
Required Methods§
Sourcefn get_unified_map_from_ptr<F, R>(ptr: *const u8, func: F) -> LinuxResult<R>
fn get_unified_map_from_ptr<F, R>(ptr: *const u8, func: F) -> LinuxResult<R>
Get a unified map from a pointer.
Sourcefn get_unified_map_from_fd<F, R>(map_fd: u32, func: F) -> LinuxResult<R>
fn get_unified_map_from_fd<F, R>(map_fd: u32, func: F) -> LinuxResult<R>
Get a unified map from a file descriptor.
Sourcefn get_unified_map_ptr_from_fd(map_fd: u32) -> LinuxResult<*const u8>
fn get_unified_map_ptr_from_fd(map_fd: u32) -> LinuxResult<*const u8>
Get a unified map pointer from a file descriptor.
Sourcefn copy_from_user(
src: *const u8,
size: usize,
dst: &mut [u8],
) -> LinuxResult<()>
fn copy_from_user( src: *const u8, size: usize, dst: &mut [u8], ) -> LinuxResult<()>
Copy data from a user space pointer to a kernel space buffer.
Sourcefn copy_to_user(dest: *mut u8, size: usize, src: &[u8]) -> LinuxResult<()>
fn copy_to_user(dest: *mut u8, size: usize, src: &[u8]) -> LinuxResult<()>
Copy data from a kernel space buffer to a user space pointer.
Sourcefn current_cpu_id() -> u32
fn current_cpu_id() -> u32
Get the current CPU ID.
Sourcefn perf_event_output(
ctx: *mut c_void,
fd: u32,
flags: u32,
data: &[u8],
) -> LinuxResult<()>
fn perf_event_output( ctx: *mut c_void, fd: u32, flags: u32, data: &[u8], ) -> LinuxResult<()>
Output some data to a perf buf
Sourcefn string_from_user_cstr(ptr: *const u8) -> LinuxResult<String>
fn string_from_user_cstr(ptr: *const u8) -> LinuxResult<String>
Read a string from a user space pointer.
Sourcefn ebpf_write_str(str: &str) -> LinuxResult<()>
fn ebpf_write_str(str: &str) -> LinuxResult<()>
For ebpf print helper functions
Sourcefn ebpf_time_ns() -> LinuxResult<u64>
fn ebpf_time_ns() -> LinuxResult<u64>
For ebpf ktime helper functions
Sourcefn alloc_page() -> LinuxResult<usize>
fn alloc_page() -> LinuxResult<usize>
Allocate pages in kernel space. Return the physical address of the allocated page.
Sourcefn vmap(phys_addrs: &[usize]) -> LinuxResult<usize>
fn vmap(phys_addrs: &[usize]) -> LinuxResult<usize>
Create a virtual mapping for the given physical addresses. Return the virtual address.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.