mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
add alloc for only i64
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
BPF_CLANG := clang
|
||||
CFLAGS := -O2 -emit-llvm -target bpf -c
|
||||
CFLAGS := -O0 -emit-llvm -target bpf -c
|
||||
|
||||
SRC := $(wildcard *.bpf.c)
|
||||
LL := $(SRC:.bpf.c=.bpf.ll)
|
||||
|
||||
@ -17,7 +17,7 @@ def hello_world(ctx: struct_trace_event_raw_sys_enter) -> c_int64:
|
||||
a = 2 + TASK_COMM_LEN + TASK_COMM_LEN
|
||||
b = ctx.id
|
||||
print(f"Hello, World{TASK_COMM_LEN} and {a}")
|
||||
print(f"This is context field {b}")
|
||||
# print(f"This is context field {b}")
|
||||
return c_int64(TASK_COMM_LEN + 2)
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from pythonbpf import bpf, map, section, bpfglobal, compile, struct
|
||||
from pythonbpf import bpf, map, section, bpfglobal, compile, struct, compile_to_ir
|
||||
from ctypes import c_void_p, c_int64, c_int32, c_uint64
|
||||
from pythonbpf.maps import HashMap
|
||||
from pythonbpf.helper import ktime
|
||||
@ -70,5 +70,5 @@ def hello_world(ctx: c_void_p) -> c_int64:
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
|
||||
compile()
|
||||
compile_to_ir("comprehensive.py", "comprehensive.ll")
|
||||
# compile()
|
||||
|
||||
Reference in New Issue
Block a user