mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 00:35:35 +07:00
24d6a80842
libbpf is used more and more outside kernel tree. That means the library should follow good practices in library design and implementation to play well with third party code that uses it. One of such practices is to have a common prefix (or a few) for every interface, function or data structure, library provides. I helps to avoid name conflicts with other libraries and keeps API consistent. Inconsistent names in libbpf already cause problems in real life. E.g. an application can't use both libbpf and libnl due to conflicting symbols. Having common prefix will help to fix current and avoid future problems. libbpf already uses the following prefixes for its interfaces: * bpf_ for bpf system call wrappers, program/map/elf-object abstractions and a few other things; * btf_ for BTF related API; * libbpf_ for everything else. The patch renames function in str_error.h to have libbpf_ prefix since it misses one and doesn't fit well into the first two categories. Signed-off-by: Andrey Ignatov <rdna@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
19 lines
487 B
C
19 lines
487 B
C
// SPDX-License-Identifier: LGPL-2.1
|
|
#undef _GNU_SOURCE
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include "str_error.h"
|
|
|
|
/*
|
|
* 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, dst, len);
|
|
if (ret)
|
|
snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret);
|
|
return dst;
|
|
}
|