From: Mykyta Yatsenko <yatsenko@xxxxxxxx> Libbpf may report error in 2 ways: 1. Numeric errno 2. Errno's text representation, returned by strerror Both ways may be confusing for users: numeric code requires people to know how to find its meaning and strerror may be too generic and unclear. These patches modify libbpf error reporting by swapping numeric codes and strerror with the standard short error name, for example: "failed to attach: -22" becomes "failed to attach: -EINVAL". Mykyta Yatsenko (4): libbpf: introduce errstr() for stringifying errno libbpf: stringify errno in log messages in libbpf.c libbpf: stringify errno in log messages in btf*.c libbpf: stringify errno in log messages in the remaining code tools/lib/bpf/btf.c | 26 +-- tools/lib/bpf/btf_dump.c | 3 +- tools/lib/bpf/elf.c | 4 +- tools/lib/bpf/features.c | 15 +- tools/lib/bpf/gen_loader.c | 3 +- tools/lib/bpf/libbpf.c | 356 ++++++++++++++++--------------------- tools/lib/bpf/linker.c | 21 ++- tools/lib/bpf/ringbuf.c | 34 ++-- tools/lib/bpf/str_error.c | 59 ++++++ tools/lib/bpf/str_error.h | 7 + tools/lib/bpf/usdt.c | 32 ++-- 11 files changed, 294 insertions(+), 266 deletions(-) -- 2.47.0