mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
libbpf: Add support for bpf iter in light skeleton.
bpf iterator programs should use bpf_link_create to attach instead of bpf_raw_tracepoint_open like other tracing programs. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20220131220528.98088-2-alexei.starovoitov@gmail.com
This commit is contained in:
parent
533de4aea6
commit
42d1d53fed
1 changed files with 4 additions and 1 deletions
|
@ -384,7 +384,10 @@ static void codegen_attach_detach(struct bpf_object *obj, const char *obj_name)
|
||||||
printf("\tint fd = bpf_raw_tracepoint_open(\"%s\", prog_fd);\n", tp_name);
|
printf("\tint fd = bpf_raw_tracepoint_open(\"%s\", prog_fd);\n", tp_name);
|
||||||
break;
|
break;
|
||||||
case BPF_PROG_TYPE_TRACING:
|
case BPF_PROG_TYPE_TRACING:
|
||||||
printf("\tint fd = bpf_raw_tracepoint_open(NULL, prog_fd);\n");
|
if (bpf_program__expected_attach_type(prog) == BPF_TRACE_ITER)
|
||||||
|
printf("\tint fd = bpf_link_create(prog_fd, 0, BPF_TRACE_ITER, NULL);\n");
|
||||||
|
else
|
||||||
|
printf("\tint fd = bpf_raw_tracepoint_open(NULL, prog_fd);\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("\tint fd = ((void)prog_fd, 0); /* auto-attach not supported */\n");
|
printf("\tint fd = ((void)prog_fd, 0); /* auto-attach not supported */\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue