tools/bpftool: show btf id in program information
Let's add a way to know whether a program has btf context. Patch adds 'btf_id' in the output of program listing. When btf_id is present, it means program has btf context. Sample output: user@test# bpftool prog list 25: xdp name xdp_prog1 tag 539ec6ce11b52f98 gpl loaded_at 2019-04-10T11:44:20+0900 uid 0 xlated 488B not jited memlock 4096B map_ids 23 btf_id 1 Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
d5adbdd77e
commit
569b0c7773
1 changed files with 6 additions and 0 deletions
|
@ -249,6 +249,9 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
|
||||||
if (info->nr_map_ids)
|
if (info->nr_map_ids)
|
||||||
show_prog_maps(fd, info->nr_map_ids);
|
show_prog_maps(fd, info->nr_map_ids);
|
||||||
|
|
||||||
|
if (info->btf_id)
|
||||||
|
jsonw_int_field(json_wtr, "btf_id", info->btf_id);
|
||||||
|
|
||||||
if (!hash_empty(prog_table.table)) {
|
if (!hash_empty(prog_table.table)) {
|
||||||
struct pinned_obj *obj;
|
struct pinned_obj *obj;
|
||||||
|
|
||||||
|
@ -319,6 +322,9 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->btf_id)
|
||||||
|
printf("\n\tbtf_id %d\n", info->btf_id);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue