summaryrefslogtreecommitdiffstats
path: root/src/corelib/ipc
Commit message (Collapse)AuthorAgeFilesLines
* Move all Q_DECL_(PURE|CONST)_FUNCTION markers to the frontMårten Nordheim2025-09-192-2/+2
| | | | | | | | | While testing defining Q_DECL_PURE_FUNCTION for MSVC I discovered it cannot handle having the marker trailing, while GCC/clang can cope with either. Change-Id: Ic9dd088996c191263e2f2a43c2f6a16533bdb9c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark src/corelib/ipc as security:significantMatthias Rauter2025-07-0415-0/+15
| | | | | | | | Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-135188 Change-Id: I8865fe8ffbc22e30218441ec64157d9bafccdd35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make include guard match its filenameMatthias Rauter2025-06-111-3/+3
| | | | | | Pick-to: 6.10 Change-Id: I57af3c237bddffc424cab734faa30deacaa9bcdb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStringView: introduce a user-defined literal operatorGiuseppe D'Angelo2025-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although char16_t string literals implicitly convert to QStringView, there are corner-cases where one may want to explicitly create a QStringView out of them. A couple of examples I've found is where these string literals decay into pointers: // range is a std::initializer_list<const char16_t *> for (QStringView v : { u"foo", u"bar" }) { ... } // ternary will decay arguments void print(QStringView); print(check ? u"hi" : u"there"); When this happens the resulting code gets pessimized and polluted by runtime calls to qustrlen in order to build the QStringView objects [1]. We can restore optimal codegen by directly dealing with QStringView objects instead. Adding explicit conversions may make the code cumbersome to read, so I'm introducing a UDL for QStringView, matching the one for QString (and std::string_view). [1] for instance: https://gcc.godbolt.org/z/eY7xvEje3 Apply the new operator to a couple of places. [ChangeLog][QtCore][QStringView] Is it now possible to create QStringView objects by using the u""_sv user-defined literal. Fixes: QTBUG-123851 Change-Id: I8af7d2e211b356d284de160a222eab9e91d09500 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port QtCore from QScoped- to std::unique_ptr [1/2]: private usesMarc Mutz2024-12-311-1/+3
| | | | | | | | | | | | | | | | | | | This patch series is in preparation of enabling QT_NO_SCOPED_POINTER when building QtCore, a prerequisite for enabling this opt-out in leaf modules. This first part of the patch series ports objects whose use cannot "leak" into other modules, e.g. because they are in .cpp files or are private members and is thus SC (and, as demonstrated by various static assertions we put into the source code over the years, BC). The second patch will deal with objects in protected and public APIs, and thus might be QUIP-6 SiC Type A. Pick-to: 6.9 Task-number: QTBUG-132213 Change-Id: If4967f6e563a4e7d74550fad4c6d354fad1beef5 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QSharedMemorySystemV: fix shm vs sem typoThiago Macieira2024-12-131-1/+1
| | | | | | | Fixes: QTBUG-132053 Pick-to: 6.8 6.9 Change-Id: Ia4f2bdc8edff91020f13fffd79261a9feaf2f496 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Create qdoc macros for C++ class docs 2.1: qHash()Marc Mutz2024-11-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a family of qdoc macros to document the various qHash() overloads we have. This patch does not change the \relates of the qHash() functions, they remain as inconsistent as they have been. Created QTBUG-129815 to clean things up. Since this author expects the \relates to change in the future, there are different \qhash commands, and all except \qhashbuiltin take the class name as an argument, for use in a centrally-choreographed fix for QTBUG-129815. As drive-by's, fix: - missing documentation about Key having to support qHash() in the associative Qt containers - drop noexcept and default arguments from \fn lines that needed to have their argument names changed - move the QStringView overload from qhash.cpp to qstringview.cpp (as it \relates to the former) Fixes: QTBUG-129574 Pick-to: 6.8 6.5 Change-Id: I8e8c2edc27422cbe5823f56baf3a24d7f7050836 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* QNativeIpcKey: normalize docs for qHash()Marc Mutz2024-11-202-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | The C++ standard forces¹ us to overload the hidden friend qHash() implementation instead of defaulting `seed` to zero. That doesn't mean we need to reflect that technicality in the docs, esp. if it forces us to deviate from the standard phrasing of qHash() functions to say something about the default value of `seed` (which would, for a defaulted argument, be shown in the docs). Present the qHash() function in the canonical form to QDoc. This is a (forwards and backwards) BC way to solve the issue. Going forward, the correct fix should be to have qHash() functions call a private hash(seed) member function instead, to fulfill the pointless requirement of [1]. ¹ [dcl.fct.default]/4, last sentence Amends c2310f8e03cf30222cea59b3c556d060e1710015. Pick-to: 6.8 Task-number: QTBUG-129574 Change-Id: I7890a0df092c9780601fc4c25e23d70d92db47e1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* IPC: Add missing includes of errno.hMartin Storsjö2024-11-152-0/+2
| | | | | | | | | | | | | | | | | | | These files use errno constants such as EACCES, while relying on this header to be included implicitly. If building with the latest libc++ versions, configured with _LIBCPP_REMOVE_TRANSITIVE_INCLUDES=1 (which removes unnecessary transitive includes from the public headers), one runs into this error, where errno.h no longer is implicitly included through other headers. Prior to 762017f03ca530937dfe24cc822065e08111f985, these functions were in separate files that explicitly did include errno.h. Pick-to: 6.8 Change-Id: I7b02f2ffa35b86606f6c173bf6a6d2917dbdc151 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Create qdoc macros for C++ class docs 1.3: member-swap(), non-standard phrasingMarc Mutz2024-11-081-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and this third patch is for documentation that used a non-standard phrasing for documenting member-swap(). By using the macro, the documentation automatically conforms to what the documentation team picks as the \memberswap expansion going forward. As a drive-by, fix doc block indentation to the Qt standard of 4 spaces (only in changed lines), and add a few blank lines where they were missing before. Fixes: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: If007602d7690572fcbb848a8d0235416c908cfd2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QSharedMemoryPrivate: fix -Wshadow in create()Marc Mutz2024-10-081-2/+2
| | | | | | | | | | | | | | | | Rename the function argument from size (which is also a data member of the class) to sz, a common abbreviation in Qt. The code predates the start of the public history, but eaa7528baa2e40aea35c9fac9cd8f632fa251ff8 made create() an inline function. Hopefully -Wshadow doesn't apply to mere argument declarations, so not picking further than said commit. Pick-to: 6.8 6.7 Task-number: QTBUG-126219 Change-Id: I637d731ba33247b7223b5d796bc170c0b87edcad Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
* qtipccommon_p.h: fix -Wunused-functionMarc Mutz2024-09-171-1/+1
| | | | | | | | | | | | Make isIpcSupported() non-static so Clang doesn't warn that it's unused. Amends f79b535f6b303a77fd9c990118c9bc1a165a0dc1. Pick-to: 6.8 6.7 Task-number: QTBUG-126219 Change-Id: I0c99d2196fcec8d7fcd1480d09fbbe176ce365b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* IPC: add PATH_MAX-less fallback definition for MAX_PATHPino Toscano2024-06-251-1/+5
| | | | | | | | | | Define MAX_PATH also when PATH_MAX is not defined (e.g on GNU/Hurd). MAX_PATH is Windows constant, and it is used in this file only in a code path for Windows; because of this, the static fallback define should be good enough. Change-Id: Ic1b9fee3b62505f86aa8ec89bbd20493bfe1f67c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedMemoryLocker: make ctor explicitMarc Mutz2024-06-071-1/+2
| | | | | | | | | | | A QSharedMemory* is not a faithful representation of a QSharedMemoryLocker, so the resp. converting ctor should be explicit. Found in API-review. Pick-to: 6.8 6.7 Change-Id: I2267a193868c4d0979f59ed0847a0e4af64ffe76 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QSharedMemoryLocker: add missing move SMFs and member- and ADL swapMarc Mutz2024-06-071-1/+13
| | | | | | | | | | | This fixes clazy-rule-of-three (and -Wpeppe). The actual operations performed are copied from QMutexLocker. This code predates the public history. Pick-to: 6.8 6.7 Change-Id: Ieba73502187b32178ec2601e1902ac6b20a8e477 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QNativeIpcKey: use new comparison helper macrosTatiana Borisova2024-04-172-15/+13
| | | | | | | | | | Replace public friend operators operator==(), operator!=() of QNativeIpcKey to friend methods comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macro. Task-number: QTBUG-120304 Change-Id: If18d86fb18e44f8d2210cba7ca93e4ac478a2a48 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Recreate posix QSystemSemaphore on release for VxWorksKrzysztof Sommerfeld2023-12-151-0/+6
| | | | | | | | | | | | | | | | `QSystemSemaphore` used by `QSharedMemory` class, when failed to acquire native sem by calling `sem_wait`, will check the reason of failure and if it is because the semaphore is no longer valid (destroyed by some other `QSharedMemory` object accessing the same data) will recreate it and repeat. However, the same is not done when `QSystemSemaphore` is calling release. Add this functionality also for release. Task-number: QTBUG-115777 Pick-to: 6.7 Change-Id: Ic5d2438c93db318b993becff930b480fd3177532 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename EINTR_LOOP -> QT_EINTR_LOOPMarc Mutz2023-11-303-8/+8
| | | | | | | | | | | | | | | This non-namespaced macro was defined in a header, and while that header is private, we shouldn't define non-namespaced macros in our headers. The macro also clashed with one of the same name defined in forkfd.c, which broke unity-builds including the forkfd_qt.cpp TU. This rename fixes that, too, so we can now remove forkfd_qt.cpp from NO_UNITY_BUILD_SOURCES. Pick-to: 6.6 6.5 Change-Id: Ic4bb4e4d7a632ca87905e48913db788a7c202314 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* IPC: Un-deprecate the "legacy" key APIThiago Macieira2023-11-244-38/+1
| | | | | | | | | | This the API that has been around since Qt 4.5. We decided not to deprecate them individually. Instead, we'll deprecate the whole class. Pick-to: 6.6 Change-Id: Ia930b1a2ed1e465a826ffffd179a1b7b3250fd89 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSharedMemory: fix attach() -> create() for non-legacy SystemV modeIvan Solovev2023-11-081-0/+2
| | | | | | | | | | | | | | | | | | | | | The problem with non-legacy mode is that the backend uses the same filename for the system semaphore file and for the shared memory file. What happens is that when we try to call attach(), a semaphore is created. Later in attach() we set unix_key, because ftok() returns a valid handle (it uses the file which was created for semaphore). After that, an attempt to actually attach to a shared memory fails, but no clean-up is done. So, a later call to create() sees that unix_key is already valid, but it cannot properly clean it, because it does not actually refer to any shared memory. Fix it by cleaning up unix_key and nativeKeyFile if shmget() call in attach() fails. Pick-to: 6.6 Change-Id: Ibccc3ac307d8b2e07e1b9b24b55f97a859a03131 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedMemory: fix attach() -> create() for legacy SystemV modeIvan Solovev2023-11-071-0/+1
| | | | | | | | | | | | | | | | | | | | | The attach() -> create() sequence was not covered by unit-tests in qtbase, but this approach is used inside QSharedImageLoader. It turns out that 02c42b26e1ff94047657c4838128cb5b22d24d2b broke this usecase for legacy mode, and the create() triggered an assertion in QSharedMemorySystemV::updateNativeKeyFile(). Fix it by clearing the nativeKeyFile if ftok() call in QSharedMemorySystemV::handle() fails(). Add unit-tests for the attach() -> create() scenario. These tests revealed that this scenario fails also in non-legacy mode for SystemV, so add QEXPECT_FAIL for these cases for now. This will be addressed in a separate patch. Pick-to: 6.6 Change-Id: If133fa56c82eba902374dc48d2757046b3d40baf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QSharedMemory: fix semaphore creation in legacy modeIvan Solovev2023-11-021-1/+5
| | | | | | | | | | | | | | | | | | | The legacy mode was using the new nativeKey to create a semaphore. As a result, on macOS the name of the semaphore key file was the same as the name of the shared memory key file. This lead to a situation when the file was mistakenly deleted when destroying any instance of the shared memory, not only the one that created it. Fix it by using QSystemSemaphore::legacyNativeKey() in legacy mode. Add a test to verify that we cannot re-create a shared memory with the same key. The test was failing on macOS without the fix. Fixes: QTBUG-111855 Pick-to: 6.6 Change-Id: Ib0bc41791e889b1888bbb8aa9044c6b053b63a5a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* IPC: Move the legacy key to the QNativeIpcKeyThiago Macieira2023-09-176-27/+74
| | | | | | | | | | | | | | | | | This is needed to support passing it to other processes so they can enable legacy, compatibility mode. Right now, there's no such code, but I am 90% certain we'll need it soon in 6.6.x, if not for compatibility changes in the future. There's a bug in passing a QNativeIpcKey to another process that causes QSharedMemory to use the wrong QSystemSemaphore for control (a feature that should never have existed in the first place, but we're 15 years too late on that). I have not yet investigated a fix for this, but it will likely involve knowing the original legacy key. Pick-to: 6.6 6.6.0 Change-Id: Idd5e1bb52be047d7b4fffffd1750b547013cb336 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* IPC: disallow unknown queries in QNativeIpcKey string formThiago Macieira2023-09-171-1/+2
| | | | | | | | | So we can add them in the future but cause older versions of Qt to reject them if they don't know what they are. Pick-to: 6.6 6.6.0 Change-Id: I512648fd617741199e67fffd1782b85935bb832a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* IPC: Remove the "small" object optimization in QNativeIpcKeyThiago Macieira2023-09-173-86/+47
| | | | | | | | | | | | | | | | The original design was supposed to be small, at a single pointer, but that never made it through, with the "QString key" member. So the anonymous union for typeAndFlags overlapping with the extension pointer was just unnecessary headache. So separate the two. This means QNativeIpcKey's size increases from 4 pointers to 40 bytes on 64-bit systems and to 24 bytes on 32-bit systems (so we have 6 unused bytes on both architectures). Fixes: QTBUG-116821 Pick-to: 6.6 6.6.0 Change-Id: I512648fd617741199e67fffd1782b7d5ba5ddd12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* IPC: make the two platformSafeKey functions return QNativeIpcKeyThiago Macieira2023-09-174-45/+51
| | | | | | | | | | | | | | | | | There's no need to return QString, only to create the QNativeIpcKey elsewhere, when nothing uses this intermediary QString (those two functions aren't used in unit tests any more, since the two "IPC: add native key support" commits (2c286561bbc9e4e408d34e5bf43db8ad9acc0e84 and 3ae052d3bb5d7af0badf32575a5aa042cffd8243). Since they aren't used in the tests, we can remove the Q_AUTOTEST_EXPORT macro too and the unnecessary default argument. I'll need the ability to return QNativeIpcKey to store the original, legacy key inside of it. Pick-to: 6.6 6.6.0 Change-Id: Idd5e1bb52be047d7b4fffffd17506c05e4f61f79 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Add documentation for added QNativeIpcKey overloadKai Köhne2023-09-101-0/+6
| | | | | | | | | | Document new implicit constructor introduced in the commit 08605f0d78485 Pick-to: 6.6 Fixes: QTBUG-116870 Change-Id: I518f0a043d7738698ae568ce0b51db3f2c28574f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* Fix -no-feature-sharedmemoryAndré Klitzing2023-08-312-0/+4
| | | | | | | Pick-to: 6.6 Fixes: QTBUG-114779 Change-Id: I7acf9bc2ba461fe1644c4ff6a157f88c9cce84c4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeIpcKey: improve operator==()Ivan Solovev2023-08-181-1/+1
| | | | | | | | | | | | | There is no need to check if lhs.d == rhs.d in the end of the function, because we already have the same condition earlier. If none of the previous conditions was true, we can just return false. This commit amends 7a370838177e581c8a9342808ba86e081951a41c. Pick-to: 6.6 Change-Id: I06dca9b3dedf5895820685a6ded5363963e6fa3f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix key truncation logic for Windows QSystemSemaphore::platformSafeKeyJøger Hansegård2023-08-121-1/+3
| | | | | | | | | The QSystemSemaphore::platformSafeKey was intended to truncate oversized keys on Windows, but didn't. The fix is to make sure MAX_PATH is defined when compiling on Windows. Change-Id: I03f3bee901203d901bda05a841451c8a2d2f3924 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeIpcKey: add qHash() functionDennis Oberst2023-07-252-0/+20
| | | | | | | | Equality comparable types should define a qHash() function. Pick-to: 6.6 Change-Id: I1677fbefa3d09d49a292d369b808793f884c32e9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeIpcKey: add implicit default ctorDennis Oberst2023-07-141-1/+5
| | | | | | | | | | | | Add an implicitly callable default ctor, to enable default returns, but still disallow implicit conversion whilst assigning: QNativeIpcKey k = QNativeIpcKey::Type::~~ // not allowed auto fn = []() -> QNativeIpcKey { return {}; } // allowed Pick-to: 6.6 Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNativeIpcKey: make isEmpty() and isValid() noexceptDennis Oberst2023-07-141-2/+2
| | | | | | | | They have no preconditions and cannot throw. Pick-to: 6.6 Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNativeIpcKey: add missing noexcept to swapDennis Oberst2023-07-131-1/+1
| | | | | | | Pick-to: 6.6 Change-Id: I57d5f22823597a56d93fc2f8f30b538684ce77ad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* ipc common: move end-of-namespace into same scope as startMårten Nordheim2023-07-121-1/+2
| | | | | | | | | To avoid issues building with shared memory & system semaphore disabled. Pick-to: 6.6 Change-Id: I525abe97f82266b8cca0e4f1847849054c016a4b Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add \relates command to two global swap() functionsTopi Reinio2023-06-231-3/+10
| | | | | | | | | And fix incorrect copy-paste error in QBasicTimer's swap() description, 'string' -> 'timer'. Pick-to: 6.6 Change-Id: I28f5e4d6c8e3b8698ab9b4587d503b06c5628b78 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Mark all remaining RAII/smart pointer class ctors [[nodiscard]]Marc Mutz2023-06-221-1/+1
| | | | | | | | | | | | | | | | | | | ... like QUIP-0019 suggests. The main problem here is finding these classes. We don't have markup for RAII classes, so I had to find them by name. This patch is based on the output of git grep -we Q[A-Z0-9a-z_]+er extracting the matches and piping them through sort -u, then removing a lot of suffixes like Manager and Handler, then visually inspecting the remaining list. Task-number: QTBUG-104164 Pick-to: 6.6 Change-Id: I59b18d8d0a0237fcc11047857adc39b984ad7fcb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: QNativeIpcKey: enable the slow pathThiago Macieira2023-05-183-18/+67
| | | | | | | | | | | | | I had designed this to be fast for the common, new case of using QNativeIpcKey objects with a key, a type and maybe in the future we'd need a flag or two. Turns out that the very first thing I'll need is a QString, so enable this code path. This isn't currently exercised because it's not possible to enter it, yet. It'll come in the next commit. Change-Id: Idd5e1bb52be047d7b4fffffd17506af2f2de3060 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: QNativeIpcKey: use actual QUrl to format and parse the string formThiago Macieira2023-05-181-32/+10
| | | | | | | | | Instead of pretending to be QUrl and doing a poor job at it. I'm not going to implement QUrlQuery parsing and I'll need one option now to store the original, legacy key. Change-Id: Idd5e1bb52be047d7b4fffffd175068c6a82c039b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: QNativeIpcKey: fix big-endian buildsThiago Macieira2023-05-111-7/+17
| | | | | | | | | | | | | We weren't using the LSB in big-endian builds because the bitfield was in the wrong order: it was either using the MSB (in 32-bit builds) or something in the middle for 64-bit. So use quintptr in the bitfield to ensure proper sizing and correct the order. Additionally, we now store the d "pointer" as a quintptr, so as to avoid storing the actual pointer to QNativeIpcKeyPrivate with the LSB set. Change-Id: Idd5e1bb52be047d7b4fffffd17506adb77d52805 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: QSystemSemaphore/SystemV: move up the check for handleThiago Macieira2023-04-281-3/+3
| | | | | | | | | | | This avoids recalculating the native key file name every time we call handle() to ensure the handle exists. The POSIX backend already has the code like this (whence the comment was copied) and the Win32 backend is similar. Change-Id: Idd5e1bb52be047d7b4fffffd175076ec09334ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: QSharedMemory: use q20::construct_atThiago Macieira2023-04-281-9/+2
| | | | | | | | | | | | Commit 72c2cdbc572f8b8b45a57a451e2bc19bb1c53b0c said "Move the helper from qsharedmemory.cpp" but didn't actually move it probably because commit 72c2cdbc572 got cherry-picked to 6.5 but the original introduction to qsharedmemory.cpp didn't. So do it now. Change-Id: Idd5e1bb52be047d7b4fffffd175067701d4ea58c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Silence a warning caused by Concatenation of char16_t and QByteArrayAmir Masoud Abdol2023-03-011-1/+1
| | | | | | Pick-to: 6.5 Change-Id: I34a8ff5587dfa538594b1374cfc819012ce924c1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add missing deprecation guardsYuhang Zhao2023-02-214-10/+19
| | | | | | | | | | | | The deprecated implementation of QSharedMemory and QSystemSemaphore are not correctly guarded by the deprecation macros, and thus it's causing compilation errors when we disable deprecated code. As a drive-by, change the deprecate version from 6.9 to 6.10 as requested. Change-Id: Icfed181c27248b9e1381101a64523419097dd1da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* IPC: don't check for the file's existence before ftok()Thiago Macieira2023-02-201-12/+2
| | | | | | | | | It's documented to return -1 when the file doesn't exist, so we gain nothing by saying a file we ourselves must have created doesn't exist. Change-Id: I12a088d1ae424825abd3fffd171dfa1de6705787 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC/QSharedMemory: add missing includeSamuli Piippo2023-02-101-0/+1
| | | | | | | | | | | | Include header defining MAP_FAILED for SysV sharedmemory to fix: src/corelib/ipc/qsharedmemory_systemv.cpp:175:25: error: ‘MAP_FAILED’ was not declared in this scope; did you mean ‘AF_FILE’? 175 | if (self->memory == MAP_FAILED) { | ^~~~~~~~~~ Change-Id: Ia30539d90faad911909f2556b655758ddea6efdb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix documentation warnings for Qt CoreTopi Reinio2023-02-063-10/+10
| | | | | | | | | | | | | | These linking issues were not caught by documentation testing in the CI. * android-content-uri-limitations.qdocinc: Fix external link title * Fix links to 'Native IPC Keys' * Fix \sa links to 'Inter-Process Communication' * Replace \sa links to non-existent function nativeKeyType() * Drop explicit link to undocumented class QBasicAtomicInteger Change-Id: I041a8cd2301cc2e77b88c085e74e9178e507a7a1 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* IPC/QSharedMemory: make the enums Q_ENUMThiago Macieira2023-01-311-0/+2
| | | | | | | Helps in debugging (qDebug, QCOMPARE, etc.). Change-Id: I12a088d1ae424825abd3fffd171d6f1fea7a9843 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC/QSharedMemory: include the QSystemSemaphore error message in oursThiago Macieira2023-01-311-1/+2
| | | | | | | It may be important. Change-Id: I12a088d1ae424825abd3fffd171d6f284b69a09c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* IPC: don't close(-1)Thiago Macieira2023-01-311-1/+2
| | | | | Change-Id: I12a088d1ae424825abd3fffd171d6ec7ee49348a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>