perf build: Properly guard libbpf includes
[ Upstream commitd891f2b724
] Including libbpf header files should be guarded by HAVE_LIBBPF_SUPPORT. In bpf_counter.h, move the skeleton utilities under HAVE_BPF_SKEL. Fixes:d6a735ef32
("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>
This commit is contained in:
parent
c8ca0ad10d
commit
d4bc9f017f
|
@ -17,7 +17,9 @@
|
||||||
#include "util/record.h"
|
#include "util/record.h"
|
||||||
#include <traceevent/event-parse.h>
|
#include <traceevent/event-parse.h>
|
||||||
#include <api/fs/tracing_path.h>
|
#include <api/fs/tracing_path.h>
|
||||||
|
#ifdef HAVE_LIBBPF_SUPPORT
|
||||||
#include <bpf/bpf.h>
|
#include <bpf/bpf.h>
|
||||||
|
#endif
|
||||||
#include "util/bpf_map.h"
|
#include "util/bpf_map.h"
|
||||||
#include "util/rlimit.h"
|
#include "util/rlimit.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
|
|
@ -4,9 +4,12 @@
|
||||||
|
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBBPF_SUPPORT
|
||||||
#include <bpf/bpf.h>
|
#include <bpf/bpf.h>
|
||||||
#include <bpf/btf.h>
|
#include <bpf/btf.h>
|
||||||
#include <bpf/libbpf.h>
|
#include <bpf/libbpf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct evsel;
|
struct evsel;
|
||||||
struct target;
|
struct target;
|
||||||
|
@ -87,6 +90,8 @@ static inline void set_max_rlimit(void)
|
||||||
setrlimit(RLIMIT_MEMLOCK, &rinf);
|
setrlimit(RLIMIT_MEMLOCK, &rinf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BPF_SKEL
|
||||||
|
|
||||||
static inline __u32 bpf_link_get_id(int fd)
|
static inline __u32 bpf_link_get_id(int fd)
|
||||||
{
|
{
|
||||||
struct bpf_link_info link_info = { .id = 0, };
|
struct bpf_link_info link_info = { .id = 0, };
|
||||||
|
@ -127,5 +132,6 @@ static inline int bperf_trigger_reading(int prog_fd, int cpu)
|
||||||
|
|
||||||
return bpf_prog_test_run_opts(prog_fd, &opts);
|
return bpf_prog_test_run_opts(prog_fd, &opts);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_BPF_SKEL */
|
||||||
|
|
||||||
#endif /* __PERF_BPF_COUNTER_H */
|
#endif /* __PERF_BPF_COUNTER_H */
|
||||||
|
|
Loading…
Reference in New Issue