From cb11d60fcc0b382237070766ca5e03709423d610 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Fri, 19 Sep 2025 04:15:39 +0530 Subject: [PATCH] Add barebones python skeleton for kfuncs --- examples/execve4.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/execve4.py diff --git a/examples/execve4.py b/examples/execve4.py new file mode 100644 index 0000000..31dbd2d --- /dev/null +++ b/examples/execve4.py @@ -0,0 +1,28 @@ +from pythonbpf import bpf, map, section, bpfglobal, compile +from pythonbpf.helpers import ktime, deref +from pythonbpf.maps import HashMap + +from ctypes import c_void_p, c_int64, c_int32, c_uint64 + + +@bpf +@map +def last() -> HashMap: + return HashMap(key_type=c_uint64, value_type=c_uint64, max_entries=3) + + +@bpf +@section("blk_start_request") +def trace_start(ctx: c_void_p) -> c_int32: + ts = ktime() + print("req started") + return c_int32(0) + + +@bpf +@bpfglobal +def LICENSE() -> str: + return "GPL" + + +compile()