diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/io.pri | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_inotify.cpp | 8 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 174e2a2fbf..f57dcebe33 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -124,7 +124,7 @@ win32 { SOURCES += io/qstandardpaths_unix.cpp } - linux-* { + linux-*|if(qnx:contains(QT_CONFIG, inotify)) { SOURCES += io/qfilesystemwatcher_inotify.cpp HEADERS += io/qfilesystemwatcher_inotify_p.h } diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 77a5959f8f..449be9b7b5 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -51,11 +51,14 @@ #include <qset.h> #include <qtimer.h> +#if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)) +#define USE_INOTIFY +#endif #include "qfilesystemwatcher_polling_p.h" #if defined(Q_OS_WIN) # include "qfilesystemwatcher_win_p.h" -#elif defined(Q_OS_LINUX) +#elif defined(USE_INOTIFY) # include "qfilesystemwatcher_inotify_p.h" #elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) # include "qfilesystemwatcher_kqueue_p.h" @@ -67,7 +70,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject { #if defined(Q_OS_WIN) return new QWindowsFileSystemWatcherEngine(parent); -#elif defined(Q_OS_LINUX) +#elif defined(USE_INOTIFY) // there is a chance that inotify may fail on Linux pre-2.6.13 (August // 2005), so we can't just new inotify directly. return QInotifyFileSystemWatcherEngine::create(parent); diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 390a280ff2..11ac0e5b5d 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -52,12 +52,20 @@ #include <qsocketnotifier.h> #include <qvarlengtharray.h> +#if defined(Q_OS_LINUX) #include <sys/syscall.h> #include <sys/ioctl.h> #include <unistd.h> #include <fcntl.h> +#endif #if defined(QT_NO_INOTIFY) + +#if defined(Q_OS_QNX) +// These files should only be compiled on QNX if the inotify headers are found +#error "Should not get here." +#endif + #include <linux/types.h> #if defined(__i386__) |