diff options
author | BogDan Vatra <bogdan@kdab.com> | 2017-08-17 09:31:19 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2017-08-17 17:21:35 +0000 |
commit | b525ec2eb0bb441ac0dcd0a055efcad08fe6957c (patch) | |
tree | 9ec13b3c4c03a81d62866ea3698ec0f4364ddd2c /src/corelib/io | |
parent | 39852ce60f4de4c454b4bf19ef87bbcdad0aa76c (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')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_inotify.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 6640e2b7e7..ac0c43d055 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -398,7 +398,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId) #if !defined(Q_OS_INTEGRITY) struct group *gr = 0; -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24)) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); if (size_max == -1) size_max = 1024; 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) { |