diff options
-rw-r--r-- | Android.bp | 13 | ||||
-rw-r--r-- | src/perf.c | 13 | ||||
-rw-r--r-- | src/tracelog.c | 2 |
3 files changed, 27 insertions, 1 deletions
@@ -31,6 +31,19 @@ cc_binary_host { "include/uapi", "src/kernel/bpf" ], + target: { + musl: { + // There is an unfortunate interaction between the bionic uapi headers + // used by musl and the kernel headers distributed with bpftool. The + // bionic uapi headers include <linux/compiler_types.h>, which they + // expect to be resolved to their own copy of compiler_types.h that + // includes compiler.h. It instead resolves to the bpftool copy, + // which includes compiler-gcc.h directly, triggering an error if + // the _LINUX_COMPILER_H_ header guard is not already defined. Hack + // around it by always including linux/compiler.h from the command line. + cflags: ["-include linux/compiler.h"], + }, + }, static_libs: [ "libbpf", "libcap", @@ -17,6 +17,19 @@ #include "main.h" +/* musl libc doesn't implement these GNU extensions. They are used below + * to optimize out walking unnecessary subtrees of /proc, #defining them + * to 0 here disables the optimization but leaves the functionality otherwise + * unchanged. + */ +#ifndef FTW_SKIP_SUBTREE +#define FTW_SKIP_SUBTREE 0 +#endif + +#ifndef FTW_ACTIONRETVAL +#define FTW_ACTIONRETVAL 0 +#endif + /* 0: undecided, 1: supported, 2: not supported */ static int perf_query_supported; static bool has_perf_query_support(void) diff --git a/src/tracelog.c b/src/tracelog.c index e80a5c7..d218a58 100644 --- a/src/tracelog.c +++ b/src/tracelog.c @@ -3,13 +3,13 @@ /* Copyright (c) 2018 Netronome Systems, Inc. */ #include <errno.h> +#include <fcntl.h> #include <limits.h> #include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <linux/magic.h> -#include <sys/fcntl.h> #include <sys/vfs.h> #include "main.h" |