Commit Graph

216 Commits

Author SHA1 Message Date
Max Kellermann b63a794fbe io/FileDescriptor: add [[nodiscard]] 2024-01-13 22:31:16 +01:00
Max Kellermann 491cc8f54d net/SocketDescriptor: add {Read,Write}NoWait()
It was surprising that Read() was non-blocking, but there was no
blocking version of it.  Let's make the non-blocking behavior explicit
and change Read() to be blocking.

In order to find existing callers easily with compiler errors, this
also refactors Read()/Write() to take a std::span parameter.
2023-09-27 11:39:55 +02:00
Max Kellermann cad35a83fb io/FileDescriptor: add Read()/Write() overloads with std::span 2023-09-27 11:14:23 +02:00
Max Kellermann a79454f6a6 io/FileDescriptor: fold CreateSignalFD() into the SignalFD constructor 2023-03-09 18:04:58 +01:00
Max Kellermann b5fbfe9aa6 io/FileDescriptor: fold CreateEventFD() into the EventFD constructor 2023-03-09 17:59:56 +01:00
Max Kellermann d45994268f system/PeriodClock: move to time/ 2023-03-07 12:08:44 +01:00
Max Kellermann ce0b4d5c19 system/Error: remove unused function FormatSystemError() 2023-03-06 20:10:06 +01:00
Max Kellermann 02d108774c test/meson.build: add missing dependencies on libio.a 2023-03-06 19:50:52 +01:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann 66029c405f system/FmtError: move to lib/fmt/ 2022-11-28 23:09:27 +01:00
Max Kellermann 2aa42d2647 lib/fmt/ToBuffer: new library 2022-11-28 22:18:46 +01:00
Max Kellermann 96ae659fdf system/FmtError: new library
Replaces the Format*() functions in system/Error.hxx.
2022-11-28 21:56:12 +01:00
Max Kellermann 25da798e7a system/Clock: compile only on Windows 2022-11-28 21:16:49 +01:00
Max Kellermann 8fe29f5728 release v0.23.11
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmOE2gINHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFEiugD/9OKEBR9tfrJvtVGuO2INtaMeAzlZ9swFYCkphF
 i2R7H9/9E0AvtgyFi/6EDNgFCBbnUzSIGbtdc78EwHE6GxeK/Q9G1fo9AC+6I8Ww
 2ScEV9NKIMGTbsRvoomKnGZWpvNTpadPlLa02bckXpKK3wQUPhLb8RAH3newZ0RC
 OXs+mzSRReRKpjUBxZsI+6f+aajM6/PoiOmBbrNbYbsSlkpKtLeW8ptkQxPME12B
 QD9e7yf9ZndYfoHJdmmPxfvIGIEDATCs8MzY8tFUYkhdbEk0C0aRZQTODQS3DATp
 0wrmlJzmceiN2nhKjthg1bvC+jobPywIuDZdrEuyFumN/EZxldKAUCezduV+Dohm
 UPkQp5yiSTZRZVYQMEOSW6cMndC7URFrtn643+jV7SGkTmmV6nVOyg4e9GR1BakT
 rY0nZGr7dwEInODkA5lXMhph3u8aZa2Mfo5B8m2aloGVHYOX1t3bH07ym5oJiviq
 eiQx/bMpaS6ECCSnmHPGDl0NHHWDiPGv96EyPO2N9oeWiNuZz/Fla0N99Mi/JbVI
 EpSHF89F+bfiw5qIeet93ZrXjwQjMuC6zofZ1jbVFek2eKszCZSNdx233VLz170G
 edyN5Vxy3r24YBy/nrZVXPRxsj65KOxF1TZ9SzHKmfnuU45a+JZjZuWz5yedPn2/
 3fy7oA==
 =eLEd
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.11'

