mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Implement bpf_get_current_comm_emitter
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from pythonbpf import bpf, map, struct, section, bpfglobal, compile
|
||||
from pythonbpf.helper import ktime, pid
|
||||
from pythonbpf.helper import ktime, pid, comm
|
||||
from pythonbpf.maps import PerfEventArray
|
||||
|
||||
from ctypes import c_void_p, c_int64, c_uint64
|
||||
@ -25,7 +25,7 @@ def hello(ctx: c_void_p) -> c_int64:
|
||||
dataobj = data_t()
|
||||
strobj = "hellohellohello"
|
||||
dataobj.pid, dataobj.ts = pid(), ktime()
|
||||
# get_curr_comm(dataobj.comm)
|
||||
comm(dataobj.comm)
|
||||
print(f"clone called at {dataobj.ts} by pid {dataobj.pid}, comm {strobj}")
|
||||
events.output(dataobj)
|
||||
return 0 # type: ignore [return-value]
|
||||
|
||||
Reference in New Issue
Block a user