summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfiledevice.cpp7
-rw-r--r--src/corelib/io/qfileinfo.cpp11
-rw-r--r--src/corelib/io/qfilesystemengine.cpp4
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h4
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp15
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp10
-rw-r--r--src/corelib/io/qwindowspipereader.cpp1
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp1
8 files changed, 33 insertions, 20 deletions
diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp
index d2c8d37d4a..f7e58a7bed 100644
--- a/src/corelib/io/qfiledevice.cpp
+++ b/src/corelib/io/qfiledevice.cpp
@@ -139,10 +139,9 @@ void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)
are returned and on Windows the rights of the current user are
returned. This behavior might change in a future Qt version.
- Note that Qt does not by default check for permissions on NTFS
- file systems, as this may decrease the performance of file
- handling considerably. It is possible to force permission checking
- on NTFS by including the following code in your source:
+ \note On NTFS file systems, ownership and permissions checking is
+ disabled by default for performance reasons. To enable it,
+ include the following line:
\snippet ntfsp.cpp 0
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 2cf97ef94e..60f7e47e62 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -271,6 +271,17 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
groupId(). You can examine a file's permissions and ownership in a
single statement using the permission() function.
+ \note On NTFS file systems, ownership and permissions checking is
+ disabled by default for performance reasons. To enable it,
+ include the following line:
+
+ \snippet ntfsp.cpp 0
+
+ Permission checking is then turned on and off by incrementing and
+ decrementing \c qt_ntfs_permission_lookup by 1.
+
+ \snippet ntfsp.cpp 1
+
\section1 Performance Issues
Some of QFileInfo's functions query the file system, but for
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 53cf6158ad..8b6ceebc62 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -224,7 +224,7 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
return false;
}
-#if defined(Q_OS_QNX)
+#if defined(QT_EXT_QNX_READDIR_R)
static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32)
{
statBuf64->st_mode = statBuf32.st_mode;
@@ -289,7 +289,7 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(Q_OS_QNX)
+#if defined(QT_EXT_QNX_READDIR_R)
knownFlagsMask = 0;
entryFlags = 0;
for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 4164020359..18a9c2dbda 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -95,10 +95,10 @@ private:
#else
QT_DIR *dir;
QT_DIRENT *dirEntry;
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R)
// for readdir_r
QScopedPointer<QT_DIRENT, QScopedPointerPodDeleter> mt_file;
-#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
// for _readdir_r
size_t direntSize;
#endif
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 0b59aa169a..0f9bbd8a29 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -70,7 +70,7 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
if (!nativePath.endsWith('/'))
nativePath.append('/');
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R)
// ### Race condition; we should use fpathconf and dirfd().
size_t maxPathName = ::pathconf(nativePath.constData(), _PC_NAME_MAX);
if (maxPathName == size_t(-1))
@@ -81,13 +81,14 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
Q_CHECK_PTR(p);
mt_file.reset(p);
-#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
direntSize = maxPathName;
- // Include extra stat information in the readdir() call (d_stat member of dirent_extra_stat).
- // This is used in QFileSystemMetaData::fillFromDirEnt() to avoid extra stat() calls when iterating
- // over directories
- if (dircntl(dir, D_SETFLAG, D_FLAG_STAT) == -1)
+ // Include extra stat information in the readdir() call (d_stat member of
+ // dirent_extra_stat). This is used in QFileSystemMetaData::fillFromDirEnt() to
+ // avoid extra stat() calls when iterating over directories
+ int flags = dircntl(dir, D_GETFLAG) | D_FLAG_STAT | D_FLAG_FILTER;
+ if (dircntl(dir, D_SETFLAG, flags) == -1)
lastError = errno;
#endif
#endif
@@ -105,7 +106,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
if (!dir)
return false;
-#if defined(Q_OS_QNX) && defined(QT_EXT_QNX_READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
lastError = QT_EXT_QNX_READDIR_R(dir, mt_file.data(), &dirEntry, direntSize);
if (lastError)
return false;
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
index 689f05bb1b..401f95ae82 100644
--- a/src/corelib/io/qfilesystemwatcher_polling.cpp
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -65,14 +65,16 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
if (!fi.exists())
continue;
if (fi.isDir()) {
- if (!directories->contains(path))
- directories->append(path);
+ if (directories->contains(path))
+ continue;
+ directories->append(path);
if (!path.endsWith(QLatin1Char('/')))
fi = QFileInfo(path + QLatin1Char('/'));
this->directories.insert(path, fi);
} else {
- if (!files->contains(path))
- files->append(path);
+ if (files->contains(path))
+ continue;
+ files->append(path);
this->files.insert(path, fi);
}
it.remove();
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index df65aebcff..7dd2125e70 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -318,6 +318,7 @@ bool QWindowsPipeReader::waitForPipeClosed(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
forever {
+ waitForReadyRead(0);
checkPipeState();
if (pipeBroken)
return true;
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index daa8068734..daad542705 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qwindowspipewriter_p.h"
-#include <string.h>
QT_BEGIN_NAMESPACE