diff options
author | Eelco Chaudron <echaudro@redhat.com> | 2020-02-20 13:26:35 +0000 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-02-20 17:48:40 -0800 |
commit | ff26ce5cd7680ebc9c5446cda013e2087decc60f (patch) | |
tree | 13503f7c233736c8f10bd27795597cb48012dd71 /tools/lib/bpf/libbpf.map | |
parent | dd88aed92d017bed2a2c0023f22f0eef7cd29702 (diff) |
libbpf: Add support for dynamic program attach target
Currently when you want to attach a trace program to a bpf program
the section name needs to match the tracepoint/function semantics.
However the addition of the bpf_program__set_attach_target() API
allows you to specify the tracepoint/function dynamically.
The call flow would look something like this:
xdp_fd = bpf_prog_get_fd_by_id(id);
trace_obj = bpf_object__open_file("func.o", NULL);
prog = bpf_object__find_program_by_title(trace_obj,
"fentry/myfunc");
bpf_program__set_expected_attach_type(prog, BPF_TRACE_FENTRY);
bpf_program__set_attach_target(prog, xdp_fd,
"xdpfilt_blk_all");
bpf_object__load(trace_obj)
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/158220519486.127661.7964708960649051384.stgit@xdp-tutorial
Diffstat (limited to 'tools/lib/bpf/libbpf.map')
-rw-r--r-- | tools/lib/bpf/libbpf.map | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map index 45be19c9d752..7b014c8cdece 100644 --- a/tools/lib/bpf/libbpf.map +++ b/tools/lib/bpf/libbpf.map @@ -237,4 +237,6 @@ LIBBPF_0.0.7 { } LIBBPF_0.0.6; LIBBPF_0.0.8 { + global: + bpf_program__set_attach_target; } LIBBPF_0.0.7; |