diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ioriotng.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/ioriotng.go b/internal/ioriotng.go index ca2a02e..b34a5cf 100644 --- a/internal/ioriotng.go +++ b/internal/ioriotng.go @@ -10,6 +10,7 @@ import ( "log" "runtime" "sync" + "unsafe" "ioriotng/internal/debugfs" "ioriotng/internal/tracepoints" @@ -69,6 +70,22 @@ func resizeMap(module *bpf.Module, name string, size uint32) error { return nil } +func config(bpfModule *bpf.Module) error { + configMap, err := bpfModule.GetMap("config_map") + if err != nil { + return err + } + + config := struct { + UidFilter int32 + }{ + UidFilter: 1001, // TODO: Make configurable via flag, + } + + key := uint32(1) + return configMap.Update(unsafe.Pointer(&key), unsafe.Pointer(&config)) +} + func Run() { // To consider for implementation! log.Println(debugfs.TracepointsWithFd()) @@ -91,6 +108,10 @@ func Run() { log.Fatal(err) } + if err := config(bpfModule); err != nil { + log.Fatal(err) + } + if err := tracepoints.AttachSyscalls(bpfModule); err != nil { log.Fatal(err) } |
