mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Fix passing test hash_map_struct to include char array test
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
from pythonbpf import bpf, section, struct, bpfglobal, compile, map
|
from pythonbpf import bpf, section, struct, bpfglobal, compile, map
|
||||||
from pythonbpf.maps import HashMap
|
from pythonbpf.maps import HashMap
|
||||||
from pythonbpf.helper import pid
|
from pythonbpf.helper import pid, comm
|
||||||
from ctypes import c_void_p, c_int64
|
from ctypes import c_void_p, c_int64
|
||||||
|
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ from ctypes import c_void_p, c_int64
|
|||||||
class val_type:
|
class val_type:
|
||||||
counter: c_int64
|
counter: c_int64
|
||||||
shizzle: c_int64
|
shizzle: c_int64
|
||||||
|
comm: str(16)
|
||||||
|
|
||||||
|
|
||||||
@bpf
|
@bpf
|
||||||
@ -22,6 +23,7 @@ def last() -> HashMap:
|
|||||||
def hello_world(ctx: c_void_p) -> c_int64:
|
def hello_world(ctx: c_void_p) -> c_int64:
|
||||||
obj = val_type()
|
obj = val_type()
|
||||||
obj.counter, obj.shizzle = 42, 96
|
obj.counter, obj.shizzle = 42, 96
|
||||||
|
comm(obj.comm)
|
||||||
t = last.lookup(obj)
|
t = last.lookup(obj)
|
||||||
if t:
|
if t:
|
||||||
print(f"Found existing entry: counter={obj.counter}, pid={t}")
|
print(f"Found existing entry: counter={obj.counter}, pid={t}")
|
||||||
|
|||||||
Reference in New Issue
Block a user