mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Fix syntax - make more pythonic
This commit is contained in:
@ -1,9 +1,11 @@
|
|||||||
from pythonbpf.decorators import tracepoint
|
from pythonbpf.decorators import tracepoint, syscalls
|
||||||
from ctypes import c_void_p, c_int32
|
from ctypes import c_void_p, c_int32
|
||||||
|
|
||||||
@tracepoint("syscalls:sys_enter_execve")
|
|
||||||
|
@tracepoint(syscalls.sys_enter_execve)
|
||||||
def trace_execve(ctx: c_void_p) -> c_int32:
|
def trace_execve(ctx: c_void_p) -> c_int32:
|
||||||
print("execve called\n")
|
print("execve called")
|
||||||
return c_int32(0)
|
return c_int32(0)
|
||||||
|
|
||||||
|
|
||||||
LICENSE = "GPL"
|
LICENSE = "GPL"
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
|
syscalls = SimpleNamespace(
|
||||||
|
sys_enter_execve="syscalls:sys_enter_execve",
|
||||||
|
sys_exit_execve="syscalls:sys_exit_execve",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def tracepoint(name: str):
|
def tracepoint(name: str):
|
||||||
def wrapper(fn):
|
def wrapper(fn):
|
||||||
fn._section = f"tracepoint/{name}"
|
fn._section = f"tracepoint/{name}"
|
||||||
|
|||||||
Reference in New Issue
Block a user