libbpf: add ability to attach/detach BPF program to perf event
authorAndrii Nakryiko <andriin@fb.com>
Mon, 1 Jul 2019 23:58:57 +0000 (16:58 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 5 Jul 2019 20:37:30 +0000 (22:37 +0200)
commit63f2f5ee856ba9db751123bc5519be099a3849a7
tree27a5a6a7e50f876ec260de8ac1c9fa4bd46f11ae
parent1c2e9efc26f389effc86e9b4d41f85d101f17629
libbpf: add ability to attach/detach BPF program to perf event

bpf_program__attach_perf_event allows to attach BPF program to existing
perf event hook, providing most generic and most low-level way to attach BPF
programs. It returns struct bpf_link, which should be passed to
bpf_link__destroy to detach and free resources, associated with a link.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map