mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
743 B
Rust
34 lines
743 B
Rust
1 year ago
|
#![no_std]
|
||
|
#![no_main]
|
||
|
|
||
|
use aya_ebpf::{
|
||
|
macros::{map, raw_tracepoint},
|
||
|
maps::Array,
|
||
|
programs::RawTracePointContext,
|
||
|
};
|
||
|
use integration_common::raw_tracepoint::SysEnterEvent;
|
||
|
|
||
|
#[map]
|
||
|
static RESULT: Array<SysEnterEvent> = Array::with_max_entries(1, 0);
|
||
|
|
||
|
#[raw_tracepoint(tracepoint = "sys_enter")]
|
||
|
pub fn sys_enter(ctx: RawTracePointContext) -> i32 {
|
||
|
let common_type: u16 = unsafe { ctx.arg(0) };
|
||
|
let common_flags: u8 = unsafe { ctx.arg(1) };
|
||
|
|
||
|
if let Some(ptr) = RESULT.get_ptr_mut(0) {
|
||
|
unsafe {
|
||
|
(*ptr).common_type = common_type;
|
||
|
(*ptr).common_flags = common_flags;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
0
|
||
|
}
|
||
|
|
||
|
#[cfg(not(test))]
|
||
|
#[panic_handler]
|
||
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||
|
loop {}
|
||
|
}
|