summaryrefslogtreecommitdiff
path: root/internal/ioriotng.bpf.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-17 14:12:01 +0200
committerPaul Buetow <paul@buetow.org>2024-02-17 14:12:01 +0200
commitc3a41ac0cb15d3f2665d75051260c1909b434548 (patch)
tree561ac1b4ba53d465d86e6a49c68ef8e68984b7ce /internal/ioriotng.bpf.c
parent08f7a9bfa2ade822fd781609f63a4d71eee1b64e (diff)
using global variables for more efficient filtering of events
Diffstat (limited to 'internal/ioriotng.bpf.c')
-rw-r--r--internal/ioriotng.bpf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/internal/ioriotng.bpf.c b/internal/ioriotng.bpf.c
index 3296611..32b831a 100644
--- a/internal/ioriotng.bpf.c
+++ b/internal/ioriotng.bpf.c
@@ -4,11 +4,10 @@
#include <bpf/bpf_helpers.h>
#include "types/types.bpf.h"
#include "types/maps.bpf.h"
+#include "flags/flags.bpf.h"
static inline int filter() {
- u32 key = 1;
- struct flags *flagsp = bpf_map_lookup_elem(&flags_map, &key);
- return flagsp == NULL || (bpf_get_current_uid_gid() & 0xFFFFFFFF) != flagsp->uid_filter;
+ return (bpf_get_current_uid_gid() & 0xFFFFFFFF) != UID_FILTER;
}
SEC("tracepoint/syscalls/sys_enter_openat")