Skip to content

Commit c4c2dd0

Browse files
Tao Chenqmonnet
authored andcommitted
bpftool: Display cookie for raw_tp link probe
Display cookie for raw_tp link probe, in plain mode: #bpftool link 22: raw_tracepoint prog 14 tp 'sys_enter' cookie 23925373020405760 pids test_progs(176) And in json mode: #bpftool link -j | jq [ { "id": 47, "type": "raw_tracepoint", "prog_id": 79, "tp_name": "sys_enter", "cookie": 23925373020405760, "pids": [ { "pid": 274, "comm": "test_progs" } ] } ] Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent c6eb3e4 commit c4c2dd0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/link.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
485485
case BPF_LINK_TYPE_RAW_TRACEPOINT:
486486
jsonw_string_field(json_wtr, "tp_name",
487487
u64_to_ptr(info->raw_tracepoint.tp_name));
488+
jsonw_uint_field(json_wtr, "cookie", info->raw_tracepoint.cookie);
488489
break;
489490
case BPF_LINK_TYPE_TRACING:
490491
err = get_prog_info(info->prog_id, &prog_info);
@@ -879,6 +880,8 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
879880
case BPF_LINK_TYPE_RAW_TRACEPOINT:
880881
printf("\n\ttp '%s' ",
881882
(const char *)u64_to_ptr(info->raw_tracepoint.tp_name));
883+
if (info->raw_tracepoint.cookie)
884+
printf("cookie %llu ", info->raw_tracepoint.cookie);
882885
break;
883886
case BPF_LINK_TYPE_TRACING:
884887
err = get_prog_info(info->prog_id, &prog_info);

0 commit comments

Comments
 (0)