Skip to content

Commit 0bf5260

Browse files
captain5050gregkh
authored andcommitted
perf build: Properly guard libbpf includes
[ Upstream commit d891f2b ] Including libbpf header files should be guarded by HAVE_LIBBPF_SUPPORT. In bpf_counter.h, move the skeleton utilities under HAVE_BPF_SKEL. Fixes: d6a735e ("perf bpf_counter: Move common functions to bpf_counter.h") Reported-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Mike Leach <mike.leach@linaro.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20230105172243.7238-1-mike.leach@linaro.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 205f35e commit 0bf5260

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

tools/perf/builtin-trace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include "util/record.h"
1818
#include <traceevent/event-parse.h>
1919
#include <api/fs/tracing_path.h>
20+
#ifdef HAVE_LIBBPF_SUPPORT
2021
#include <bpf/bpf.h>
22+
#endif
2123
#include "util/bpf_map.h"
2224
#include "util/rlimit.h"
2325
#include "builtin.h"

tools/perf/util/bpf_counter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
#include <linux/list.h>
66
#include <sys/resource.h>
7+
8+
#ifdef HAVE_LIBBPF_SUPPORT
79
#include <bpf/bpf.h>
810
#include <bpf/btf.h>
911
#include <bpf/libbpf.h>
12+
#endif
1013

1114
struct evsel;
1215
struct target;
@@ -87,6 +90,8 @@ static inline void set_max_rlimit(void)
8790
setrlimit(RLIMIT_MEMLOCK, &rinf);
8891
}
8992

93+
#ifdef HAVE_BPF_SKEL
94+
9095
static inline __u32 bpf_link_get_id(int fd)
9196
{
9297
struct bpf_link_info link_info = { .id = 0, };
@@ -127,5 +132,6 @@ static inline int bperf_trigger_reading(int prog_fd, int cpu)
127132

128133
return bpf_prog_test_run_opts(prog_fd, &opts);
129134
}
135+
#endif /* HAVE_BPF_SKEL */
130136

131137
#endif /* __PERF_BPF_COUNTER_H */

0 commit comments

Comments
 (0)