diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-16 00:47:08 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-16 00:47:08 +0200 |
| commit | 02707dde82ed3030aa66d8155928f364cefe143d (patch) | |
| tree | 312c20bb8677597e4b2cf7f4195148bde7a74cd4 /internal/flags | |
| parent | 5818548de594c17e4b6f5cfc3cf25ae0702e2e3d (diff) | |
move flags to types
Diffstat (limited to 'internal/flags')
| -rw-r--r-- | internal/flags/flags.go | 13 |
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)) } |
