bpf: Add support for prog_name and map_name
This patch adds support for prog_name and map_name.
For libbpf.{h,c}, the new functions, bpf_prog_load_name()
and bpf_create_map_name() is created to avoid breaking the
existing libbpf.{a,so} user.
libbcc.py is also modified accordingly to reflect the
availability of the new functions in libbpf.
clang/b_frontend_action.cc, b/codegen_llvm.cc and BPF.cc are
modified to take advantage of the prog and map name also.
Run the following tests in new and old kernel (old kernel
in the sense that it does not support the prog/map name):
1) tools/trace.py -K sys_clone
2) examples/cpp/HelloWorld
Here is the output of the bpf (BPF Snapshot) that
will be introduced in the later patch:
[root@arch-fb-vm1 bcc]# ./tools/biosnoop.py
[root@arch-fb-vm1 bcc]# ./build/introspection/bps
BID TYPE UID #MAPS LoadTime NAME
113 kprobe 0 1 Oct20/13:11 trace_pid_start
114 kprobe 0 1 Oct20/13:11 trace_req_start
115 kprobe 0 3 Oct20/13:11 trace_req_compl
[root@arch-fb-vm1 bcc]# ./build/introspection/bps 113
BID TYPE UID #MAPS LoadTime NAME
113 kprobe 0 1 Oct20/13:11 trace_pid_start
MID TYPE FLAGS KeySz ValueSz MaxEnts NAME
186 hash 0x0 8 20 10240 infobyreq
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Showing
Please register or sign in to comment