multiple map elements support

This commit is contained in:
2025-09-11 00:45:08 +05:30
parent 7de3a381b0
commit 431921dbc1
3 changed files with 18 additions and 4 deletions

View File

@ -8,7 +8,7 @@ struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u64);
__type(value, u64);
__uint(max_entries, 1);
__uint(max_entries, 4);
} last SEC(".maps");
// Handler for syscall entry

View File

@ -8,7 +8,7 @@ from ctypes import c_void_p, c_int64, c_int32, c_uint64
@bpf
@map
def last() -> HashMap:
return HashMap(key_type=c_uint64, value_type=c_uint64, max_entries=1)
return HashMap(key_type=c_uint64, value_type=c_uint64, max_entries=3)
@bpf
@ -37,7 +37,13 @@ def hello_again(ctx: c_void_p) -> c_int64:
if x:
print("we did not prevail")
ts = ktime()
last().update(key, ts, 0)
last().update(key, ts)
keys = 2
last().update(keys, ts)
key = 4
last().update(key, ts)
key = 5
last().update(key, ts)
return c_int64(0)