linux/tools/perf/util/trace_augment.h
Namhyung Kim f6109fb6f5 perf trace: Split BPF skel code to util/bpf_trace_augment.c
And make builtin-trace.c less conditional.  Dummy functions will be
called when BUILD_BPF_SKEL=0 is used.  This makes the builtin-trace.c
slightly smaller and simpler by removing the skeleton and its helpers.

The conditional guard of trace__init_syscalls_bpf_prog_array_maps() is
changed from the HAVE_BPF_SKEL to HAVE_LIBBPF_SUPPORT as it doesn't
have a skeleton in the code directly.  And a dummy function is added so
that it can be called unconditionally.  The function will succeed only
if the both conditions are true.

Do not include trace_augment.h from the BPF code and move the definition
of TRACE_AUG_MAX_BUF to the BPF directly.

Reviewed-by: Howard Chu <howardchu95@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20250623225721.21553-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2025-06-26 10:31:05 -07:00

66 lines
1.5 KiB
C

#ifndef TRACE_AUGMENT_H
#define TRACE_AUGMENT_H
#include <linux/compiler.h>
struct bpf_program;
struct evlist;
#ifdef HAVE_BPF_SKEL
int augmented_syscalls__prepare(void);
int augmented_syscalls__create_bpf_output(struct evlist *evlist);
void augmented_syscalls__setup_bpf_output(void);
int augmented_syscalls__set_filter_pids(unsigned int nr, pid_t *pids);
int augmented_syscalls__get_map_fds(int *enter_fd, int *exit_fd, int *beauty_fd);
struct bpf_program *augmented_syscalls__find_by_title(const char *name);
struct bpf_program *augmented_syscalls__unaugmented(void);
void augmented_syscalls__cleanup(void);
#else /* !HAVE_BPF_SKEL */
static inline int augmented_syscalls__prepare(void)
{
return -1;
}
static inline int augmented_syscalls__create_bpf_output(struct evlist *evlist __maybe_unused)
{
return -1;
}
static inline void augmented_syscalls__setup_bpf_output(void)
{
}
static inline int augmented_syscalls__set_filter_pids(unsigned int nr __maybe_unused,
pid_t *pids __maybe_unused)
{
return 0;
}
static inline int augmented_syscalls__get_map_fds(int *enter_fd __maybe_unused,
int *exit_fd __maybe_unused,
int *beauty_fd __maybe_unused)
{
return -1;
}
static inline struct bpf_program *
augmented_syscalls__find_by_title(const char *name __maybe_unused)
{
return NULL;
}
static inline struct bpf_program *augmented_syscalls__unaugmented(void)
{
return NULL;
}
static inline void augmented_syscalls__cleanup(void)
{
}
#endif /* HAVE_BPF_SKEL */
#endif