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>
This commit is contained in:
Jakub Kicinski
2018-05-10 10:24:40 -07:00
committed by Daniel Borkmann
parent 5f9380572b
commit d0cabbb021
10 changed files with 138 additions and 122 deletions

View File

@@ -1337,12 +1337,12 @@ static int get_stack_print_output(void *data, int size)
good_user_stack = true;
}
if (!good_kern_stack || !good_user_stack)
return PERF_EVENT_ERROR;
return LIBBPF_PERF_EVENT_ERROR;
if (cnt == MAX_CNT_RAWTP)
return PERF_EVENT_DONE;
return LIBBPF_PERF_EVENT_DONE;
return PERF_EVENT_CONT;
return LIBBPF_PERF_EVENT_CONT;
}
static void test_get_stack_raw_tp(void)