summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_inotify.cpp
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2017-08-17 09:31:19 +0300
committerBogDan Vatra <bogdan@kdab.com>2017-08-17 17:21:35 +0000
commitb525ec2eb0bb441ac0dcd0a055efcad08fe6957c (patch)
tree9ec13b3c4c03a81d62866ea3698ec0f4364ddd2c /src/corelib/io/qfilesystemwatcher_inotify.cpp
parent39852ce60f4de4c454b4bf19ef87bbcdad0aa76c (diff)
Android: Fix compile with unified headers
Unified headers now defines _POSIX_THREAD_SAFE_FUNCTIONS but not all libc functions are available in all Android API versions. Change-Id: I01c94f0b89e7f8aa8575e7bbda28d9fe41a68ff1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_inotify.cpp')
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 3cfc6a254f..048669b92f 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -222,6 +222,14 @@ QT_END_NAMESPACE
#include <sys/inotify.h>
+// see https://github.com/android-ndk/ndk/issues/394
+# if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
+static inline int inotify_init1(int flags)
+{
+ return syscall(__NR_inotify_init1, flags);
+}
+# endif
+
#endif
QT_BEGIN_NAMESPACE
@@ -229,7 +237,7 @@ QT_BEGIN_NAMESPACE
QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent)
{
int fd = -1;
-#ifdef IN_CLOEXEC
+#if defined(IN_CLOEXEC)
fd = inotify_init1(IN_CLOEXEC);
#endif
if (fd == -1) {