summaryrefslogtreecommitdiff
path: root/androidcompat.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2015-08-26 16:32:18 +0200
committerDavid Sterba <dsterba@suse.com>2015-09-01 14:02:49 +0200
commit8653831b9fbdfa2746e66bb0ba839f3f461fddfc (patch)
treed02e7c08ec417ac63c2f84e4b438aed09caa8f11 /androidcompat.h
parent455ab41f91810ecba4386df64ee7257f8372bd00 (diff)
downloadbtrfs-progs-8653831b9fbdfa2746e66bb0ba839f3f461fddfc.tar.gz
btrfs-progs: add compat header for android
Provide stubs and compat macros for android build. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'androidcompat.h')
-rw-r--r--androidcompat.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/androidcompat.h b/androidcompat.h
new file mode 100644
index 0000000..eec76da
--- /dev/null
+++ b/androidcompat.h
@@ -0,0 +1,28 @@
+/*
+ * Compatibility layer for Android.
+ *
+ * Stub calls or alternate functions for pthreads.
+ */
+
+#ifndef __ANDROID_H__
+#define __ANDROID_H__
+
+#ifdef ANDROID
+
+#define pthread_setcanceltype(type, oldtype) (0)
+#define pthread_setcancelstate(state, oldstate) (0)
+
+#define pthread_cancel(ret) pthread_kill((ret), SIGUSR1)
+
+typedef struct blkid_struct_probe *blkid_probe;
+
+#include <dirent.h>
+#define direct dirent
+
+#else /* !ANDROID */
+
+#include <sys/dir.h>
+
+#endif /* !ANDROID */
+
+#endif /* __ANDROID_H__ */