Skip to content

Commit d891f2b

Browse files
captain5050acmel
authored andcommitted
perf build: Properly guard libbpf includes
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 <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Jiri Olsa <[email protected]> Tested-by: Mike Leach <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6f9aba7 commit d891f2b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tools/perf/builtin-trace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
#include "util/record.h"
1818
#include <api/fs/tracing_path.h>
19+
#ifdef HAVE_LIBBPF_SUPPORT
1920
#include <bpf/bpf.h>
21+
#endif
2022
#include "util/bpf_map.h"
2123
#include "util/rlimit.h"
2224
#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)