xref: /linux/tools/perf/util/trace_augment.h (revision 559e1b470d32751b08a6f986451448625d5af09f)
1 #ifndef TRACE_AUGMENT_H
2 #define TRACE_AUGMENT_H
3 
4 #include <linux/compiler.h>
5 #include <stdbool.h>
6 #include <sys/types.h>
7 
8 struct bpf_program;
9 struct evlist;
10 struct perf_thread_map;
11 
12 #ifdef HAVE_BPF_SKEL
13 
14 int augmented_syscalls__prepare(void);
15 int augmented_syscalls__attach(void);
16 int augmented_syscalls__create_bpf_output(struct evlist *evlist);
17 void augmented_syscalls__setup_bpf_output(void);
18 int augmented_syscalls__set_filter_pids(unsigned int nr, pid_t *pids);
19 void augmented_syscalls__set_target_pids(struct perf_thread_map *threads, bool inherit,
20 					 bool uses_tgid, bool on_exec);
21 int augmented_syscalls__lost_tasks(void);
22 int augmented_syscalls__get_map_fds(int *enter_fd, int *exit_fd, int *beauty_fd);
23 struct bpf_program *augmented_syscalls__find_by_title(const char *name);
24 struct bpf_program *augmented_syscalls__unaugmented_enter(void);
25 struct bpf_program *augmented_syscalls__unaugmented_exit(void);
26 void augmented_syscalls__cleanup(void);
27 
28 #else /* !HAVE_BPF_SKEL */
29 
30 static inline int augmented_syscalls__prepare(void)
31 {
32 	return -1;
33 }
34 
35 static inline int augmented_syscalls__attach(void)
36 {
37 	return 0;
38 }
39 
40 static inline int augmented_syscalls__create_bpf_output(struct evlist *evlist __maybe_unused)
41 {
42 	return -1;
43 }
44 
45 static inline void augmented_syscalls__setup_bpf_output(void)
46 {
47 }
48 
49 static inline int augmented_syscalls__set_filter_pids(unsigned int nr __maybe_unused,
50 						      pid_t *pids __maybe_unused)
51 {
52 	return 0;
53 }
54 
55 static inline void
56 augmented_syscalls__set_target_pids(struct perf_thread_map *threads __maybe_unused,
57 				    bool inherit __maybe_unused,
58 				    bool uses_tgid __maybe_unused,
59 				    bool on_exec __maybe_unused)
60 {
61 }
62 
63 static inline int augmented_syscalls__lost_tasks(void)
64 {
65 	return 0;
66 }
67 
68 static inline int augmented_syscalls__get_map_fds(int *enter_fd __maybe_unused,
69 						  int *exit_fd __maybe_unused,
70 						  int *beauty_fd __maybe_unused)
71 {
72 	return -1;
73 }
74 
75 static inline struct bpf_program *
76 augmented_syscalls__find_by_title(const char *name __maybe_unused)
77 {
78 	return NULL;
79 }
80 
81 static inline struct bpf_program *augmented_syscalls__unaugmented_enter(void)
82 {
83 	return NULL;
84 }
85 
86 static inline struct bpf_program *augmented_syscalls__unaugmented_exit(void)
87 {
88 	return NULL;
89 }
90 
91 static inline void augmented_syscalls__cleanup(void)
92 {
93 }
94 
95 #endif /* HAVE_BPF_SKEL */
96 
97 #endif
98