summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/io.pri5
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp8
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp8
4 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 78993a0..e67e160 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -92,6 +92,11 @@ win32 {
SOURCES += io/qsettings_mac.cpp io/qfilesystemwatcher_fsevents.cpp
}
+ qnx:contains(QT_CONFIG, inotify) {
+ SOURCES += io/qfilesystemwatcher_inotify.cpp
+ HEADERS += io/qfilesystemwatcher_inotify_p.h
+ }
+
linux-*:!symbian {
SOURCES += \
io/qfilesystemwatcher_inotify.cpp \
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 71ccf7a..6f273a1 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -57,6 +57,8 @@
#elif defined(Q_OS_LINUX)
# include "qfilesystemwatcher_inotify_p.h"
# include "qfilesystemwatcher_dnotify_p.h"
+#elif defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)
+# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
# if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
# include "qfilesystemwatcher_fsevents_p.h"
@@ -248,6 +250,8 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine()
{
#if defined(Q_OS_WIN)
return new QWindowsFileSystemWatcherEngine;
+#elif defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)
+ return QInotifyFileSystemWatcherEngine::create();
#elif defined(Q_OS_LINUX)
QFileSystemWatcherEngine *eng = QInotifyFileSystemWatcherEngine::create();
if(!eng)
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index bb4eef3..06f66489 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__)
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 313ff6f..cb87b95 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -108,6 +108,9 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher()
// we have native engines for win32, macosx and freebsd
do_force_engines << "native";
#endif
+#if defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY)
+ do_force_engines << "native";
+#endif
}
void tst_QFileSystemWatcher::basicTest_data()
@@ -206,6 +209,9 @@ void tst_QFileSystemWatcher::basicTest()
// change the permissions, should get a signal from the watcher
testFile.setPermissions(QFile::ReadOwner);
+ // IN_ATTRIB doesn't work on QNX, so skip this test
+#if !defined(Q_OS_QNX)
+
// qDebug() << "waiting max 5 seconds for notification for file permission modification to trigger(1)";
timer.start(5000);
eventLoop.exec();
@@ -216,6 +222,8 @@ void tst_QFileSystemWatcher::basicTest()
fileName = changedSpy.at(0).at(0).toString();
QCOMPARE(fileName, testFile.fileName());
+#endif
+
changedSpy.clear();
// remove the watch and modify file permissions, should not get a signal from the watcher