summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfilesystemengine.cpp49
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h4
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp18
-rw-r--r--src/corelib/io/qprocess.cpp6
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qurl.cpp7
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h2
7 files changed, 79 insertions, 11 deletions
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 74ceeb11c1..fe06210fb9 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -224,6 +224,19 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
return false;
}
+#if defined(Q_OS_QNX)
+static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32)
+{
+ statBuf64->st_mode = statBuf32.st_mode;
+ statBuf64->st_size = statBuf32.st_size;
+ statBuf64->st_ctime = statBuf32.st_ctime;
+ statBuf64->st_mtime = statBuf32.st_mtime;
+ statBuf64->st_atime = statBuf32.st_atime;
+ statBuf64->st_uid = statBuf32.st_uid;
+ statBuf64->st_gid = statBuf32.st_gid;
+}
+#endif
+
void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
{
// Permissions
@@ -277,7 +290,41 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
+#if defined(Q_OS_QNX)
+ knownFlagsMask = 0;
+ entryFlags = 0;
+ for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);
+ extra = _DEXTRA_NEXT(extra)) {
+ if (extra->d_type == _DTYPE_STAT || extra->d_type == _DTYPE_LSTAT) {
+
+ const struct dirent_extra_stat * const extra_stat =
+ reinterpret_cast<struct dirent_extra_stat *>(extra);
+
+ // For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data,
+ // as we need the stat() information there, not the lstat() information.
+ // In this case, don't use the extra information.
+ // Unfortunately, readdir() never seems to return extra info of type _DTYPE_STAT, so for
+ // symlinks, we always incur the cost of an extra stat() call later.
+ if (S_ISLNK(extra_stat->d_stat.st_mode) && extra->d_type == _DTYPE_LSTAT)
+ continue;
+
+#if defined(__EXT_LF64SRC)
+ // Even with large file support, d_stat is always of type struct stat, not struct stat64,
+ // so it needs to be converted
+ struct stat64 statBuf;
+ fillStat64fromStat32(&statBuf, extra_stat->d_stat);
+ fillFromStatBuf(statBuf);
+#else
+ fillFromStatBuf(extra_stat->d_stat);
+#endif
+ knownFlagsMask |= QFileSystemMetaData::PosixStatFlags;
+ if (!S_ISLNK(extra_stat->d_stat.st_mode)) {
+ knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
+ entryFlags |= QFileSystemMetaData::ExistsAttribute;
+ }
+ }
+ }
+#elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
// BSD4 includes Mac OS X
// ### This will clear all entry flags and knownFlagsMask
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 87395ec2cf..a68615ca05 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -98,6 +98,10 @@ private:
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
// for readdir_r
QScopedPointer<QT_DIRENT, QScopedPointerPodDeleter> mt_file;
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ // for _readdir_r
+ size_t direntSize;
+#endif
#endif
int lastError;
#endif
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 9ab186d119..28f5e36bb8 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -54,6 +54,9 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
: nativePath(entry.nativeFilePath())
, dir(0)
, dirEntry(0)
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ , direntSize(0)
+#endif
, lastError(0)
{
Q_UNUSED(filters)
@@ -78,6 +81,15 @@ 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)
+ 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)
+ lastError = errno;
+#endif
#endif
}
}
@@ -93,7 +105,11 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
if (!dir)
return false;
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ lastError = _readdir_r(dir, mt_file.data(), &dirEntry, direntSize);
+ if (lastError)
+ return false;
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
lastError = QT_READDIR_R(dir, mt_file.data(), &dirEntry);
if (lastError)
return false;
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index b115310d63..395effaff9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -41,8 +41,9 @@
//#define QPROCESS_DEBUG
-#if defined QPROCESS_DEBUG
#include <qdebug.h>
+#include <qdir.h>
+#if defined QPROCESS_DEBUG
#include <qstring.h>
#include <ctype.h>
#if !defined(Q_OS_WINCE)
@@ -1147,7 +1148,8 @@ QProcess::~QProcess()
{
Q_D(QProcess);
if (d->processState != NotRunning) {
- qWarning("QProcess: Destroyed while process is still running.");
+ qWarning().nospace()
+ << "QProcess: Destroyed while process (" << QDir::toNativeSeparators(program()) << ") is still running.";
kill();
waitForFinished();
}
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index dd5cf4819e..d19ab695ea 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -520,8 +520,8 @@ void QProcessPrivate::startProcess()
q->setProcessState(QProcess::Running);
// User can call kill()/terminate() from the stateChanged() slot
- // so check before proceeding
- if (!pid)
+ // so check before proceeding
+ if (!pid)
return;
if (threadData->eventDispatcher) {
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index be87e1f34f..a7a722bc46 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -78,9 +78,10 @@
Call isValid() to check if the URL is valid. This can be done at
any point during the constructing of a URL.
- Constructing a query is particularly convenient through the use
- of setQueryItems(), addQueryItem() and removeQueryItem(). Use
- setQueryDelimiters() to customize the delimiters used for
+ Constructing a query is particularly convenient through the use of the \l
+ QUrlQuery class and its methods QUrlQuery::setQueryItems(),
+ QUrlQuery::addQueryItem() and QUrlQuery::removeQueryItem(). Use
+ QUrlQuery::setQueryDelimiters() to customize the delimiters used for
generating the query string.
For the convenience of generating encoded URL strings or query
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
index 326df584d7..331d915ccc 100644
--- a/src/corelib/io/qwinoverlappedionotifier_p.h
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -61,8 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
-
class Q_CORE_EXPORT QWinOverlappedIoNotifier : public QObject
{
Q_OBJECT