libbpf: remove unused libbpf_strerror_r and STRERR_BUFSIZE
libbpf_strerror_r() is not exposed as public API and neither is it used inside libbpf itself. Remove it altogether. Same for STRERR_BUFSIZE, it's just an orphaned leftover constant which we missed to clean up some time earlier. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20251001171326.3883055-3-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com>
This commit is contained in:
parent
44d42bd808
commit
d05ab6181b
|
@ -319,8 +319,6 @@ static void pr_perm_msg(int err)
|
||||||
buf);
|
buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STRERR_BUFSIZE 128
|
|
||||||
|
|
||||||
/* Copied from tools/perf/util/util.h */
|
/* Copied from tools/perf/util/util.h */
|
||||||
#ifndef zfree
|
#ifndef zfree
|
||||||
# define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
|
# define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
|
||||||
|
|
|
@ -12,30 +12,6 @@
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
||||||
|
|
||||||
/*
|
|
||||||
* Wrapper to allow for building in non-GNU systems such as Alpine Linux's musl
|
|
||||||
* libc, while checking strerror_r() return to avoid having to check this in
|
|
||||||
* all places calling it.
|
|
||||||
*/
|
|
||||||
char *libbpf_strerror_r(int err, char *dst, int len)
|
|
||||||
{
|
|
||||||
int ret = strerror_r(err < 0 ? -err : err, dst, len);
|
|
||||||
/* on glibc <2.13, ret == -1 and errno is set, if strerror_r() can't
|
|
||||||
* handle the error, on glibc >=2.13 *positive* (errno-like) error
|
|
||||||
* code is returned directly
|
|
||||||
*/
|
|
||||||
if (ret == -1)
|
|
||||||
ret = errno;
|
|
||||||
if (ret) {
|
|
||||||
if (ret == EINVAL)
|
|
||||||
/* strerror_r() doesn't recognize this specific error */
|
|
||||||
snprintf(dst, len, "unknown error (%d)", err < 0 ? err : -err);
|
|
||||||
else
|
|
||||||
snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret);
|
|
||||||
}
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *libbpf_errstr(int err)
|
const char *libbpf_errstr(int err)
|
||||||
{
|
{
|
||||||
static __thread char buf[12];
|
static __thread char buf[12];
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
#ifndef __LIBBPF_STR_ERROR_H
|
#ifndef __LIBBPF_STR_ERROR_H
|
||||||
#define __LIBBPF_STR_ERROR_H
|
#define __LIBBPF_STR_ERROR_H
|
||||||
|
|
||||||
#define STRERR_BUFSIZE 128
|
|
||||||
|
|
||||||
char *libbpf_strerror_r(int err, char *dst, int len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief **libbpf_errstr()** returns string corresponding to numeric errno
|
* @brief **libbpf_errstr()** returns string corresponding to numeric errno
|
||||||
* @param err negative numeric errno
|
* @param err negative numeric errno
|
||||||
|
|
Loading…
Reference in New Issue