Move helper scripts to a new dir, make temp fixes to allow this

This commit is contained in:
Pragyansh Chaturvedi
2025-09-30 23:57:31 +05:30
parent fa2ff0a242
commit 7e45864552
6 changed files with 5 additions and 6 deletions

View File

@ -23,8 +23,6 @@ def events() -> PerfEventArray:
@section("tracepoint/syscalls/sys_enter_clone") @section("tracepoint/syscalls/sys_enter_clone")
def hello(ctx: c_void_p) -> c_int32: def hello(ctx: c_void_p) -> c_int32:
dataobj = data_t() dataobj = data_t()
ts = ktime()
process_id = pid()
strobj = "hellohellohello" strobj = "hellohellohello"
dataobj.pid = pid() dataobj.pid = pid()
dataobj.ts = ktime() dataobj.ts = ktime()

View File

@ -1,5 +1,5 @@
from pythonbpf import bpf, map, section, bpfglobal, compile from pythonbpf import bpf, map, section, bpfglobal, compile
from pythonbpf.helpers import ktime from pythonbpf.helper.helpers import ktime
from pythonbpf.maps import HashMap from pythonbpf.maps import HashMap
from ctypes import c_void_p, c_int64, c_uint64 from ctypes import c_void_p, c_int64, c_uint64
@ -10,6 +10,7 @@ from ctypes import c_void_p, c_int64, c_uint64
# 3. Run the program with sudo: sudo tools/check.sh run examples/sys_sync.o # 3. Run the program with sudo: sudo tools/check.sh run examples/sys_sync.o
# 4. Start a Python repl and `import os` and then keep entering `os.sync()` to see reponses. # 4. Start a Python repl and `import os` and then keep entering `os.sync()` to see reponses.
@bpf @bpf
@map @map
def last() -> HashMap: def last() -> HashMap:

View File

@ -23,7 +23,7 @@ def eval_expr(func, module, builder, expr, local_sym_tab, map_sym_tab, structs_s
return None return None
elif isinstance(expr, ast.Call): elif isinstance(expr, ast.Call):
# delayed import to avoid circular dependency # delayed import to avoid circular dependency
from .bpf_helper_handler import helper_func_list, handle_helper_call from .helper.bpf_helper_handler import helper_func_list, handle_helper_call
if isinstance(expr.func, ast.Name): if isinstance(expr.func, ast.Name):
# check deref # check deref

View File

@ -2,7 +2,7 @@ from llvmlite import ir
import ast import ast
from .bpf_helper_handler import helper_func_list, handle_helper_call from .helper.bpf_helper_handler import helper_func_list, handle_helper_call
from .type_deducer import ctypes_to_ir from .type_deducer import ctypes_to_ir
from .binary_ops import handle_binary_op from .binary_ops import handle_binary_op
from .expr_pass import eval_expr, handle_expr from .expr_pass import eval_expr, handle_expr

View File

@ -1,6 +1,6 @@
import ast import ast
from llvmlite import ir from llvmlite import ir
from .expr_pass import eval_expr from pythonbpf.expr_pass import eval_expr
from enum import Enum from enum import Enum