Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andrii Nakryiko and committed by
Alexei Starovoitov
d05ab618 44d42bd8

-30
-2
tools/lib/bpf/libbpf.c
··· 319 319 buf); 320 320 } 321 321 322 - #define STRERR_BUFSIZE 128 323 - 324 322 /* Copied from tools/perf/util/util.h */ 325 323 #ifndef zfree 326 324 # define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
-24
tools/lib/bpf/str_error.c
··· 12 12 /* make sure libbpf doesn't use kernel-only integer typedefs */ 13 13 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 14 14 15 - /* 16 - * Wrapper to allow for building in non-GNU systems such as Alpine Linux's musl 17 - * libc, while checking strerror_r() return to avoid having to check this in 18 - * all places calling it. 19 - */ 20 - char *libbpf_strerror_r(int err, char *dst, int len) 21 - { 22 - int ret = strerror_r(err < 0 ? -err : err, dst, len); 23 - /* on glibc <2.13, ret == -1 and errno is set, if strerror_r() can't 24 - * handle the error, on glibc >=2.13 *positive* (errno-like) error 25 - * code is returned directly 26 - */ 27 - if (ret == -1) 28 - ret = errno; 29 - if (ret) { 30 - if (ret == EINVAL) 31 - /* strerror_r() doesn't recognize this specific error */ 32 - snprintf(dst, len, "unknown error (%d)", err < 0 ? err : -err); 33 - else 34 - snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret); 35 - } 36 - return dst; 37 - } 38 - 39 15 const char *libbpf_errstr(int err) 40 16 { 41 17 static __thread char buf[12];
-4
tools/lib/bpf/str_error.h
··· 2 2 #ifndef __LIBBPF_STR_ERROR_H 3 3 #define __LIBBPF_STR_ERROR_H 4 4 5 - #define STRERR_BUFSIZE 128 6 - 7 - char *libbpf_strerror_r(int err, char *dst, int len); 8 - 9 5 /** 10 6 * @brief **libbpf_errstr()** returns string corresponding to numeric errno 11 7 * @param err negative numeric errno