release v0.23.11
2022-11-28 17:00:38 +01:00
Max Kellermann 73b5d0a9b9 system/Error: truncate the snprintf() return value
snprintf() does not return the (truncated) length actually written,
but the length that would be needed if the buffer were large enough.
This API usage mistake in FormatLastError() can lead to overflow of
the stack buffer, crashing the process (Windows only).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1676
2022-11-28 09:42:37 +01:00
Max Kellermann cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann bc3415ce8b Copyright year 2022 2022-06-30 09:41:53 +02:00
Max Kellermann 0c2c20254b system/Error: add IsLastError() 2022-06-13 21:23:11 +02:00
Max Kellermann 193d6a4fd4 system/Error: add LastErrorCategory() 2022-06-13 21:19:20 +02:00
Max Kellermann acfeec7a5d system/Error: add [[gnu::const]] attribute 2022-06-13 21:16:24 +02:00
Max Kellermann c074338f4c system/EventFD: include cleanup 2022-05-31 12:43:26 +02:00
Max Kellermann 23dd613ff9 system/VmaName: suppress -Wunused-parameter 2022-05-19 14:01:57 +02:00
Max Kellermann 313b092ba8 system/meson.build: depend on libfmt, not our log.a
Fixes linker error.
2022-05-19 13:25:02 +02:00
Max Kellermann 3ae660ca90 system/VmaName: new library 2022-04-26 20:31:56 +02:00
Max Kellermann 5ad4f3c54b system/EventPipe: include cleanup 2021-12-08 19:32:06 +01:00
Max Kellermann 18f64b5fb7 system/FatalError: remove obsolete library 2021-10-13 16:53:01 +02:00
Max Kellermann f510564d9d more [[gnu::...]] attributes 2021-10-13 12:07:05 +02:00
Max Kellermann 6f539cfcd6 Partition, ...: use libfmt for logging 2021-06-24 21:40:11 +02:00
Max Kellermann 0185d58a2b Log: add libfmt support 2021-06-24 21:14:42 +02:00
Max Kellermann 96707c0426 release v0.22.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmClOSYQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEkODD/49e950HLmZE8x3rmyeEEsgdvHkOVpPlKHo
 +wsmSsi+N0sQKgEOffSYyL0MRWaQqzRMnl1EcEVErCfQl5f1mOw9+TL4f5ZEjVNw
 CQFMy1awHtCfktgF5zq6NzXD3nor9mkjiP733x/kGcsxwfk/Y4radqUBKJ5Y4a2B
 YSg35a/YTOfLCmb9WBquwAi22x7AkyBzyrY3ToCzynVuaNcT3gvLsAAMFzRUKpqD
 QEoCtUxJ4CQayjWjtG/bBCs2TVSmJvovhM2xB4Jnm+MeZz+bKI0y+ALW2Wk0Agnd
 qxDqyCEnvHi5pf8i9usl4/A63VDC7HHj9kDSLtPLGTijv+7Wvvr4kNpwm2DuJ4q1
 1pOEgT480ryK1FPyO6XnYCk616NqjgMbplr6SQ1DuVpIddWdiGARoge/WiNvsbT9
 pnEp0q9V3cQmuJ30LlskMJHAPyrE3KSrO1s+4P2zUeirwnMnOCPdq+gT+lRw4GNG
 OqLFEDHaELgSaZxInCN8RCXdLMrpuvKm+FQQApU1KwbYPXIassR14yt6BPpjxqea
 vkvFLtpwFWthNPLkujak5rDqAPvbHzAeOfaOiZelzd21nl/1omiMXSXRcJkEjONi
 JC5VWJpi1PHMXocq6AcOQT/9XhIH4uDA+Xghn7CURBTB6WoB954TSmuVIjXTfgAv
 XQYqRR+7Yw==
 =Gtzo
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.7'

release v0.22.7
2021-05-19 18:43:19 +02:00
Max Kellermann a169a05e41 win32, ...: avoid including windows.h
Include the most specific header documented by MSDN instead.
2021-05-19 17:25:32 +02:00
Max Kellermann 6cdb3ff21e use [[gnu::pure]] instead of gcc_pure
This is semi-standard and doesn't require the util/Compiler.h header.
2021-02-12 18:34:16 +01:00
Max Kellermann 51f110a990 system/EventPipe: use class Unique{Socket,File}Descriptor 2021-01-11 17:51:22 +01:00
Max Kellermann 17eae74c1c system/EventFD: Get() returns FileDescriptor 2021-01-11 17:38:30 +01:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann 155fc8fa5a include cleanup 2020-07-23 16:26:18 +02:00
Max Kellermann 8c1d78873d system/KernelVersion: new library 2020-05-05 14:30:56 +02:00
Max Kellermann 9815d10137 system/FileDescriptor: move to io/ 2020-05-05 14:27:03 +02:00
Rosen Penev 3540cf26b1 replace exit and _exit with std variants
_exit and std::_Exit are identical, expect the latter is standard C++.

