diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-16 10:29:21 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-16 10:29:21 +0200 |
| commit | 8714956d6a45e65307e36afd57f86961bc7b142c (patch) | |
| tree | 3ab6f8cc45076235f8c96132f2700ba8d7b2955d /internal/ior.go | |
| parent | 191a8716a52a761f38550d4e58b14b9f5594d8ae (diff) | |
initial tracepoint filter
Diffstat (limited to 'internal/ior.go')
| -rw-r--r-- | internal/ior.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/ior.go b/internal/ior.go index 51ce2d1..f9635e5 100644 --- a/internal/ior.go +++ b/internal/ior.go @@ -17,8 +17,15 @@ import ( bpf "github.com/aquasecurity/libbpfgo" ) -func attachTracepoints(bpfModule *bpf.Module) error { +func attachTracepoints(bpfModule *bpf.Module, tracepointNames map[string]struct{}) error { + attachAll := len(tracepointNames) == 0 + for _, name := range tracepoints.List { + if _, ok := tracepointNames[name]; !ok && !attachAll { + // Not attaching tracepoint + continue + } + prog, err := bpfModule.GetProgram(fmt.Sprintf("handle_%s", name)) if err != nil { return fmt.Errorf("Failed to get BPF program handle_%s: %v", name, err) @@ -55,7 +62,7 @@ func Run(flags flags.Flags) { panic(err) } - if err := attachTracepoints(bpfModule); err != nil { + if err := attachTracepoints(bpfModule, flags.TracepointNames); err != nil { panic(err) } |
