mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-06 09:50:15 +08:00
bpf: Extend BPF syscall with common attributes support
Add generic BPF syscall support for passing common attributes.
The initial set of common attributes includes:
1. 'log_buf': User-provided buffer for storing logs.
2. 'log_size': Size of the log buffer.
3. 'log_level': Log verbosity level.
4. 'log_true_size': Actual log size reported by kernel.
The common-attribute pointer and its size are passed as the 4th and 5th
syscall arguments. A new command bit, 'BPF_COMMON_ATTRS' ('1 << 16'),
indicates that common attributes are supplied.
This commit adds syscall and uapi plumbing. Command-specific handling is
added in follow-up patches.
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/20260512153157.28382-2-leon.hwang@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
1 parent
5b0f3729a2
commit
978fc80ec7
1 file changed
+8
@@ -994,6 +994,7 @@ enum bpf_cmd {
|
||||
BPF_PROG_STREAM_READ_BY_FD,
|
||||
BPF_PROG_ASSOC_STRUCT_OPS,
|
||||
__MAX_BPF_CMD,
|
||||
BPF_COMMON_ATTRS = 1 << 16, /* Indicate carrying syscall common attrs. */
|
||||
};
|
||||
|
||||
enum bpf_map_type {
|
||||
@@ -1500,6 +1501,13 @@ struct bpf_stack_build_id {
|
||||
};
|
||||
};
|
||||
|
||||
struct bpf_common_attr {
|
||||
__aligned_u64 log_buf;
|
||||
__u32 log_size;
|
||||
__u32 log_level;
|
||||
__u32 log_true_size;
|
||||
};
|
||||
|
||||
#define BPF_OBJ_NAME_LEN 16U
|
||||
|
||||
enum {
|
||||
|
||||
Reference in new issue
Block a user