Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2: ebpf: replace deprecated prog.Attach/prog.Detach and fix closer
Caught by golangci-lint when enabling golint: v2/ebpf.go:45:12: SA1019: prog.Attach is deprecated: use link.RawAttachProgram instead. (staticcheck) if err := prog.Attach(dirFD, ebpf.AttachCGroupDevice, unix.BPF_F_ALLOW_MULTI); err != nil { ^ v2/ebpf.go:49:13: SA1019: prog.Detach is deprecated: use link.RawDetachProgram instead. (staticcheck) if err := prog.Detach(dirFD, ebpf.AttachCGroupDevice, unix.BPF_F_ALLOW_MULTI); err != nil { ^ worth noting that we currently call prog.Detach() with unix.BPF_F_ALLOW_MULTI; https://github.com/golang/sys/blob/22da62e12c0cd9c1da93581e1113ca4d82a5be14/unix/zerrors_linux.go#L178 BPF_F_ALLOW_MULTI = 0x2 Looking at the source code for prog.Detach(); https://github.com/cilium/ebpf/blob/v0.4.0/prog.go#L579-L581, this would _always_ produce an error: if flags != 0 { return errors.New("flags must be zero") } Note that the flags parameter is not used (except for that validation) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Loading branch information