0001
0002
0003
0004
0005
0006 #ifndef __BPF_PROLOGUE_H
0007 #define __BPF_PROLOGUE_H
0008
0009 #include <linux/compiler.h>
0010 #include <linux/filter.h>
0011 #include "probe-event.h"
0012
0013 #define BPF_PROLOGUE_MAX_ARGS 3
0014 #define BPF_PROLOGUE_START_ARG_REG BPF_REG_3
0015 #define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2
0016
0017 #ifdef HAVE_BPF_PROLOGUE
0018 int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
0019 struct bpf_insn *new_prog, size_t *new_cnt,
0020 size_t cnt_space);
0021 #else
0022 #include <errno.h>
0023
0024 static inline int
0025 bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
0026 int nargs __maybe_unused,
0027 struct bpf_insn *new_prog __maybe_unused,
0028 size_t *new_cnt,
0029 size_t cnt_space __maybe_unused)
0030 {
0031 if (!new_cnt)
0032 return -EINVAL;
0033 *new_cnt = 0;
0034 return -ENOTSUP;
0035 }
0036 #endif
0037 #endif