Fix compiling bpftool against musl libc am: 7d7be8894e am: d41b5b03ec am: 0ceb5a098d am: 94db8252d5

Original change: https://android-review.googlesource.com/c/platform/external/bpftool/+/2072343

Change-Id: If9f4c06de0623f0dbf359982d404c042d8e686fb
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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"