Skip to content

Commit 18d62d6

Browse files
committed
Add hello_world BCC example
1 parent 27ab3aa commit 18d62d6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

BCC-Examples/hello_world.py

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

0 commit comments

Comments
 (0)