summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-03-20 15:24:39 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:25 +0200
commita6306110f54176c4bbc5ff6f04a4f4b4e8f47ad9 (patch)
tree0e0e77513e40c573378c2efe02601f3db54e8fc6 /tools
parent70ca29ae174cbaaca3a8c5829dc78fad675b016e (diff)
downloadlinux-a6306110f54176c4bbc5ff6f04a4f4b4e8f47ad9.tar.gz
linux-a6306110f54176c4bbc5ff6f04a4f4b4e8f47ad9.tar.bz2
linux-a6306110f54176c4bbc5ff6f04a4f4b4e8f47ad9.zip
libbpf: Add namespace for errstr making it libbpf_errstr
[ Upstream commit 307ef667e94530c2f2f77797bfe9ea85c22bec7d ] 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 <irogers@google.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20250320222439.1350187-1-irogers@google.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/str_error.c2
-rw-r--r--tools/lib/bpf/str_error.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/tools/lib/bpf/str_error.c b/tools/lib/bpf/str_error.c
index 8743049e32b7..9a541762f54c 100644
--- a/tools/lib/bpf/str_error.c
+++ b/tools/lib/bpf/str_error.c
@@ -36,7 +36,7 @@ char *libbpf_strerror_r(int err, char *dst, int len)
return dst;
}
-const char *errstr(int err)
+const char *libbpf_errstr(int err)
{
static __thread char buf[12];
diff --git a/tools/lib/bpf/str_error.h b/tools/lib/bpf/str_error.h
index 66ffebde0684..53e7fbffc13e 100644
--- a/tools/lib/bpf/str_error.h
+++ b/tools/lib/bpf/str_error.h
@@ -7,10 +7,13 @@
char *libbpf_strerror_r(int err, char *dst, int len);
/**
- * @brief **errstr()** returns string corresponding to numeric errno
+ * @brief **libbpf_errstr()** returns string corresponding to numeric errno
* @param err negative numeric errno
* @return pointer to string representation of the errno, that is invalidated
* upon the next call.
*/
-const char *errstr(int err);
+const char *libbpf_errstr(int err);
+
+#define errstr(err) libbpf_errstr(err)
+
#endif /* __LIBBPF_STR_ERROR_H */