BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/4] libbpf: stringify error codes in log messages
@ 2024-11-11 21:29 Mykyta Yatsenko
  2024-11-11 21:29 ` [PATCH bpf-next v3 1/4] libbpf: introduce errstr() for stringifying errno Mykyta Yatsenko
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mykyta Yatsenko @ 2024-11-11 21:29 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kafai, kernel-team; +Cc: Mykyta Yatsenko

From: Mykyta Yatsenko <yatsenko@meta.com>

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-11-12  4:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 21:29 [PATCH bpf-next v3 0/4] libbpf: stringify error codes in log messages Mykyta Yatsenko
2024-11-11 21:29 ` [PATCH bpf-next v3 1/4] libbpf: introduce errstr() for stringifying errno Mykyta Yatsenko
2024-11-12  4:35   ` Andrii Nakryiko
2024-11-11 21:29 ` [PATCH bpf-next v3 2/4] libbpf: stringify errno in log messages in libbpf.c Mykyta Yatsenko
2024-11-11 21:29 ` [PATCH bpf-next v3 3/4] libbpf: stringify errno in log messages in btf*.c Mykyta Yatsenko
2024-11-11 21:29 ` [PATCH bpf-next v3 4/4] libbpf: stringify errno in log messages in the remaining code Mykyta Yatsenko
2024-11-12  4:40 ` [PATCH bpf-next v3 0/4] libbpf: stringify error codes in log messages patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox