mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
24a6034acc
To reduce the reliance of trace samples (trace*_user) on bpf_load, move read_trace_pipe to trace_helpers. By moving this bpf_loader helper elsewhere, trace functions can be easily migrated to libbbpf. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200321100424.1593964-2-danieltimlee@gmail.com
27 lines
467 B
C
27 lines
467 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <stdio.h>
|
|
#include <linux/bpf.h>
|
|
#include <unistd.h>
|
|
#include <bpf/bpf.h>
|
|
#include "bpf_load.h"
|
|
#include "trace_helpers.h"
|
|
|
|
int main(int ac, char **argv)
|
|
{
|
|
FILE *f;
|
|
char filename[256];
|
|
|
|
snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
|
|
|
|
if (load_bpf_file(filename)) {
|
|
printf("%s", bpf_log_buf);
|
|
return 1;
|
|
}
|
|
|
|
f = popen("taskset 1 ping -c5 localhost", "r");
|
|
(void) f;
|
|
|
|
read_trace_pipe();
|
|
|
|
return 0;
|
|
}
|