History

tools/bpf: sync kernel header bpf.h and add bpf_task_fd_query in libbpf

Sync kernel header bpf.h to tools/include/uapi/linux/bpf.h and implement bpf_task_fd_query() in libbpf. The test programs in samples/bpf and tools/testing/selftests/bpf, and later bpftool will use this libbpf function to query kernel.

Yonghong Song committed 8 years ago

Commit 30687ad1 parent 41bdc4b3 files · +52 −0Browse files

Showing the changes to tools/include/uapi/linux (1 of 3 files). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+26−0
@@ -97,6 +97,7 @@ enum bpf_cmd { · 96 unmodified lines
9797 BPF_RAW_TRACEPOINT_OPEN,
9898 BPF_BTF_LOAD,
9999 BPF_BTF_GET_FD_BY_ID,
100+ BPF_TASK_FD_QUERY,
100101 };
101102
102103 enum bpf_map_type {
@@ -380,6 +381,22 @@ union bpf_attr { · 277 unmodified lines
380381 __u32 btf_log_size;
381382 __u32 btf_log_level;
382383 };
384+
385+ struct {
386+ __u32 pid; /* input: pid */
387+ __u32 fd; /* input: fd */
388+ __u32 flags; /* input: flags */
389+ __u32 buf_len; /* input/output: buf len */
390+ __aligned_u64 buf; /* input/output:
391+ * tp_name for tracepoint
392+ * symbol for kprobe
393+ * filename for uprobe
394+ */
395+ __u32 prog_id; /* output: prod_id */
396+ __u32 fd_type; /* output: BPF_FD_TYPE_* */
397+ __u64 probe_offset; /* output: probe_offset */
398+ __u64 probe_addr; /* output: probe_addr */
399+ } task_fd_query;
383400 } __attribute__((aligned(8)));
384401
385402 /* The description below is an attempt at providing documentation to eBPF
@@ -2557,4 +2574,13 @@ struct bpf_fib_lookup { · 2171 unmodified lines
25572574 __u8 dmac[6]; /* ETH_ALEN */
25582575 };
25592576
2577+enum bpf_task_fd_type {
2578+ BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */
2579+ BPF_FD_TYPE_TRACEPOINT, /* tp name */
2580+ BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */
2581+ BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */
2582+ BPF_FD_TYPE_UPROBE, /* filename + offset */
2583+ BPF_FD_TYPE_URETPROBE, /* filename + offset */
2584+};
2585+
25602586 #endif /* _UAPI__LINUX_BPF_H__ */

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