bpftool: Use a local copy of BPF_LINK_TYPE_PERF_EVENT in pid_iter.bpf.c
authorQuentin Monnet <quentin@isovalent.com>
Fri, 7 Jul 2023 09:54:24 +0000 (10:54 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 10 Jul 2023 22:29:20 +0000 (15:29 -0700)
commit44ba7b30e84fb40da2295e85a6d209e199fdc977
treeda2a7c18986fd6c0bdb576626c74794dcc31ca1c
parent67a43462ee2405c94e985a747bdcb8e3a0d66203
bpftool: Use a local copy of BPF_LINK_TYPE_PERF_EVENT in pid_iter.bpf.c

In order to allow the BPF program in bpftool's pid_iter.bpf.c to compile
correctly on hosts where vmlinux.h does not define
BPF_LINK_TYPE_PERF_EVENT (running kernel versions lower than 5.15, for
example), define and use a local copy of the enum value. This requires
LLVM 12 or newer to build the BPF program.

Fixes: cbdaf71f7e65 ("bpftool: Add bpf_cookie to link output")
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230707095425.168126-4-quentin@isovalent.com
tools/bpf/bpftool/skeleton/pid_iter.bpf.c