From 1633a83bf993fa1eb8df26ec6043f77a2fe03245 Mon Sep 17 00:00:00 2001 From: Mykyta Yatsenko Date: Mon, 11 Nov 2024 21:29:16 +0000 Subject: libbpf: Introduce errstr() for stringifying errno Add function errstr(int err) that allows converting numeric error codes into string representations. Signed-off-by: Mykyta Yatsenko Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20241111212919.368971-2-mykyta.yatsenko5@gmail.com --- tools/lib/bpf/str_error.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools/lib/bpf/str_error.h') diff --git a/tools/lib/bpf/str_error.h b/tools/lib/bpf/str_error.h index 626d7ffb03d6..66ffebde0684 100644 --- a/tools/lib/bpf/str_error.h +++ b/tools/lib/bpf/str_error.h @@ -6,4 +6,11 @@ char *libbpf_strerror_r(int err, char *dst, int len); +/** + * @brief **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); #endif /* __LIBBPF_STR_ERROR_H */ -- cgit v1.2.3