Added several functions to the std namespace as a result of headers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26 18:44:09 -07:00
Rosen Penev 97425d56e7
remove gcc_unused
[[maybe_unused]] (introduced in C++17) is standard C++.

https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
says that this is equivalent to the GNU unused attribute.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev 591f51f3d3
replace noreturn attribute with standard C++ version
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:18 -07:00
Rosen Penev a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Rosen Penev c846ee0d1b
replace stdarg.h with cstdarg
The former was deprecated in C++14. The Standard says they are the same:

The contents of the header<cstdarg>are the same as the C standard library
header<stdarg.h>, with the following changes: The restrictions that ISO C
places on the second parameter to the va_start macro in header<stdarg.h>
are different in this International Standard. The parameter parmN is the
rightmost parameter in the variable parameter list of the function
definition (the one just before the...).219If the parameter parmN is a
pack expansion (17.5.3) or an entity resulting from a lambda capture
(8.1.5), the program is ill-formed, no diagnostic required. If the
parameter parmN is of a reference type, or of a type that is not
compatible with the type that results when passing an argument for which
there is no parameter, the behavior is undefined.

Also changed va_list to the std:: namespace version, which is the same.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:03:12 -07:00
Rosen Penev 69a51e12c9
replace signal.h with csignal.h
The former was deprecated with C++14. The standard says they are the same:

The contents of the header<csignal>are the same as the C standard library
header<signal.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 18:56:51 -07:00
Rosen Penev edc4989d9c
change errno.h to cerrno
The former is deprecated by C++14. It's also functionally the same.

From the standard:

19.4
The header<cerrno>is described in Table 43. Its contents are the same as
the POSIX header<errno.h>,except that errno shall be defined as a macro.
[Note: The intent is to remain in close alignment with the POSIX
standard.] A separate errno value shall be provided for each thread.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:51:16 -07:00
Rosen Penev ab9f5d2067
replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann 72ec641f0d *: use `auto` 2020-02-01 14:02:43 +01:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann a72878c5b9 io/FileDescriptor: add method FullRead() 2019-12-17 20:21:11 +01:00
Max Kellermann 683d5848f4 release v0.21.17
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl34Bg0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEmOvD/4/gBb1kIOQduz+ZV79LHPGeqDoIJBm8VWg
 t9R1Mpt0flqC8+RcXFK/P0kUifBO5fu+a1DbHHijUvDNLYpUsCiXyxTpES9gGh54
 7djEeqi1suoLpMUt4zkUEHGTp2dGUTmyewE1TuF1sZi2xlPgOeWXEX7a0xWs4zdG
 WI4CojUSkQGVAI2XZ7xIKP1v368B9F6AbqTK4zkzjNbTCv5VfESGlxdde0NXqU2e
 /bjil1aT2kdcks3ddeT4llyGIUzn1PzOyA6LQvmVXLSAtz9Rr/hHA+qkR19a4CCt
 PXxE0xClhhmZglzPuES0sRqBbwG99dPzA1ajTOtielwMrlFx+OceRfUnfdgqpPqd
 HTkEzMGsQ2PMMbE8R9DF5GU8B9xAcnKMh2g3/9KGStbocGSFWahLRObkHEhC5uJu
 g5ncQio3o/AtlBirywn/lkd6CYRDvMheMVOTHtv4/ZN0hIONMXCb6u1SQfqnX7qb
 fRP2UP9VUpPI9MUfOn/0uqM8/zXb5SMRe78p9UIYCF+mEDST190VxsdMjiBp/Xug
 Pktlec72iyiNHCavp04nXkt2kBrfSIFFaAQ0Qlp4huRV1k3Ur672NHtwuPLv8ORH
 xLec8On6nWVuuu5kC0F+4KxTlu6u2CMwH+wVr7t/D4rrD1iVo39MtElTBawZZC6+
 8EapnNHyGg==
 =A+Dp
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.17'

release v0.21.17
2019-12-16 23:44:20 +01:00