forked from swarren/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
…linux/kernel/git/tip/tip Thomas writes: "- Provide a strerror_r wrapper so lib/bpf can be built on systems without _GNU_SOURCE - Unbreak the man page generator when building out of tree" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf Documentation: Fix out-of-tree asciidoctor man page generation tools lib bpf: Provide wrapper for strerror_r to build in !_GNU_SOURCE systems
- Loading branch information
Showing
5 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o | ||
libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 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 *str_error(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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SPDX-License-Identifier: LGPL-2.1 | ||
#ifndef BPF_STR_ERROR | ||
#define BPF_STR_ERROR | ||
|
||
char *str_error(int err, char *dst, int len); | ||
#endif // BPF_STR_ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters