summaryrefslogtreecommitdiff
path: root/internal/flags
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-16 00:47:08 +0200
committerPaul Buetow <paul@buetow.org>2024-02-16 00:47:08 +0200
commit02707dde82ed3030aa66d8155928f364cefe143d (patch)
tree312c20bb8677597e4b2cf7f4195148bde7a74cd4 /internal/flags
parent5818548de594c17e4b6f5cfc3cf25ae0702e2e3d (diff)
move flags to types
Diffstat (limited to 'internal/flags')
-rw-r--r--internal/flags/flags.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go
index ac7abd4..d50410b 100644
--- a/internal/flags/flags.go
+++ b/internal/flags/flags.go
@@ -3,6 +3,7 @@ package flags
import (
"flag"
"fmt"
+ "ioriotng/internal/types"
"unsafe"
bpf "github.com/aquasecurity/libbpfgo"
@@ -17,6 +18,7 @@ func New() (flags Flags) {
flag.IntVar(&flags.UidFilter, "uid", 0, "Filter for processes with UID")
flag.IntVar(&flags.EventMapSize, "mapSize", 4096, "BPF FD event ring buffer map size")
flag.Parse()
+
return flags
}
@@ -26,13 +28,10 @@ func (flags Flags) SetBPF(bpfModule *bpf.Module) error {
return err
}
- flagsValues := struct {
- UidFilter int32
- }{
- UidFilter: int32(flags.UidFilter),
- }
-
- key := uint32(1)
+ var (
+ key = uint32(1)
+ flagsValues = types.FlagValues{uint32(flags.UidFilter)}
+ )
return flagsMap.Update(unsafe.Pointer(&key), unsafe.Pointer(&flagsValues))
}