add compile command

This commit is contained in:
2025-09-09 16:48:05 +05:30
parent b474dfccdd
commit 05c398dc21
3 changed files with 32 additions and 11 deletions

View File

@ -1,25 +1,25 @@
from pythonbpf.decorators import bpf, map, section, bpfglobal
from ctypes import c_void_p, c_int64, c_int32, c_uint64
import pythonbpf as pb
from pythonbpf.helpers import bpf_ktime_get_ns
from pythonbpf.maps import HashMap
from ctypes import c_void_p, c_int64, c_int32, c_uint64
@bpf
@map
@pb.bpf
@pb.map
def last() -> HashMap:
return HashMap(key_type=c_uint64, value_type=c_uint64, max_entries=1)
@bpf
@section("tracepoint/syscalls/sys_enter_execve")
@pb.bpf
@pb.section("tracepoint/syscalls/sys_enter_execve")
def hello(ctx: c_void_p) -> c_int32:
print("entered")
print("multi constant support")
return c_int32(0)
@bpf
@section("tracepoint/syscalls/sys_exit_execve")
@pb.bpf
@pb.section("tracepoint/syscalls/sys_exit_execve")
def hello_again(ctx: c_void_p) -> c_int64:
print("exited")
key = 0
@ -34,7 +34,9 @@ def hello_again(ctx: c_void_p) -> c_int64:
return c_int64(0)
@bpf
@bpfglobal
@pb.bpf
@pb.bpfglobal
def LICENSE() -> str:
return "GPL"
pb.compile()