aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf/bpf_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'samples/bpf/bpf_load.c')
-rw-r--r--samples/bpf/bpf_load.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index 522ca9252d6c..242631aa4ea2 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -193,8 +193,18 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
193 return -1; 193 return -1;
194 } 194 }
195 event_fd[prog_cnt - 1] = efd; 195 event_fd[prog_cnt - 1] = efd;
196 ioctl(efd, PERF_EVENT_IOC_ENABLE, 0); 196 err = ioctl(efd, PERF_EVENT_IOC_ENABLE, 0);
197 ioctl(efd, PERF_EVENT_IOC_SET_BPF, fd); 197 if (err < 0) {
198 printf("ioctl PERF_EVENT_IOC_ENABLE failed err %s\n",
199 strerror(errno));
200 return -1;
201 }
202 err = ioctl(efd, PERF_EVENT_IOC_SET_BPF, fd);
203 if (err < 0) {
204 printf("ioctl PERF_EVENT_IOC_SET_BPF failed err %s\n",
205 strerror(errno));
206 return -1;
207 }
198 208
199 return 0; 209 return 0;
200} 210}