<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7995" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>FreeBSD has kqueue which does sit at least partly in the kernel, no? Its main problem is that it uses resources that are limited (severely on some BSD versions). OS X has this same API, but fortunately it now also has FSEvents (or else I wouldn't have given up the idea to make dirwatching optional).</p>
<p>I'm still applying a local patch to Qt5 which was useful for me under Qt4:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">diff --git a/qtbase/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/qtbase/src/corelib/io/qfilesystemwatcher_kqueue.cpp</span>
<span style="color: #000080">index 4f6c83e..f53caf8 100644</span>
<span style="color: #a00000">--- a/qtbase/src/corelib/io/qfilesystemwatcher_kqueue.cpp</span>
<span style="color: #00a000">+++ b/qtbase/src/corelib/io/qfilesystemwatcher_kqueue.cpp</span>
<span style="color: #800080">@@ -101,6 +101,7 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,</span>
while (it.hasNext()) {
QString path = it.next();
int fd;
<span style="color: #00a000">+ errno = 0;</span>
#if defined(O_EVTONLY)
fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
#else
<span style="color: #800080">@@ -109,12 +110,26 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,</span>
if (fd == -1) {
perror("QKqueueFileSystemWatcherEngine::addPaths: open");
continue;
<span style="color: #00a000">+ } else {</span>
<span style="color: #00a000">+ if (errno) {</span>
<span style="color: #00a000">+ perror("QKqueueFileSystemWatcherEngine::addPaths: open returned valid descriptor but");</span>
<span style="color: #00a000">+ ::close(fd);</span>
<span style="color: #00a000">+ continue;</span>
<span style="color: #00a000">+ }</span>
}
<span style="color: #00a000">+ errno = 0;</span>
if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) {
int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE);
if (fddup != -1) {
::close(fd);
fd = fddup;
<span style="color: #00a000">+ } else {</span>
<span style="color: #00a000">+ perror("QKqueueFileSystemWatcherEngine::addPaths: fddup");</span>
<span style="color: #00a000">+ if (errno = EMFILE) {</span>
<span style="color: #00a000">+ // it seems wise not to insist when we just hit the open file limit</span>
<span style="color: #00a000">+ ::close(fd);</span>
<span style="color: #00a000">+ continue;</span>
<span style="color: #00a000">+ }</span>
}
}
fcntl(fd, F_SETFD, FD_CLOEXEC);</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7995" rel="noreferrer">https://phabricator.kde.org/D7995</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, mwolff<br /><strong>Cc: </strong>arrowdodger, kfunk, dfaure, mwolff, brauch, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight<br /></div>