Skip to content

Commit

Permalink
Add BPFLink.Destroy (#69)
Browse files Browse the repository at this point in the history
There is currently no way to remove a BPF probe link with this library
so this patch adds support for the `bpf_link__destroy` function.
  • Loading branch information
derekparker authored Sep 3, 2021
1 parent 1d1da58 commit 29bc86e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libbpfgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ type BPFLink struct {
eventName string
}

func (l *BPFLink) Destroy() error {
ret := C.bpf_link__destroy(l.link)
if ret < 0 {
return syscall.Errno(-ret)
}
return nil
}

type PerfBuffer struct {
pb *C.struct_perf_buffer
bpfMap *BPFMap
Expand Down

0 comments on commit 29bc86e

Please sign in to comment.