mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-09 04:10:13 +08:00
libbpf: Add syscall common attributes support for map_create
With the previous commit adding common attribute support for BPF_MAP_CREATE, users can now retrieve detailed error messages when map creation fails via the log_buf field. Introduce struct bpf_log_opts with the following fields: log_buf, log_size, log_level, and log_true_size. Extend bpf_map_create_opts with a new field log_opts, allowing users to capture and inspect log messages on map creation failures. Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Link: https://lore.kernel.org/r/20260512153157.28382-8-leon.hwang@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
1 parent
92ca488798
commit
88501b1097
2 files changed
+31
-2
No files matched your search
@@ -37,6 +37,18 @@ extern "C" {
|
||||
|
||||
LIBBPF_API int libbpf_set_memlock_rlim(size_t memlock_bytes);
|
||||
|
||||
struct bpf_log_opts {
|
||||
size_t sz; /* size of this struct for forward/backward compatibility */
|
||||
|
||||
char *buf;
|
||||
__u32 size;
|
||||
__u32 level;
|
||||
__u32 true_size; /* out parameter set by kernel */
|
||||
|
||||
size_t :0;
|
||||
};
|
||||
#define bpf_log_opts__last_field true_size
|
||||
|
||||
struct bpf_map_create_opts {
|
||||
size_t sz; /* size of this struct for forward/backward compatibility */
|
||||
|
||||
@@ -57,9 +69,12 @@ struct bpf_map_create_opts {
|
||||
|
||||
const void *excl_prog_hash;
|
||||
__u32 excl_prog_hash_size;
|
||||
|
||||
struct bpf_log_opts *log_opts;
|
||||
|
||||
size_t :0;
|
||||
};
|
||||
#define bpf_map_create_opts__last_field excl_prog_hash_size
|
||||
#define bpf_map_create_opts__last_field log_opts
|
||||
|
||||
LIBBPF_API int bpf_map_create(enum bpf_map_type map_type,
|
||||
const char *map_name,
|
||||
|
||||
Reference in new issue
Block a user