From 7b0e8a2fca3787214d1b3a73aa8cea47daa92acc Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Mon, 6 Oct 2025 04:59:20 +0530 Subject: [PATCH] Add xdp example for passing return type --- tests/passing_tests/return/xdp.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/passing_tests/return/xdp.py diff --git a/tests/passing_tests/return/xdp.py b/tests/passing_tests/return/xdp.py new file mode 100644 index 0000000..3c0f5d8 --- /dev/null +++ b/tests/passing_tests/return/xdp.py @@ -0,0 +1,19 @@ +from pythonbpf import bpf, section, bpfglobal, compile +from ctypes import c_void_p, c_int64 +from pythonbpf.helper import XDP_PASS + + +@bpf +@section("tracepoint/syscalls/sys_enter_execve") +def hello_world(ctx: c_void_p) -> c_int64: + print("Hello, World!") + return XDP_PASS + + +@bpf +@bpfglobal +def LICENSE() -> str: + return "GPL" + + +compile()