Skip to content

Commit 1843ca6

Browse files
committed
Add failing struct_ptr test for conditionals
1 parent caa5d92 commit 1843ca6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pythonbpf import bpf, struct, section, bpfglobal, compile
2+
from ctypes import c_void_p, c_int64, c_uint64
3+
4+
5+
@bpf
6+
@struct
7+
class data_t:
8+
pid: c_uint64
9+
ts: c_uint64
10+
11+
12+
@bpf
13+
@section("tracepoint/syscalls/sys_enter_execve")
14+
def hello_world(ctx: c_void_p) -> c_int64:
15+
dat = data_t()
16+
if dat:
17+
print("Hello, World!")
18+
else:
19+
print("Goodbye, World!")
20+
return
21+
22+
23+
@bpf
24+
@bpfglobal
25+
def LICENSE() -> str:
26+
return "GPL"
27+
28+
29+
compile()

0 commit comments

Comments
 (0)