Skip to content

Commit ad954cb

Browse files
Tao Chenanakryiko
authored andcommitted
bpftool: Display cookie for tracing link probe
Display cookie for tracing link probe, in plain mode: #bpftool link 5: tracing prog 34 prog_type tracing attach_type trace_fentry target_obj_id 1 target_btf_id 60355 cookie 4503599627370496 pids test_progs(176) And in json mode: #bpftool link -j | jq { "id": 5, "type": "tracing", "prog_id": 34, "prog_type": "tracing", "attach_type": "trace_fentry", "target_obj_id": 1, "target_btf_id": 60355, "cookie": 4503599627370496, "pids": [ { "pid": 176, "comm": "test_progs" } ] } Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent d77efc0 commit ad954cb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/bpf/bpftool/link.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
503503
json_wtr);
504504
jsonw_uint_field(json_wtr, "target_obj_id", info->tracing.target_obj_id);
505505
jsonw_uint_field(json_wtr, "target_btf_id", info->tracing.target_btf_id);
506+
jsonw_uint_field(json_wtr, "cookie", info->tracing.cookie);
506507
break;
507508
case BPF_LINK_TYPE_CGROUP:
508509
jsonw_lluint_field(json_wtr, "cgroup_id",
@@ -900,6 +901,8 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
900901
printf("\n\ttarget_obj_id %u target_btf_id %u ",
901902
info->tracing.target_obj_id,
902903
info->tracing.target_btf_id);
904+
if (info->tracing.cookie)
905+
printf("\n\tcookie %llu ", info->tracing.cookie);
903906
break;
904907
case BPF_LINK_TYPE_CGROUP:
905908
printf("\n\tcgroup_id %zu ", (size_t)info->cgroup.cgroup_id);

0 commit comments

Comments
 (0)