summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
-rw-r--r--tools/bpf/bpftool/prog.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index f633299b1261..48c2fa4d068e 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -84,6 +84,8 @@ static const char * const attach_type_strings[] = {
[__MAX_BPF_ATTACH_TYPE] = NULL,
};
+static struct pinned_obj_table prog_table;
+
static enum bpf_attach_type parse_attach_type(const char *str)
{
enum bpf_attach_type type;
@@ -567,8 +569,10 @@ static int do_show(int argc, char **argv)
int err;
int fd;
- if (show_pinned)
+ if (show_pinned) {
+ hash_init(prog_table.table);
build_pinned_obj_table(&prog_table, BPF_OBJ_PROG);
+ }
build_obj_refs_table(&refs_table, BPF_OBJ_PROG);
if (argc == 2)
@@ -613,6 +617,9 @@ static int do_show(int argc, char **argv)
delete_obj_refs_table(&refs_table);
+ if (show_pinned)
+ delete_pinned_obj_table(&prog_table);
+
return err;
}