goto error;
}
-- snprintf(buf, sizeof(buf), "%c:%ss/%s %s", attach_type==BPF_PROBE_ENTRY ? 'p' : 'r',
++ snprintf(buf, sizeof(buf), "%c:%ss/%s %s", attach_type==probe_entry ? 'p' : 'r',
event_type, new_name, fn_name);
if (write(kfd, buf, strlen(buf)) < 0) {
if (errno == EINVAL)
goto error;
}
- n = snprintf(buf, sizeof(buf), "%c:%ss/%s %s:0x%lx", attach_type==BPF_PROBE_ENTRY ? 'p' : 'r',
- snprintf(buf, sizeof(buf), "%c:%ss/%s %s:0x%lx", attach_type==BPF_PROBE_ENTRY ? 'p' : 'r',
++ n = snprintf(buf, sizeof(buf), "%c:%ss/%s %s:0x%lx", attach_type==probe_entry ? 'p' : 'r',
event_type, new_name, binary_path, offset);
+ if (n >= sizeof(buf)) {
+ close(kfd);
+ goto error;
+ }
if (write(kfd, buf, strlen(buf)) < 0) {
if (errno == EINVAL)
fprintf(stderr, "check dmesg output for possible cause\n");
extern "C" {
#endif
-#define BPF_PROBE_ENTRY 0
-#define BPF_PROBE_RETURN 1
+enum bpf_probe_attach_type {
+ probe_entry,
+ probe_return
+};
- #define BPF_PROBE_ENTRY 0
- #define BPF_PROBE_RETURN 1
int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
int max_entries, int map_flags);
void *callchain);
typedef void (*perf_reader_raw_cb)(void *cb_cookie, void *raw, int raw_size);
- void * bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type, const char *ev_name,
-void * bpf_attach_kprobe(int progfd, int attach_type, const char *ev_name,
-- const char *fn_name,
++void * bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type,
++ const char *ev_name, const char *fn_name,
pid_t pid, int cpu, int group_fd,
perf_reader_cb cb, void *cb_cookie);
int bpf_detach_kprobe(const char *ev_name);
- void * bpf_attach_uprobe(int progfd, enum bpf_probe_attach_type attach_type, const char *ev_name,
-void * bpf_attach_uprobe(int progfd, int attach_type, const char *ev_name,
-- const char *binary_path, uint64_t offset,
++void * bpf_attach_uprobe(int progfd, enum bpf_probe_attach_type attach_type,
++ const char *ev_name, const char *binary_path, uint64_t offset,
pid_t pid, int cpu, int group_fd,
perf_reader_cb cb, void *cb_cookie);