aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp13
-rw-r--r--src/perf.c13
-rw-r--r--src/tracelog.c2
3 files changed, 27 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 4a09836..b83d6ba 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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",
diff --git a/src/perf.c b/src/perf.c
index 50de087..5e05ea5 100644
--- a/src/perf.c
+++ b/src/perf.c
@@ -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"