History

bpf: Add cookie to raw_tp bpf_link_info

After commit 68ca5d4eebb8 ("bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs"), we can show the cookie in bpf_link_info like kprobe etc.

Tao Chen committed 1 year ago

Commit 2fe1c591 parent 7fdaba93 files · +5 −0Browse files

Unified · Split

3 files
  1. include/uapi/linux/bpf.h +2 −0
  2. kernel/bpf/syscall.c +1 −0
  3. tools/include/uapi/linux/bpf.h +2 −0
include/uapi/linux/bpf.h+2−0
@@ -6651,6 +6651,8 @@ struct bpf_link_info { · 6650 unmodified lines
66516651 struct {
66526652 __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
66536653 __u32 tp_name_len; /* in/out: tp_name buffer len */
6654+ __u32 :32;
6655+ __u64 cookie;
66546656 } raw_tracepoint;
66556657 struct {
66566658 __u32 attach_type;
kernel/bpf/syscall.c+1−0
@@ -3688,6 +3688,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, · 3687 unmodified lines
36883688 return -EINVAL;
36893689
36903690 info->raw_tracepoint.tp_name_len = tp_len + 1;
3691+ info->raw_tracepoint.cookie = raw_tp_link->cookie;
36913692
36923693 if (!ubuf)
36933694 return 0;
tools/include/uapi/linux/bpf.h+2−0
@@ -6651,6 +6651,8 @@ struct bpf_link_info { · 6650 unmodified lines
66516651 struct {
66526652 __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
66536653 __u32 tp_name_len; /* in/out: tp_name buffer len */
6654+ __u32 :32;
6655+ __u64 cookie;
66546656 } raw_tracepoint;
66556657 struct {
66566658 __u32 attach_type;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t