aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/str_error.h
Commit message (Collapse)AuthorAgeFilesLines
* libbpf: Add namespace for errstr making it libbpf_errstrIan Rogers2025-03-211-2/+5
| | | | | | | | | | | | | | When statically linking symbols can be replaced with those from other statically linked libraries depending on the link order and the hoped for "multiple definition" error may not appear. To avoid conflicts it is good practice to namespace symbols, this change renames errstr to libbpf_errstr. To avoid churn a #define is used to turn use of errstr(err) to libbpf_errstr(err). Fixes: 1633a83bf993 ("libbpf: Introduce errstr() for stringifying errno") Signed-off-by: Ian Rogers <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
* libbpf: Introduce errstr() for stringifying errnoMykyta Yatsenko2024-11-121-0/+7
| | | | | | | | | Add function errstr(int err) that allows converting numeric error codes into string representations. Signed-off-by: Mykyta Yatsenko <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
* libbpf: Move feature detection code into its own fileAndrii Nakryiko2024-01-251-0/+3
| | | | | | | | | | It's quite a lot of well isolated code, so it seems like a good candidate to move it out of libbpf.c to reduce its size. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: John Fastabend <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
* libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-ClauseAlexei Starovoitov2018-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | libbpf is maturing as a library and gaining features that no other bpf libraries support (BPF Type Format, bpf to bpf calls, etc) Many Apache2 licensed projects (like bcc, bpftrace, gobpf, cilium, etc) would like to use libbpf, but cannot do this yet, since Apache Foundation explicitly states that LGPL is incompatible with Apache2. Hence let's relicense libbpf as dual license LGPL-2.1 or BSD-2-Clause, since BSD-2 is compatible with Apache2. Dual LGPL or Apache2 is invalid combination. Fix license mistake in Makefile as well. Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Andrey Ignatov <[email protected]> Acked-by: Arnaldo Carvalho de Melo <[email protected]> Acked-by: Björn Töpel <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: David Beckett <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Acked-by: Joe Stringer <[email protected]> Acked-by: John Fastabend <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Acked-by: Quentin Monnet <[email protected]> Acked-by: Thomas Graf <[email protected]> Acked-by: Roman Gushchin <[email protected]> Acked-by: Wang Nan <[email protected]> Acked-by: Yonghong Song <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
* libbpf: Make include guards consistentAndrey Ignatov2018-10-041-3/+3
| | | | | | | | Rename include guards to have consistent names "__LIBBPF_<header_name>". Signed-off-by: Andrey Ignatov <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
* libbpf: Consistent prefixes for interfaces in str_error.h.Andrey Ignatov2018-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | libbpf is used more and more outside kernel tree. That means the library should follow good practices in library design and implementation to play well with third party code that uses it. One of such practices is to have a common prefix (or a few) for every interface, function or data structure, library provides. I helps to avoid name conflicts with other libraries and keeps API consistent. Inconsistent names in libbpf already cause problems in real life. E.g. an application can't use both libbpf and libnl due to conflicting symbols. Having common prefix will help to fix current and avoid future problems. libbpf already uses the following prefixes for its interfaces: * bpf_ for bpf system call wrappers, program/map/elf-object abstractions and a few other things; * btf_ for BTF related API; * libbpf_ for everything else. The patch renames function in str_error.h to have libbpf_ prefix since it misses one and doesn't fit well into the first two categories. Signed-off-by: Andrey Ignatov <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
* tools lib bpf: Provide wrapper for strerror_r to build in !_GNU_SOURCE systemsArnaldo Carvalho de Melo2018-09-181-0/+6
Same problem that got fixed in a similar fashion in tools/perf/ in c8b5f2c96d1b ("tools: Introduce str_error_r()"), fix it in the same way, licensing needs to be sorted out to libbpf to use libapi, so, for this simple case, just get the same wrapper in tools/lib/bpf. This makes libbpf and its users (bpftool, selftests, perf) to build again in Alpine Linux 3.[45678] and edge. Acked-by: Alexei Starovoitov <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: David Ahern <[email protected]> Cc: Hendrik Brueckner <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Quentin Monnet <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wang Nan <[email protected]> Cc: Yonghong Song <[email protected]> Fixes: 1ce6a9fc1549 ("bpf: fix build error in libbpf with EXTRA_CFLAGS="-Wp, -D_FORTIFY_SOURCE=2 -O2"") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>