diff options
author | Mykyta Yatsenko <yatsenko@meta.com> | 2024-11-11 21:29:16 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-11-11 20:29:20 -0800 |
commit | 1633a83bf993fa1eb8df26ec6043f77a2fe03245 (patch) | |
tree | 24ea16186b877fe18f9751854baeb0bfb040db19 /tools/lib/bpf/str_error.h | |
parent | 213a695297e1f0c2ed814488757d496b0d7f7267 (diff) | |
download | linux-1633a83bf993fa1eb8df26ec6043f77a2fe03245.tar.gz linux-1633a83bf993fa1eb8df26ec6043f77a2fe03245.tar.bz2 linux-1633a83bf993fa1eb8df26ec6043f77a2fe03245.zip |
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 <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241111212919.368971-2-mykyta.yatsenko5@gmail.com
Diffstat (limited to 'tools/lib/bpf/str_error.h')
-rw-r--r-- | tools/lib/bpf/str_error.h | 7 |
1 files changed, 7 insertions, 0 deletions
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 */ |