Skip to main content

KernelAuxiliaryOps

Trait KernelAuxiliaryOps 

Source
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§

Source

fn get_unified_map_from_ptr<F, R>(ptr: *const u8, func: F) -> LinuxResult<R>
where F: FnOnce(&mut UnifiedMap) -> LinuxResult<R>,

Get a unified map from a pointer.

Source

fn get_unified_map_from_fd<F, R>(map_fd: u32, func: F) -> LinuxResult<R>
where F: FnOnce(&mut UnifiedMap) -> LinuxResult<R>,

Get a unified map from a file descriptor.

Source

fn get_unified_map_ptr_from_fd(map_fd: u32) -> LinuxResult<*const u8>

Get a unified map pointer from a file descriptor.

Source

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.

Source

fn copy_to_user(dest: *mut u8, size: usize, src: &[u8]) -> LinuxResult<()>

Copy data from a kernel space buffer to a user space pointer.

Source

fn current_cpu_id() -> u32

Get the current CPU ID.

Source

fn perf_event_output( ctx: *mut c_void, fd: u32, flags: u32, data: &[u8], ) -> LinuxResult<()>

Output some data to a perf buf

Source

fn string_from_user_cstr(ptr: *const u8) -> LinuxResult<String>

Read a string from a user space pointer.

Source

fn ebpf_write_str(str: &str) -> LinuxResult<()>

For ebpf print helper functions

Source

fn ebpf_time_ns() -> LinuxResult<u64>

For ebpf ktime helper functions

Source

fn alloc_page() -> LinuxResult<usize>

Allocate pages in kernel space. Return the physical address of the allocated page.

Source

fn free_page(phys_addr: usize)

Free the allocated page in kernel space.

Source

fn vmap(phys_addrs: &[usize]) -> LinuxResult<usize>

Create a virtual mapping for the given physical addresses. Return the virtual address.

Source

fn unmap(vaddr: usize)

Unmap the given 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.

Implementors§