summaryrefslogtreecommitdiffstats
path: root/samples/bpf/trace_output_user.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-05-10 19:24:40 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2018-05-11 01:40:52 +0200
commitd0cabbb021bee5c4b831a0235af9534ad07f8d3d (patch)
tree7843337206d80588110d9112d49836624b09be64 /samples/bpf/trace_output_user.c
parentsamples: bpf: compile and link against full libbpf (diff)
downloadlinux-d0cabbb021bee5c4b831a0235af9534ad07f8d3d.tar.xz
linux-d0cabbb021bee5c4b831a0235af9534ad07f8d3d.zip
tools: bpf: move the event reading loop to libbpf
There are two copies of event reading loop - in bpftool and trace_helpers "library". Consolidate them and move the code to libbpf. Return codes from trace_helpers are kept, but renamed to include LIBBPF prefix. Suggested-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'samples/bpf/trace_output_user.c')
-rw-r--r--samples/bpf/trace_output_user.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/samples/bpf/trace_output_user.c b/samples/bpf/trace_output_user.c
index 5e78c2ecd08d..da98be721001 100644
--- a/samples/bpf/trace_output_user.c
+++ b/samples/bpf/trace_output_user.c
@@ -48,7 +48,7 @@ static int print_bpf_output(void *data, int size)
if (e->cookie != 0x12345678) {
printf("BUG pid %llx cookie %llx sized %d\n",
e->pid, e->cookie, size);
- return PERF_EVENT_ERROR;
+ return LIBBPF_PERF_EVENT_ERROR;
}
cnt++;
@@ -56,10 +56,10 @@ static int print_bpf_output(void *data, int size)
if (cnt == MAX_CNT) {
printf("recv %lld events per sec\n",
MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
- return PERF_EVENT_DONE;
+ return LIBBPF_PERF_EVENT_DONE;
}
- return PERF_EVENT_CONT;
+ return LIBBPF_PERF_EVENT_CONT;
}
static void test_bpf_perf_event(void)