From 0cdee628b11d53db814dbfa3c9e4f874f83c535c Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Mon, 31 Aug 2015 18:15:27 +0200
Subject: [PATCH] btrfs-progs: use android compat header

Applies to sources where pthreads are used.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 chunk-recover.c | 4 +++-
 cmds-receive.c  | 3 ++-
 cmds-scrub.c    | 1 +
 mkfs.c          | 3 ++-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/chunk-recover.c b/chunk-recover.c
index 832b3b1b..439599fb 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -16,6 +16,9 @@
  * Boston, MA 021110-1307, USA.
  */
 
+#include "kerncompat.h"
+#include "androidcompat.h"
+
 #include <stdio.h>
 #include <stdio_ext.h>
 #include <stdlib.h>
@@ -26,7 +29,6 @@
 #include <uuid/uuid.h>
 #include <pthread.h>
 
-#include "kerncompat.h"
 #include "list.h"
 #include "radix-tree.h"
 #include "ctree.h"
diff --git a/cmds-receive.c b/cmds-receive.c
index d4b31033..1d7d897f 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -17,6 +17,7 @@
  */
 
 #include "kerncompat.h"
+#include "androidcompat.h"
 
 #include <unistd.h>
 #include <stdint.h>
@@ -25,7 +26,7 @@
 #include <pthread.h>
 #include <math.h>
 #include <ftw.h>
-#include <wait.h>
+#include <sys/wait.h>
 #include <assert.h>
 #include <getopt.h>
 #include <limits.h>
diff --git a/cmds-scrub.c b/cmds-scrub.c
index 91cf6784..0340471a 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -17,6 +17,7 @@
  */
 
 #include "kerncompat.h"
+#include "androidcompat.h"
 
 #include <sys/ioctl.h>
 #include <sys/wait.h>
diff --git a/mkfs.c b/mkfs.c
index 451b5738..14e7eb40 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -17,6 +17,7 @@
  */
 
 #include "kerncompat.h"
+#include "androidcompat.h"
 
 #include <sys/ioctl.h>
 #include <sys/mount.h>
@@ -25,7 +26,7 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/dir.h>
+/* #include <sys/dir.h> included via androidcompat.h */
 #include <fcntl.h>
 #include <unistd.h>
 #include <getopt.h>