@@ -1881,4 +1881,7 @@ static inline void perf_lopwr_cb(bool mode)
}
#endif
+int perf_type_kprobe(void);
+int perf_type_uprobe(void);
+
#endif /* _LINUX_PERF_EVENT_H */
@@ -10456,6 +10456,24 @@ static inline bool perf_event_is_tracing(struct perf_event *event)
return false;
}
+int perf_type_kprobe(void)
+{
+#ifdef CONFIG_KPROBE_EVENTS
+ return perf_kprobe.type;
+#else
+ return -EOPNOTSUPP;
+#endif
+}
+
+int perf_type_uprobe(void)
+{
+#ifdef CONFIG_UPROBE_EVENTS
+ return perf_uprobe.type;
+#else
+ return -EOPNOTSUPP;
+#endif
+}
+
int perf_event_set_bpf_prog(struct perf_event *event, struct bpf_prog *prog,
u64 bpf_cookie)
{
Add perf_type_uprobe() to get the perf_type of uprobe and perf_type_kprobe() to get the perf_type of kprobe. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> --- include/linux/perf_event.h | 3 +++ kernel/events/core.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)