summaryrefslogtreecommitdiff
path: root/sal/osl
AgeCommit message (Collapse)Author
2024-03-18use our internal backtrace API for signal faultsNoel Grandin
so we get nice stacktraces with function names and line numbers on jenkins Change-Id: Id1bfee014d713ead501e5164e5206d9189ec72a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-13Support environment variable expansion in logging.iniStephan Bergmann
The syntax is a stripped-down subset of what is available for variable expansion in bootstrap ini-files: It only supports "${name}", to be replaced with the contents of an environment variable of that name (which itself is not expanded further). If no such environment variable exists, it is replaced with the empty string. If the name contains a NUL character, or if there is a syntax error (i.e., missing opening or closing curly brace), the corresponding text is left unchanged. Also, backslash quoting is supported to allow for verbatim, uninterpreted "${name}" content. But logging.ini is typically used to specify Windows-style LogFilePath=C:\log.txt pathnames containing backslashes, so restrict backslash quoting to just "\$" (replaced with "$") and "\\" (replaced with "\"), and leave all other backslashes alone. (It is not possible to reuse the bootstrap macro expansion code here, as that would cause recursive dependencies. Therefore, this only implements this stripped-down subset.) Change-Id: I8c949a1637a7f14e0672a9cc1c79014edfa336bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164759 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Avoid mentioning Glibc-internal type __fsword_tStephan Bergmann
...and clean up the use of macros here Change-Id: Iede9ff705992d5e229b44b48cd88f5b495f6cee4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164571 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Blind fix for Linux 32-bit buildsStephan Bergmann
...which, according to <https://lists.freedesktop.org/archives/libreoffice/2024-March/091666.html> "32 bit build failure (smb, narrowing)", started to fail with > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx: In function ‘void osl_file_adjustLockFlags(const rtl::OString&, int*, sal_uInt32*)’: > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:71:26: error: narrowing conversion of ‘4283649346’ from ‘unsigned int’ to ‘int’ [-Wnarrowing] > 71 | #define CIFS_SUPER_MAGIC 0xFF534D42 > | ^~~~~~~~~~ > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:795:14: note: in expansion of macro ‘CIFS_SUPER_MAGIC’ > 795 | case CIFS_SUPER_MAGIC: > | ^~~~~~~~~~~~~~~~ etc. My Fedora 39 "Linux man-pages 6.05" statfs(2) man page explains about the struct statfs f_type field of __fsword_t type: "The __fsword_t type used for various fields in the statfs structure definition is a glibc internal type, not intended for public use. This leaves the programmer in a bit of a conundrum when trying to copy or compare these fields to local variables in a program. Using unsigned int for such variables suffices on most systems." But the underlying __FSWORD_T_TYPE looks like it is actually defined as a signed type in /usr/include/bits/typesizes.h. Change-Id: Ida3ae84031c4e48b0d6e69d76b66b4e4facfa1ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164561 Tested-by: René Engelhard <rene@debian.org> Reviewed-by: René Engelhard <rene@debian.org> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-26Simplify a bitMike Kaganski
Change-Id: I660631d43230d9fcc58c405be5138e7d0b7605fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163928 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Define a name for the extended path buffer size, instead of a literalMike Kaganski
Change-Id: If6d40c818e021b3241d6b6b33aceca07c6393511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163926 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Use filesystem::path to avoid MAX_PATH limitationMike Kaganski
And use a buffer of 32767 characters, which is the approximate maximum of Windows API, as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Change-Id: I7b5329d48c936ce0090f0c7908a9d08b56b5a734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163918 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Simplify a bitMike Kaganski
Change-Id: Icc7589bdf5d2e3d061dfa3d34761316d9e9323be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163653 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Move some stuff from path_helper to file_dirvol, and simplifyMike Kaganski
Change-Id: Ic9dcff74c16e5f9c107ca060a3d22866f552c398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163632 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-19Drop obsolete commentsMike Kaganski
They seem to have never been useful, ever since commits 4e093f7f3404d09ee302b119190a968f4f109427 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03) and 0318a882ecfa17030bcccbc05d6c34e3293b0ef2 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03). Change-Id: Ia68ee2f6facd9b64a098c630c3fed0d227e92e2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163587 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-18tdf#55004 Fix backup copy creation for files on mounted samba sharesKevin Ottens
There is an unfortunate interaction between file locking and backup creation at save time. openFilePath has logic to lock a file when opening. This goes through fcntl to set a write lock on the file. Later on, when the user wants to save changes, a backup copy might be created (very likely now since this is the defaults in the settings). To create this backup, the file is opened again for reading. Unfortunately this open call fails due to the lock (even though it is a write lock). This commit changes the behavior. osl_file_adjustLockFlags now checks if the file is on a mounted samba share. If that's the case we force the osl_File_OpenFlag_NoLock flag. No issue is then exhibited at backup creation, allowing the save to proceed properly. Change-Id: Ieab252f9f68598834e13339fc5fcea440f0a4c2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162935 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-11tdf#155710 handle conversion failures due to non-UTF8 stringsPatrick Luby
Windows and Linux paths can be passed as parameters to this function and those paths may not always be UTF8 encoded like macOS paths. Change-Id: I83f5ab491d3c0ddd938e512fbab3213af9ea16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163223 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-11osl_get_system_random_data should return boolStephan Bergmann
Change-Id: I29535d3562fe1b8d05b8df1d6c9ab83e4ead0f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163227 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-28cool#8016 open files using O_CLOEXECNoel Grandin
which is useful to speed up exec'ing/spawning subprograms, and avoids various leakage issues. Change-Id: Ie06ceb6b377e9d5cca8c017c5666564f6bed482f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162647 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2024-01-18-Werror,-Wunused-variable (Emscripten)Stephan Bergmann
Change-Id: Id931281ff716ed0fd26fda1972eb6f5defde7422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162249 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24-Werror=calloc-transposed-argsStephan Bergmann
Change-Id: I7b8b020bdbcd5b4db4cb478cc5fe1225f19ae0cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161268 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-19Fix typoAndrea Gelmini
Change-Id: Ie9848c31ee4969d61470dfb5b570e45848f0914d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160992 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-06loplugin:ostr (macOS)Stephan Bergmann
Change-Id: I85ecdf188dc394d6175a2dd7338147a057fa7766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160392 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-19Extended loplugin:ostr: salStephan Bergmann
Change-Id: Ic8a02784acb9f8981249689541bb6cba1b7fbfb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159682 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-09loplugin:unnecessarygetstr (clang-cl)Stephan Bergmann
Change-Id: I79a1902fb1241f95fd4fa963918207154ae2347b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159134 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-08loplugin:stringstatic, lopluign:ostr (clang-cl)Stephan Bergmann
Change-Id: I7a928a2385286f6d1ab3887c8d315af3f47c052d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159135 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-08-Werror,-Wmissing-field-initializers (clang-cl)Stephan Bergmann
Change-Id: I14c0d223b5f92456c9f160933e3f1eb99bfc6cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159133 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: salStephan Bergmann
Change-Id: If4a7951fd3f9f7f2e081e6b8ba482566260c3235 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158209 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15Repurpose loplugin:stringstatic for O[U]String vars that can be constexprStephan Bergmann
...now that warning about O[U]String vars that could be O[U]StringLiteral is no longer useful Change-Id: I389e72038171f28482049b41f6224257dd11f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-12split up the backtrace implementations into separate filesNoel Grandin
Because I cannot keep what is inside what #ifdef straight in my head Change-Id: Ie986a6928df179fc0e30ca12c6d2a6866ed82078 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157861 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-01Fix iOS build breakages when building on macOS SonomaPatrick Luby
Change-Id: I347e48e9da69c8c9b15581a5afa5c61cdd1d380d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157411 Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Patrick Luby <plubius@neooffice.org>
2023-09-28cid#1546363 Unused valueCaolán McNamara
Change-Id: I416db8a528b4db3f4d4449ec371c0935b29568ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157350 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-26tdf#157448: ignore FILE_ATTRIBUTE_READONLY when FILE_ATTRIBUTE_DIRECTORY is setMike Kaganski
Change-Id: I3fbcf15924b30e2c7fe5501e706cdaf32921e103 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157263 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-09-19tdf#146619 Remove unused includes from sal/ [cpp files]Gabor Kelemen
Change-Id: I11a54c1ddf73c16ce46a0d1c375bf43157870db7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155856 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-30tdf#146619 Remove unused includes from sal/osl/unxGabor Kelemen
Change-Id: Icc9cd3410cde2589ea51385c651243e11cc2f1d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155855 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-14tdf#146619 Remove unused includes from sal/ [headers]Gabor Kelemen
Change-Id: I8fae71e5053950441a2e0920590264c2cb858924 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155546 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-09tdf#146619 Remove unused includes from sal/ [system.hxx]Gabor Kelemen
Change-Id: I30f3ce338e86f1a6dad5e16023ce4c883079fbcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155351 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-08-09Use _beginthreadex instead of CreateThreadMike Kaganski
The documentation for ExitThread [1] has this comment: A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multithreaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions. Since ~all our code uses CRT, be safe and use _beginthreadex. [1] https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread Change-Id: If3e566592e921b00240e08aa759d8cdbc421d44b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155513 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-01tdf#146619 Remove unused #includes from C/C++ filesVenetia Furtado
Change-Id: Ia8b406b6a59086160a5167480c6d3bde6574ffbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155029 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-06-16tdf#143148: Use pragma once instead of include guardsVenetia Furtado
Change-Id: I83c7405c61edd2c92ad624064326ba9c9e971313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153164 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-05-02tdf#155122: implement CtrlHandler on WindowsMike Kaganski
Change-Id: Ia766db91030528c320a27a2d608bd0ec0a34f31b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151261 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-02improve windows backtrace_to_stringNoel Grandin
I want to know the symbol address we actually capture, since we seem to getting duplicates in the output of SymFromAddr, I want to know if the fault is in SymFromAddr, or the backtrace capture call. Change-Id: Iece9c204abb780ae6b67a11e6ba77db816351e8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151254 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-22Introduce sal::systools::CoTaskMemAllocated to use RAII for CoTaskMemFreeMike Kaganski
Change-Id: I5553138bfc8dd989e68b8bcc2be981746e8c1e84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150783 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-17loplugin:stringaddStephan Bergmann
Change-Id: I674655aa4bfe38675dd3c9d677a7d7c64b3eaac8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150478 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-09use more OStringToOUStringNoel Grandin
both because it is more obvious to read, and it takes a string_view, which is handy Change-Id: Ic201cfa0434446f51436d23c33d3f1a919ed65be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150167 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-25loplugin:stringadd in registry..salNoel Grandin
after my patch to merge the bufferadd loplugin into stringadd Change-Id: I1658b960d44780f7d9c447246b1178cb70be5e66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149581 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-23rtl::Static to thread-safe-staticNoel Grandin
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-09tdf#143148 Use pragma once instead of include guardsYousef_Rabia
Change-Id: I1c175753242783d83b5b1edc9b8b4cee2a5bd277 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148449 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-02-28cid#1521506 silence Thread deadlockCaolán McNamara
and cid#1521510 Thread deadlock annotation is getting a bit spamy Change-Id: I3120562c0f7ca996f53d14965efe7af506be6d19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147935 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-24Unify osl_{g,s}etThreadTextEncoding implementation across platformsMike Kaganski
... using a static thread_local variable, as already was used on Windows; this replaces the non-Windows implementation based on pthread_setspecific and friends. Change-Id: Iba42510dea90a9e7d1983ba4af674667055f6dfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147624 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-24Simplify osl_getTextEncodingFromLocale on WindowsMike Kaganski
Drop all the complexity of thread-local storage used only to make EnumSystemLocalesW thread-safe. Just create a BCP47 tag, and use GetLocaleInfoEx to get the codepage. Also use locale name API in imp_getProcessLocale, and avoid the deprecated LCID API. Change-Id: I223564cc6d2cc919b0e5aadda1c12beee21e49f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147625 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-16use std::condition_variable for oslConditionNoel Grandin
which is both faster (because we don't need to allocate a pthread condition) and simpler Change-Id: I0a98432b5106c1c2b8e8ed97cbd779ef2b0c9e4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146996 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-14Let +TIMESTAMP and +RELATIVETIMER use the same osl_getSystemTimeStephan Bergmann
...so that the reported numbers add up if you specify both in SAL_LOG. Also make the code look more symmetric. Change-Id: I8b24dbe7cfa4d7aaebd2069db87a4e9d5fe6e3f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147017 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-27Remove support for 32-bit S390Stephan Bergmann
As discussed in the mailing list thread starting at <https://lists.freedesktop.org/archives/libreoffice/2023-January/089808.html> "Plan to remove dead C++ UNO bridge implementations (bridges/source/cpp_uno/*)", the bridge implementation at bridges/source/cpp_uno/gcc3_linux_s390 is apparently dead and should thus be removed. However, that was the only bridge implementation for 32-bit S390, which implies that support for the 32-bit S390 architecture as a whole is dead and should thus be removed. Change-Id: I18b3b4fa11df4ce693107bad6bbea2fab1c19f26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146058 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-27Remove support for AIXStephan Bergmann
As discussed in the mailing list thread starting at <https://lists.freedesktop.org/archives/libreoffice/2023-January/089808.html> "Plan to remove dead C++ UNO bridge implementations (bridges/source/cpp_uno/*)", the bridge implementation at bridges/source/cpp_uno/gcc3_aix_powerpc is apparently dead and should thus be removed. However, that was the only bridge implementation for AIX, which implies that support for the AIX platform as a whole is dead and should thus be removed. Change-Id: I96de3f7f97d4fd770ff78256f0ea435383688be9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146057 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>