summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '5.11' into devEdward Welbourne2018-07-311-4/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| * Fix the fix for mmap() overflow checkThiago Macieira2018-07-251-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code I introduced in 4ee74257940e2ed21b653b986ad02a746e8438a6 only dealt with systems that reasonably used a 64-bit off_t parameter. Turns out that we don't turn on largefile support on 32-bit Android, which meant that the fix caused a regression. [ChangeLog][QtCore][QFile] Fixed a regression that caused QFile::map() to succeed or produce incorrect results when trying to map a file at an offset beyond 4 GB on 32-bit Android systems and on some special Linux configurations. Task-number: QTBUG-69148 Change-Id: I2c133120577fa12a32d444488bac3e341966f8d7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QFSFileEngine::filename(): convert if/else-if chain to a switchEdward Welbourne2018-07-301-13/+16
| | | | | | | | | | | | | | | | | | Makes clear that this is what it is; and ensures we'll get compiler warnings if someone adds a new entry to the FileName enum without code to handle it here. Change-Id: I36e383066728cefcc75e0a760e36222cebd1dff0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Actually truncate when asked toEdward Welbourne2018-07-301-5/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | On Unix, we wouldn't even *try* to truncate if the file was open for appending. The combination may be an eccentric choice but - at least when it's combined with reading - I can imagine use-cases for it; and we should (at least try to) deliver what we're asked for, even if we can't think why anyone would want it. So actually enable truncation when asked to. Amended some tests to check this works and corrected the QIODevice documentation of mode flags (which misdescribed the special case that implies Truncate). Removed special-case code, to apply truncate when writing but not reading, since it's been made redundant by the pre-processing of mode done in QFSFileEngine::processOpenModeFlags(). [ChangeLog][QtCore][QFile] When opening a file, if Truncate is asked for, or implied by other flags, it shall be attempted, regardless of what other options are selected. We previously did this on Windows; now we do so also on Unix (even when appending). Task-number: QTBUG-13470 Change-Id: I1e08d02cfbae102725fccbbc3aab5c7bf8830687 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-151-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/corelib.pro src/corelib/global/qrandom.cpp src/network/access/qhttpnetworkrequest_p.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoansmenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/offscreen/qoffscreenintegration.h src/widgets/kernel/qaction.cpp src/widgets/widgets.pro Done-with: Andy Shaw <andy.shaw@qt.io> Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
| * QSaveFile: Check for EINTR in fsync()/fdatasync()5.10Thiago Macieira2018-02-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QSaveFile] Fixed an issue that would cause QSaveFile::commit() to fail if Unix signals were delivered at the same time. Task-number: QTBUG-66268 Change-Id: I3debfc11127e4516b505fffd151148e70662cd5e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* | Add QIODevice::NewOnly and QIODevice::ExistingOnly OpenMode flagsd3fault2018-01-171-5/+10
|/ | | | | | | | | | | | | | | | When QFile::open is called with the NewOnly flag, the call will fail if the file already exists. As usual, if the file does not exist, it will be created. Like QTemporaryFile, there is a guarantee from the operating system that you are not accidentally creating a new file on top of an older file. When QFile::open is called with the ExistingOnly flag, the call will fail if the file does not exist. The ExistingOnly flag only provides new functionality when used with the WriteOnly flag. For ReadOnly it provides no change in functionality, as ReadOnly by itself already never creates. Task-number: QTBUG-52244 Change-Id: I8e3206728f245f95172c225bf297023fb078fc6d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move the file-cloning code from QFSFileEngine to QFileSystemEngineThiago Macieira2017-08-221-9/+3
| | | | | Change-Id: I02d22222fff64d4dbda4fffd14d1c1bbf48385ff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix QAbstractFileEngine::clone misuseThiago Macieira2017-08-091-3/+6
| | | | | | | | | | | | | | QFile::copy was assuming that the target file was native and therefore it could simply take the file descriptor to clone. While that was not currently a problem, in theory it could be as we do have one writeable file engine besides QFSFileEngine (QWinRTFileEngine). By refactoring to take the parameter as a QAbstractFileEngine, we can ensure that the target file is a native file. Change-Id: Ib7a1737987bf4c4a8c51fffd14d0c048fd509025 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move platform-specific code from QFSFileEngine to QFileSystemEngineThiago Macieira2017-08-051-99/+3
| | | | | Change-Id: I8d96dea9955d4c749b99fffd14cd9395174ba005 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFSFileEngine: make rename() on Unix not overwriteThiago Macieira2017-08-041-2/+8
| | | | | | | | | | | | | | | The rename(2) system call overwrites, so instead of using it, we try to use the link/unlink pair. This works for regular cases, but can fail if trying to change case in case-insensitive filesystems, if we're operating on a non-Unix filesystem (FAT) or, on Linux, if the file doesn't belong to the calling user (BSDs permit this). For those cases, we fall back to rename(2). That means there's a race condition if a new file is created there. But we at least reduce the likelihood of that happening for regular files. Change-Id: I1eba2b016de74620bfc8fffd14ccb38fd929e5aa Reviewed-by: David Faure <david.faure@kdab.com>
* Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devSimon Hausmann2017-07-201-0/+8
|\
| * Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-191-0/+8
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qwindowspipewriter.cpp src/widgets/styles/qcommonstyle.cpp Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
| | * QFile::rename: use the open file's ID, instead of using the file nameThiago Macieira2017-07-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To do that, we needed to add virtual id() in QAbstractFileEngine and override it in QFSFileEngine. It might be useful to return other types of IDs for the other file engines, but this commit does not attempt that just yet. Change-Id: I1eba2b016de74620bfc8fffd14ccafe0762b3c38 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QFileSystemEngine: a file only exists if its link count is not 0Thiago Macieira2017-07-201-2/+6
|/ / | | | | | | | | | | | | | | | | | | QFileSystemMetaData::fillFromStatBuf is used when filling in the results from both stat() as well as fstat(). Obviously the file exists if it was stat()ed but not necessarily so by fstat(): we could be operating on a file descriptor referring to an unlinked file or an O_TMPFILE. Change-Id: I8d96dea9955d4c749b99fffd14cd52a8c8dd9ca1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-131-1/+6
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * QFileSystemEngine/Unix: use fchmod(2) if the file is openThiago Macieira2017-07-051-1/+6
| | | | | | | | | | | | | | | | | | This protects against the file having been renamed or deleted. We'll still operate on the open file, regardless the name it may have on the filesystem. Change-Id: I1eba2b016de74620bfc8fffd14cca85cfd672e6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QFSFileEngine: handle refreshing of file times betterThiago Macieira2017-07-061-10/+0
| | | | | | | | | | | | | | | | Clear the known times when we write to it and always refresh for the Access time. Change-Id: I8d96dea9955d4c749b99fffd14cd6c03b4253197 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QFSFileEnginePrivate::map: flags is not unusedThiago Macieira2017-07-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | It's used below: if (flags & QFileDevice::MapPrivateOption) { sharemode = MAP_PRIVATE; access |= PROT_WRITE; } Change-Id: I8d96dea9955d4c749b99fffd14cd5222762699d4 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | QFileDevice/QFileInfo: Add fileTime() and setFileTime()Nikita Krupenko2017-04-271-0/+115
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QFileDevice] Added fileTime() and setFileTime(). [ChangeLog][QtCore][QFileInfo] Added fileTime(). Task-number: QTBUG-984 Change-Id: I84dfb05b9454a54e26b57b78edee5773dc4c5c3c Initial-patch-by: Raphael Gozzo <raphael.rg91@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Simplify QFSFileEngine code: QFile does not require bufferingThiago Macieira2017-03-311-94/+2
| | | | | | | | | | | | | | | | | | | | We still support buffering via stdio.h (FILE*), but QFSFileEngine itself is not responsible for the buffering. Opening by file name (not FILE* and not file descriptor) already added the Unbuffered flag. Change-Id: I2bc52f3c7a574209b213fffd1498d4e3f78fe1bf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-281-1/+14
|\| | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro tests/auto/corelib/tools/qchar/tst_qchar.cpp tests/auto/other/qaccessibility/accessiblewidgets.h Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-211-1/+14
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/eglfs-plugin.pro Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
| | * Work around Linux libc overflow in mmap64Thiago Macieira2017-03-171-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mmap64 functions in all Linux libc fail to properly check that the value fits in the system call parameter. I guess the developers just said "16 PB are enough for everyone"... Change-Id: Ic39b2c4fd9c84522a8fafffd14ac91567ce09c09 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Speed up QFile::copy on Linux file systems that support cloningSimon Hausmann2017-02-241-0/+17
|/ / | | | | | | | | | | | | | | | | Originally inherited from Btrfs, recent Linux kernels have a system call that allows cloning the contents of a file from another one if the underlying file system supports it. Change-Id: I9df66b65faef99f3bbed8a88fb6b6009baeef32e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Avoid detaching temporary objectsAlexander Volkov2017-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | Found with clazy [detaching-temporary]: - don't call QList::first() on temporary - don't call QString::operator[]() on temporary - don't call QByteArray::data() on temporary Change-Id: I390962ef6020e4fcb0b0e447a63eed1e314d18a4 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* | Make sure we can compile QtCore without QT_CONFIG(translation)Ulf Hermann2016-11-241-1/+1
|/ | | | | Change-Id: I755834b77e50ff6f44bda561f007ec3306f3c1f9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add QFileDevice::MemoryMapFlags::MapPrivateOption flag.Simon Sasburg2014-07-231-1/+7
| | | | | | | | | | Passing this flag to QFileDevice::map() will allow writes to the mapped memory without modifying the file that was mapped. These writes will be lost when the memory is unmapped. Change-Id: I7d46b044fc370585de8c06fdb4059f1f1be12d7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Mark error message in qfsfileengine_unix.cpp as translatable.Friedemann Kleint2014-01-151-2/+13
| | | | | | Task-number: QTBUG-35594 Change-Id: I7aeab890a5972813f38370ff20f5b68839833e3b Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add syncToDisk() to QAbstractFileEngine.David Faure2013-01-141-0/+17
| | | | | | | | | | | | | | This is needed by QSaveFile. Change-Id: I07ebdfd832c0be65c26f0aed1bb7852ac33135ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add renameOverwrite() to QAbstractFileEngine.David Faure2013-01-141-0/+6
|/ | | | | | | | | | | | | QFSFileEngine::rename() on Windows doesn't overwrite the existing destination. Keep that unchanged (it's the desired behavior in QFile::rename), and provide cross-platform rename-overwrite behavior in the new method. This is needed by QSaveFile. Change-Id: I5e753d289d8a53692530a48a1783d62e26169cdc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Drop file-engine abstraction from public APIJoão Abecasis2012-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This abstraction imposed serious performance penalties and is being dropped from the public API. In particular, by allowing file names to be arbitrarily hijacked by different file engines, and requiring engines to be instantiated in order to decide, it imposed unnecessary overhead on all file operations. Another flaw in the design with direct impact on performance is how engines have no way to provide (or retain) additional information obtained when querying the filesystem. In many places this has meant repeated operations on the file system, where useful information is immediately discarded to be queried again subsequently. For Qt 4.8 a major refactoring of the code base took place to allow bypassing the file-engine abstraction in select places, with considerable performance gains observed. In Qt 5 it is expected we'll be able to take this further, reaping even more benefits, but the abstraction has to go. [Dropping this now does not preclude that virtual file systems make an appearance in Qt at a later point in Qt 5's lifecycle. Hopefully with a new and improved abstraction.] Forward declarations for QFileExtension(Result) were dropped, as the classes were never used or defined. Tests using "internalized" classes will only fully run on developer builds. QFSFileEngine was removed altogether from exception safety test, as it isn't its intent to test internal API. Change-Id: Ie910e6c2628be202ea9e05366b091d6d529b246b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove Symbian specific code from QtCore.Xizhi Zhu2012-01-301-361/+0
| | | | | Change-Id: I131303e28a12dccb96de3de4ca0073b389a9bbae Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+1108
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12