File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include <linux/bpf.h>
2+ #include <bpf/bpf_helpers.h>
3+
4+ #define u64 unsigned long long
5+
6+ // Define the map
7+ struct {
8+ __uint (type , BPF_MAP_TYPE_HASH );
9+ __type (key , u64 );
10+ __type (value , u64 );
11+ __uint (max_entries , 1 );
12+ } last SEC (".maps" );
13+
14+ // Handler for syscall entry
15+ SEC ("tracepoint/syscalls/sys_enter_execve" )
16+ int hello (void * ctx ) {
17+ bpf_printk ("entered" );
18+ bpf_printk ("multi constant support" );
19+ return 0 ;
20+ }
21+
22+ // Handler for syscall exit
23+ SEC ("tracepoint/syscalls/sys_exit_execve" )
24+ long hello_again (void * ctx ) {
25+ bpf_printk ("exited" );
26+
27+ // Create a key for map lookup
28+ u64 key = 0 ;
29+
30+ // Simple lookup without conditionals
31+ u64 * tsp = bpf_map_lookup_elem (& last , & key );
32+
33+ // Get current timestamp
34+ u64 ts = bpf_ktime_get_ns ();
35+
36+ return 0 ;
37+ }
38+
39+ char LICENSE [] SEC ("license" ) = "GPL" ;
You can’t perform that action at this time.
0 commit comments