Skip to content

Commit 7b0e8a2

Browse files
committed
Add xdp example for passing return type
1 parent 3e68d6d commit 7b0e8a2

File tree

1 file changed

+19
-0
lines changed
  • tests/passing_tests/return

1 file changed

+19
-0
lines changed

tests/passing_tests/return/xdp.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pythonbpf import bpf, section, bpfglobal, compile
2+
from ctypes import c_void_p, c_int64
3+
from pythonbpf.helper import XDP_PASS
4+
5+
6+
@bpf
7+
@section("tracepoint/syscalls/sys_enter_execve")
8+
def hello_world(ctx: c_void_p) -> c_int64:
9+
print("Hello, World!")
10+
return XDP_PASS
11+
12+
13+
@bpf
14+
@bpfglobal
15+
def LICENSE() -> str:
16+
return "GPL"
17+
18+
19+
compile()

0 commit comments

Comments
 (0)