summaryrefslogtreecommitdiff
path: root/src/libsystemd
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #22980 from keszybz/test-help-and-version-outputYu Watanabe2022-04-061-1/+1
|\ | | | | Test --help and --version output in more cases
| * meson: also allow setting GIT_VERSION via templatesZbigniew Jędrzejewski-Szmek2022-04-051-1/+1
| | | | | | | | | | | | | | | | | | GIT_VERSION is not available as a config.h variable, because it's rendered into version.h during builds. Let's rework jinja2 rendering to also parse version.h. No functional change, the new variable is so far unused. I guess this will make partial rebuilds a bit slower, but it's useful to be able to use the full version string.
* | test-sd-device: ignore several errors when running on non-host network namespaceYu Watanabe2022-04-051-22/+38
| | | | | | | | Fixes https://github.com/systemd/systemd/commit/93e04eb43bed6cd1cea344f8fb1002b62155fae2#commitcomment-70387367.
* | test-sd-device: allow several devices removed during running testYu Watanabe2022-04-051-16/+37
| | | | | | | | To make the test stabler.
* | test-sd-device: device ID requires subsystemYu Watanabe2022-04-051-17/+20
| |
* | test-sd-device: log earlier which device is handledYu Watanabe2022-04-051-2/+3
|/ | | | To make debugging the test easier.
* sd-device: actually read diskseq if told soLennart Poettering2022-04-043-23/+33
| | | | | sd_device_get_diskseq() actually called device_read_uevent_file() but that function didn't actually parse DISKSEQ= so far. Fix that.
* sd-device: rename return parameter of sd_device_get_devpath() to retLennart Poettering2022-04-041-3/+4
|
* journald: make sure journal_file_open() doesn't leave a corrupted file ↵Franck Bui2022-04-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | around after failing This can be problematic especially when there's no more free disk space. Consider the following:. When disk space becomes sparse, writting to the system journal can lead to error. In this case journald attempts to make room by rotating the journals, which consists in archiving online journals and opening new ones. However opening new files is likely to fail too and in this case journal_file_open() leaves half initialized file around but in online state. Then the error is propagated and journald switches into volatile mode. Next time a new message is received by journald, it tries to open the persistent system journal file to switch automatically back to persistent mode. When opening the system journal, journal_file_open(), called by managed_journal_file_open_reliably(), finds the persistent system journal left previously and assumes that it was uncleanly closed and considers it as corrupted. The error is reported to managed_journal_file_open_reliably(), which backs the file up and attempts to create a new system file, which fails and leaves a corrupted system file again. Since this is done for each message received by journald, /var/log/message can be filled with backup files pretty quickly. To prevent this, the patch makes sure to delete the newly created file in case of error.
* tree-wide: add a space after if, switch, for, and whileYu Watanabe2022-04-014-5/+8
|
* test: add test for sd_device_open()Yu Watanabe2022-04-011-0/+7
|
* sd-device: introduce sd_device_open()Yu Watanabe2022-04-012-0/+66
| | | | | | | | | | | | We usually open() device node obtained by sd_device_get_devname(). However, the device node corresponds to the sd-device object may be already removed, and another device node with the same path may be created, hence an unexpected device may be opened. The sd_device_open() opens device node, and checks the devnum and diskseq of opened devnum, to avoid the above possibility. Prompted by https://github.com/systemd/systemd/issues/22906#issuecomment-1082736443.
* test: add more tests for sd_device_new_from_xxx()Yu Watanabe2022-04-011-24/+95
|
* sd-device: introduce sd_device_new_from_devname()Yu Watanabe2022-04-012-0/+42
| | | | and sd_device_new_from_path() which takes devname or syspath.
* sd-device: do not ignore critical errors in device_new_from_child()Yu Watanabe2022-03-311-2/+6
|
* sd-device: use path_extract_directory() at one more placeYu Watanabe2022-03-311-15/+11
|
* sd-device: try to get DISKSEQ from uevent fileYu Watanabe2022-03-311-0/+6
| | | | | Otherwise, if the sd-device object is created from e.g. syspath, then sd_device_get_diskseq() returns -ENOENT.
* sd-device: drop /sys/subsystem supportYu Watanabe2022-03-311-18/+12
| | | | Follow-ups for 37cf83d9bfdd9f6859b6f2654d8ec3bbb17873b2.
* Merge pull request #22649 from ↵Zbigniew Jędrzejewski-Szmek2022-03-291-4/+4
|\ | | | | | | | | keszybz/symlink-enablement-yet-again-punish-me-harder Fixups to the unit enablement logic
| * Rename UnitFileScope to LookupScopeZbigniew Jędrzejewski-Szmek2022-03-291-4/+4
| | | | | | | | | | | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/22649/commits/8b3ad3983f5440eef812b34e5ed862ca59fdf7f7#r837345892 The define is generalized and moved to path-lookup.h, where it seems to fit better. This allows a recursive include to be removed and in general makes things simpler.
* | sd-device: introduce device_add_propertyf()Yu Watanabe2022-03-302-0/+22
| |
* | Merge pull request #22885 from poettering/kill-clock-boottime-or-monotonicYu Watanabe2022-03-292-14/+4
|\ \ | | | | | | time-util: assume CLOCK_BOOTTIME always exists
| * | time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-282-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* | | fix typoYu Watanabe2022-03-291-1/+1
|/ /
* | Merge pull request #22861 from poettering/journald-sigtermYu Watanabe2022-03-261-0/+7
|\ \ | | | | | | journald: don't let SIGTERM starve indefinitely
| * | journal-file: if we are going down, don't use event loop to schedule postLennart Poettering2022-03-251-0/+7
| | | | | | | | | | | | | | | The event loop is already shutting down, hence no point in using it anymore, it's not going to run any further iteration.
* | | journal: don't talk about -1 in context of unsigned valuesLennart Poettering2022-03-251-1/+1
| | |
* | | journal-file: merge compress/seal bool args into a single flags paramLennart Poettering2022-03-253-19/+22
|/ / | | | | | | | | | | | | Just some modernization/refactoring. No change in behaviour, just let's do how we do things these days: use flags param instead of list of bools.
* | inotify-util: declare iterator in FOREACH_INOTIFY_EVENT()Yu Watanabe2022-03-242-2/+0
| | | | | | | | | | This also makes the macro check if the event is actually in the buffer, and if it is not, then log about that and finish the loop.
* | test: add tests for device idYu Watanabe2022-03-231-2/+13
| |
* | sd-device: use path_find_last_component() to set driver subsystemYu Watanabe2022-03-231-14/+8
|/
* strv: declare iterator of FOREACH_STRING() in the loopZbigniew Jędrzejewski-Szmek2022-03-231-5/+1
| | | | | | | | | | | Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354. No functional change intended. The type of the iterator is generally changed to be 'const char*' instead of 'char*'. Despite the type commonly used, modifying the string was not allowed. I adjusted the naming of some short variables for clarity and reduced the scope of some variable declarations in code that was being touched anyway.
* Merge pull request #22825 from keszybz/assorted-cleanupsYu Watanabe2022-03-231-10/+7
|\ | | | | Assorted cleanups
| * sd-bus: use _cleanup_ in one more placeZbigniew Jędrzejewski-Szmek2022-03-221-10/+7
| |
* | sd-device: use path_compare() rather than strcmp() for sorting pathsLennart Poettering2022-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sorting paths it actually matters to use the right comparison function. Example: ``` a/x a-b/y a_/z ``` I think people would probably expect this: ``` a/x a-b/y a_a/z ``` but if you use strcmp() instead of path_compare() you'd instead get: ``` a-b/y a/x a_a/z ``` That's because `/` is between `-` and `a` in the ascii table. I think that's quite confusing, and we shouldn#t order that way hence. As discussed: https://github.com/systemd/systemd/pull/22662#discussion_r831174776
* | sd-device: fix trivial typoLennart Poettering2022-03-221-2/+2
| |
* | sd-device-enumerator: support to list only initialized or uninitialized devicesYu Watanabe2022-03-222-29/+53
| |
* | sd-device-enumerator: introduce device_enumerator_scan_devices_and_subsystems()Yu Watanabe2022-03-222-0/+54
| |
* | sd-device-enumerator: drop /sys/subsystem supportYu Watanabe2022-03-221-24/+9
| | | | | | | | | | | | | | | | | | | | This addresses the comment by Lennart https://github.com/systemd/systemd/pull/22662#discussion_r829799863: > /sys/subsystem is preparation for a future that never came. > And given that the main proponent of this left Linux kernel > development (Kay), I doubt this will ever come. So maybe we > should start dropping references to /sys/subsystem/ given it's > unlikely to materialize anytime soon.
* | sd-device-enumerator: introduce device_enumerator_add_prioritized_subsystem()Yu Watanabe2022-03-222-2/+101
| | | | | | | | | | If a subsystem is specified, then matching devices and their parents are listed at first.
* | sd-device-enumerator: introduce device_enumerator_sort_devices()Yu Watanabe2022-03-221-46/+65
| | | | | | | | | | | | | | and devices are sorted when the iteration started. Previously, devices added by udev_enumerate_add_syspath() -> device_enumerator_add_device() are not sorted. This fixes the issue.
* | sd-device-enumerator: introduce device_enumerator_unref_devices() helper ↵Yu Watanabe2022-03-221-10/+17
| | | | | | | | function
* | sd-device-enumerator: introduce sound_device_compare() and ↵Yu Watanabe2022-03-221-38/+52
|/ | | | devpath_is_late_block() helper functions
* sd-event: fix creation of floating event_add_time_change() event sourcesLennart Poettering2022-03-211-1/+1
| | | | | | | | | | We shouldn't auto-disable event sources we create in "floating" mode. Hence don#t use the disabling destructor for event sources. Given that noone else has access to this event source we just allocated anyway there's no point in explicitly disabling it before freeing it. Follow-up for ec75e8e07a0ad972e0c40e0a187e15a8d4fb3d66
* journal-file: port journal_file_open() to openat_report_new()Lennart Poettering2022-03-211-10/+16
| | | | | | | | | | We so far had some magic logic in place that files we open for write with size zero are freshly created. That of course is a bogus assumption, in particular as this code deals with corrupted file systems which oftentimes contain zero size inodes from left-over runs. Let's fix this properly, and actually let the kernel tell us whether it create the file or not.
* sd-journal: refuse invocation of journal_file_open() with O_RDONLY|O_CREATLennart Poettering2022-03-211-0/+3
|
* Merge pull request #22740 from yuwata/listZbigniew Jędrzejewski-Szmek2022-03-2114-60/+14
|\ | | | | tree-wide: declare iterator of LIST_FOREACH() in the loop
| * strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-1910-21/+2
| | | | | | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
| * list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-196-39/+12
| |
* | sd-event: add a single implementation of an event source that runs on clock ↵Lennart Poettering2022-03-182-0/+41
|/ | | | | | | | | | changes We basically had the same code in three places. Let's unify it in a common helper function. event_add_time_change() might be something we should add to the official sd-event API sooner or later, given its general usefulness.