mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 13:44:15 +08:00
libbpf: Add API to get/set log_level at per-program level
Add bpf_program__set_log_level() and bpf_program__log_level() to fetch and adjust log_level sent during BPF_PROG_LOAD command. This allows to selectively request more or less verbose output in BPF verifier log. Also bump libbpf version to 0.7 and make these APIs the first in v0.7. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211201232824.3166325-3-andrii@kernel.org
This commit is contained in:
parent
74d9807023
commit
dbdd2c7f8c
@ -8475,6 +8475,20 @@ int bpf_program__set_flags(struct bpf_program *prog, __u32 flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
__u32 bpf_program__log_level(const struct bpf_program *prog)
|
||||
{
|
||||
return prog->log_level;
|
||||
}
|
||||
|
||||
int bpf_program__set_log_level(struct bpf_program *prog, __u32 log_level)
|
||||
{
|
||||
if (prog->obj->loaded)
|
||||
return libbpf_err(-EBUSY);
|
||||
|
||||
prog->log_level = log_level;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SEC_DEF(sec_pfx, ptype, atype, flags, ...) { \
|
||||
.sec = sec_pfx, \
|
||||
.prog_type = BPF_PROG_TYPE_##ptype, \
|
||||
|
@ -499,6 +499,8 @@ bpf_program__set_expected_attach_type(struct bpf_program *prog,
|
||||
|
||||
LIBBPF_API __u32 bpf_program__flags(const struct bpf_program *prog);
|
||||
LIBBPF_API int bpf_program__set_flags(struct bpf_program *prog, __u32 flags);
|
||||
LIBBPF_API __u32 bpf_program__log_level(const struct bpf_program *prog);
|
||||
LIBBPF_API int bpf_program__set_log_level(struct bpf_program *prog, __u32 log_level);
|
||||
|
||||
LIBBPF_API int
|
||||
bpf_program__set_attach_target(struct bpf_program *prog, int attach_prog_fd,
|
||||
|
@ -419,3 +419,9 @@ LIBBPF_0.6.0 {
|
||||
perf_buffer__new_raw;
|
||||
perf_buffer__new_raw_deprecated;
|
||||
} LIBBPF_0.5.0;
|
||||
|
||||
LIBBPF_0.7.0 {
|
||||
global:
|
||||
bpf_program__log_level;
|
||||
bpf_program__set_log_level;
|
||||
};
|
||||
|
@ -4,6 +4,6 @@
|
||||
#define __LIBBPF_VERSION_H
|
||||
|
||||
#define LIBBPF_MAJOR_VERSION 0
|
||||
#define LIBBPF_MINOR_VERSION 6
|
||||
#define LIBBPF_MINOR_VERSION 7
|
||||
|
||||
#endif /* __LIBBPF_VERSION_H */
|
||||
|
Loading…
Reference in New Issue
Block a user