summaryrefslogtreecommitdiffstats
path: root/src/common-lib/unixsignalhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make watchdog kills use a distinct Unix signal and ExitStatusRobert Griebl2025-06-061-0/+13
| | | | | | | | | | | | | By raising an otherwise unused system signal (*), the System UI can now distinguish between crashes, forced kills from the sys-ui and also kills by the watchdog. (*) SIGSTKFLT on Linux x86 and ARM and SIGEMT on Linux MIPS, BSD and QNX. Change-Id: I5cdb9084c1f822c36d24cbb0905479e18a3f1b69 Pick-to: 6.10 Reviewed-by: Dominik Holland <[email protected]>
* Crashhandler: reinstall ourselves, if our handlers got disconnectedRobert Griebl2024-10-291-36/+87
| | | | | | | | | | | | One example is Squish which resets ALL signal handlers to default, if it is instructed to NOT handle signals (this is actually a bug in Squish). Since we have to live with these kinds of tools, the better option is to check at runtime, if the AM's handler got disabled. Pick-to: 6.8 Change-Id: Idd122adc89130a869b1a37cc6c343f07c285c46c Reviewed-by: Dominik Holland <[email protected]>
* Clazy: fixesRobert Griebl2024-01-081-3/+3
| | | | | | Change-Id: I2f9f0245e1d0ac0c6ee618a0c90f31aaa1465e93 Pick-to: 6.7 Reviewed-by: Dominik Holland <[email protected]>
* Fix clang warnings on macOSRobert Griebl2023-12-151-3/+3
| | | | | | Change-Id: Ib8d83062197ff5f18dfd5713462b463eb772fb7b Pick-to: 6.7 Reviewed-by: Dominik Holland <[email protected]>
* Clang-Tidy / Clazy warnings and modernizationRobert Griebl2023-08-011-2/+2
| | | | | Change-Id: Iafd5fbd3636068caa36f11e121233c5732f7a545 Reviewed-by: Bernd Weimer <[email protected]>
* Port from qAsConst to std::as_constMarc Mutz2023-01-141-5/+5
| | | | | | | | QT_NO_AS_CONST is now globally enabled in qtbase. Pick-to: 6.5 Change-Id: Ifc2eab1c902e75f5dbfc38ef9a62b29b5c91bc61 Reviewed-by: Jörg Bornemann <[email protected]>
* Fix pipe in signal handler (QNX only)Bernd Weimer2022-07-071-8/+2
| | | | | | Change-Id: I4a3ce348da32a4a338c39d74d933b9ce49917a80 Pick-to: 6.4 Reviewed-by: Robert Griebl <[email protected]>
* Support QNX (unoffically)Bernd Weimer2022-07-011-2/+2
| | | | | | | | | | | | | | | | | Allow to build for QNX and run in single-process mode. There are a few limitations, e.g. filesystem mount monitoring and startup timer are not supported and there's only a rudimentary stack trace in case of a crash, etc. Since Qt Network doesn't provide a HW address and there's currently a cross-compilation issue, the following options need to be passed to configure: -DINPUT_hardware_id=dummyHwId -DQT_FORCE_BUILD_TOOLS=ON Change-Id: Ia58d09d15a781666fe788f21dfe9c7af7a2a74ef Pick-to: 6.4 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Robert Griebl <[email protected]>
* Use SPDX license identifiersDominik Holland2022-06-151-30/+4
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I09660e42dea769d720ff30e652485d9861cea965 Reviewed-by: Robert Griebl <[email protected]>
* Work around unused result issue in gccBernd Weimer2022-03-211-2/+4
| | | | | | | | This fixes compilation errors even for older versions of glibc. Change-Id: I1ee1be6ad311a0ba47d8e83083bf9ad7bb43f4bf Pick-to: 6.3 6.3.0 6.2 6.2.4 5.15 Reviewed-by: Robert Griebl <[email protected]>
* Allocate the signal stack using an anon mappingRobert Griebl2022-03-211-10/+13
| | | | | | Change-Id: I970316adf175b2b09c6c82dfcf9b1d47c70d7e6a Pick-to: 6.3 6.3.0 Reviewed-by: Bernd Weimer <[email protected]>
* Avoid race condition during Unix signal handlingRobert Griebl2022-03-011-12/+18
| | | | | | | | | | Handling a signal in the "Forwarded" handler while simultaneously applying a signal mask reset in the low-level handler would lead to a race condition accessing m_handlers. Change-Id: If7d27b7c3515faef894c585cd73bc461e8444ee5 Pick-to: 5.15 Reviewed-by: Dominik Holland <[email protected]>
* Fix glibc compatibility problemRobert Griebl2021-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | glibc 2.32 deprecated sys_siglist: the symbol is not available to link against anymore, but it is available at runtime for apps that have been linked against an older glibc version. Our problem is now that the CI builds release version of the AM against an older glibc, which works for the appman binary itself, but if you want to compile a custom appman executable on a modern, glibc 2.32 based system, you get a "missing symbol" linker error in libQt6AppManCommon.a(unixsignalhandler.cpp.o) Detecting this at runtime would be a nightmare for little gain, so we fall back to using the non-async-signal-safe strsignal() function when initially building against a glibc < 2.32. Change-Id: I1e702c5ee00e2725fe6f76f9ce001c099ec72eea Pick-to: 6.2 5.15 Fixes: AUTOSUITE-1667 Reviewed-by: Dominik Holland <[email protected]>
* SIGSTKSZ is not a constexpr anymore in glibc 2.34+Robert Griebl2021-10-061-1/+1
| | | | | | | | https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD#l12 Change-Id: I4f2156b5902d2bdd551c4f0f0140651561e56e2d Pick-to: 6.2 5.15 Reviewed-by: Dominik Holland <[email protected]>
* Update copyright headers to 2021 an finally switch to the GPLRobert Griebl2021-06-011-24/+13
| | | | | | | | | Also removed all the SPDX tags and -QTAS license extensions. Change-Id: Ibd10fe37afcbba832831d027cf2f1891ca0226c0 Fixes: AUTOSUITE-1648 Fixes: AUTOSUITE-1646 Reviewed-by: Dominik Holland <[email protected]>
* Replace deprecated sys_siglist array usageBernd Weimer2020-09-211-0/+4
| | | | | | | | | The array has been deprecated and from glibc 2.32 it is not available any more. This patch replaces it with the sigdescr_np function for glibc >= 2.32. Change-Id: Id5d4cfc86555d5863d6e7428c4fdc382b09df406 Reviewed-by: Robert Griebl <[email protected]>
* Build optimization: include all moc cpps directly in the main cpp fileRobert Griebl2020-08-111-0/+2
| | | | | | | | This is a Qt module policy and helps a lot with build times -- especially on CI setups. Change-Id: I90574deb7e7b215054a5037b99ee4e7c7a040568 Reviewed-by: Thomas Senyk <[email protected]>
* Increase signal stack sizeBernd Weimer2020-03-201-2/+4
| | | | | | | | | | The crash info sometimes didn't inclulde the QML backtrace, because the signal stack was too small. This was probably hidden in the past by two additional, but redundant stack allocations. Also cleaned-up some code. Change-Id: I4173a1687ae7f2548d2609b4a26074766dfd211d Reviewed-by: Robert Griebl <[email protected]>
* Improve crash handlerBernd Weimer2020-03-091-18/+19
| | | | | | | | | | | | - Added two other signals, that generate a core dump by default to the crash handler: SIGQUIT and SIGSYS. - Sending SIGABORT to processes in the same group would generate a core dump of another process - using SIGTERM now. - Setup alternate signal stack only once and hence allocate the memory only once (there can be only one alternate signal stack) Change-Id: I861505668dc2484730ec79410612f55698b695c4 Reviewed-by: Robert Griebl <[email protected]>
* Rename from Luxoft AM to Qt AMRobert Griebl2019-08-051-1/+1
| | | | | | Change-Id: I84bbd9e7f735ed1864804a9887d3a02b7c925e53 Reviewed-by: Vladimir Minenko <[email protected]> Reviewed-by: Bernd Weimer <[email protected]>
* Update copyright statementsRobert Griebl2018-12-181-1/+2
| | | | | | | | - added 2019 - everything is (c) Luxoft instead of Pelagicore from now on Change-Id: I82f874f0b0601deae1bb39347821edaf3c4cc6d8 Reviewed-by: Dominik Holland <[email protected]>
* Fix calling resetToDefault right before re-installing a signal handlerRobert Griebl2018-11-091-1/+2
| | | | | | | | | | While the reset was lingering (until the next signal was received), every new handler installation would immediately be reset afterwards. Also fixed a copy&paste error in a debug output. Change-Id: Idc72af8c30aca49461b9b4d852cf36a7cb78ce69 Reviewed-by: Bernd Weimer <[email protected]>
* Add support for Ctrl+C handling on WindowsRobert Griebl2018-08-071-2/+33
| | | | | | | | Windows delivers signals in a separate thread instead of a signal handler context, which makes it quite easy to get the data into the main thread. Change-Id: Ib621b5d336134ec025d17079d61800d22dfc3778 Reviewed-by: Daniel d'Andrada <[email protected]>
* Clang code model fixesRobert Griebl2018-04-171-1/+1
| | | | | Change-Id: I46bb240aa843c297e83278a4f1b29f95be093c83 Reviewed-by: Thomas Senyk <[email protected]>
* Update Pelagicore copyright headers to 2018Robert Griebl2018-02-071-1/+1
| | | | | Change-Id: I8d9278053ccdef5a57e51753aa6157941ebcee52 Reviewed-by: Dominik Holland <[email protected]>
* common-lib cleanupRobert Griebl2017-03-131-0/+1
| | | | | | | | | | global.{h,cpp} and utilities.{h,cpp} have become the kitchensink of the AM. This commit splits out the logging functionality from global.{h,cpp} into the new files logging.{h,cpp} and also the crash handling functionality from utilities.{h,cpp} into the new crashhandler.{h,cpp} Change-Id: Idffdb424b1cbd8d92eb60b0ac7f08e17a46c749b Reviewed-by: Dominik Holland <[email protected]>
* Make build on Windows warning freeRobert Griebl2017-03-071-0/+2
| | | | | Change-Id: I98ecf02829651ee6bcb1cb4dccb9ba17de978d50 Reviewed-by: Dominik Holland <[email protected]>
* Make all tests valgrind leak freeRobert Griebl2017-02-221-1/+7
| | | | | Change-Id: I39ccfe6710ab4f91c48dc1d1bd300024820fbaa2 Reviewed-by: Dominik Holland <[email protected]>
* unixsignalhandler: suppress warningsGordan Markuš2017-01-251-3/+7
| | | | | | | | warning: ignoring return value of ‘int pipe(int*)’, declared with attribute warn_unused_result [-Wunused-result] warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] Change-Id: Ifc5667d7236e0bd1c85968e61f8b3fbb1d3a205a Reviewed-by: Robert Griebl <[email protected]>
* Updated Pelagicore AG copyright to 2017Robert Griebl2017-01-161-1/+1
| | | | | | | Also added a few pro file tweaks to make this search&replace easier next year. Change-Id: I2d1153d62bfe558075009abcd8cad491f149c93f Reviewed-by: Dominik Holland <[email protected]>
* Synchronized app exiting between the AM and the controllerRobert Griebl2016-12-191-0/+198
If you start an application via the controller with attached i/o, ... * you can now stop the application via Ctrl+C or SIGTERM * the controller process will exit if the AM detects that the app has exited Also added a generic unix signal handler class, that allows for easy handling of signals both via classic Unix callback functions, as well as asynchronously within the Qt event loop. On top, needed to fix the broken-by-design D-Bus enum handling. Change-Id: Iaa2790c40d44ac06b8ac99f4033887dfe17baa04 Reviewed-by: Bernd Weimer <[email protected]>