Skip to main content

KernelTraceOps

Trait KernelTraceOps 

Source
pub trait KernelTraceOps:
    Send
    + Sync
    + 'static {
    // Required methods
    fn current_pid() -> u32;
    fn trace_pipe_push_raw_record(buf: &[u8]);
    fn trace_cmdline_push(pid: u32);
    fn write_kernel_text(addr: *mut c_void, data: &[u8]);
    fn read_tracepoint_state<R>(
        id: u32,
        f: impl FnOnce(&ExtTracePoint<Self>) -> R,
    ) -> R;
    fn write_tracepoint_state<R>(
        id: u32,
        f: impl FnOnce(&mut ExtTracePoint<Self>) -> R,
    ) -> R;
}
Expand description

KernelTraceOps trait provides kernel-level operations for tracing.

Required Methods§

Source

fn current_pid() -> u32

Get the current process ID.

Source

fn trace_pipe_push_raw_record(buf: &[u8])

Push a raw record to the trace pipe.

Source

fn trace_cmdline_push(pid: u32)

Cache the process name for a given PID.

Source

fn write_kernel_text(addr: *mut c_void, data: &[u8])

Write data to kernel text memory.

Source

fn read_tracepoint_state<R>( id: u32, f: impl FnOnce(&ExtTracePoint<Self>) -> R, ) -> R

Access runtime state for a tracepoint ID.

Implementations may hold a read-side lock while executing f. The tracing fast path may call user callbacks from inside this closure, so callbacks must not call APIs that need write_tracepoint_state, such as callback registration, callback unregistration, or filter updates.

If the read-side implementation is non-reentrant, callbacks must also avoid recursively triggering tracepoints backed by the same state registry. Violating these restrictions may deadlock.

Implementations based on RCU, snapshots, or another non-blocking read-side mechanism may relax these restrictions.

Source

fn write_tracepoint_state<R>( id: u32, f: impl FnOnce(&mut ExtTracePoint<Self>) -> R, ) -> R

Mutably access runtime state for a tracepoint ID.

This is a management-path API. If read_tracepoint_state can execute callbacks while holding a read-side lock, this method must not be called from those callbacks.

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§