summaryrefslogtreecommitdiff
path: root/src/libsystemd
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #23309 from DaanDeMeyer/log-contextLuca Boccassi2023-01-206-0/+111
|\ | | | | basic: Add log context
| * device-monitor: Add extra fields to the log context before callbackDaan De Meyer2023-01-083-0/+82
| |
| * sd-bus: Log extra fields when processing bus messageDaan De Meyer2023-01-083-0/+29
| |
* | Merge pull request #26021 from fbuihuu/some-journald-improvementsLennart Poettering2023-01-184-0/+84
|\ \ | | | | | | Some journald improvements
| * | journald: introduce journal_file_parse_uid_from_filename() helperFranck Bui2023-01-164-0/+84
| | |
* | | udev: support '-=' operator for SYMLINKFranck Bui2023-01-172-0/+15
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some (corner) cases, it might be desirable to disable the generation of some persistent storage symlinks that 60-persistent-storage.rules creates. For example on big setups with a high number of partitions which uses the same label name, this can result in a noticeable slow-down in the (re)start of the udevd as there are many contenders for the symlink /dev/disk/by-partlabel. However it's currently pretty hard to overwrite just some specific part of the rule file. Indeed one need to copy and modify the whole rule file in /etc but will lost any upcoming updates/fixes that the distro might release in the future. With this simple patch, one can now disable the generation of the "by-partlabel" symlinks (for example) with the following single rule: $ cat /etc/udev/rules.d/99-no-by-partlabel.rules ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK-="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" Closes #24607.
* | network: Show network and link file dropins in networkctl statusDaan De Meyer2023-01-121-0/+19
| | | | | | | | Fixes #24428
* | Merge pull request #25986 from yuwata/test-netlinkLuca Boccassi2023-01-101-246/+167
|\ \ | | | | | | test-netlink: cleanups
| * | test-netlink: use dummy interface to test assigning new interface nameYu Watanabe2023-01-101-4/+55
| | | | | | | | | | | | Fixes #25981.
| * | test: modernize test-netlink.cYu Watanabe2023-01-091-246/+116
| |/
* | Merge pull request #24939 from msizanoen1/journal-realtime-enforce-consistencyDaan De Meyer2023-01-101-0/+6
|\ \ | | | | | | journal: enforce strict consistency for realtime timestamps on write
| * | journal: enforce strict consistency for realtime timestamps on writemsizanoen12023-01-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure all realtime timestamps in a journal file are strictly ordered on write as a defense-in-depth measure. All known callers of journal_file_append_entry and journal_file_copy_entry, which call this function, should be able to handle the error by rotating the journal. This is especially helpful for systems with RTC local time enabled, where all log entries from initramfs might be recorded as several hours later than it actually is, which won't get caught by journald during log flushing. In those cases, the resulting inconsistency can cause libsystemd to loop infinitely through journal files as observed in `abrt-dump-journal-oops`.
* | | sd-device: introduce device_get_property_int()Yu Watanabe2023-01-102-0/+21
| | |
* | | udev: move device_rename() from device-private.cYu Watanabe2023-01-092-46/+0
| | | | | | | | | | | | The function is used only by udevd.
* | | sd-device: do not directly access entry in sd-device objectYu Watanabe2023-01-091-5/+9
| | | | | | | | | | | | No functional change, just refactoring.
* | | sd-device: make device_set_syspath() clear sysname and sysnumYu Watanabe2023-01-092-4/+4
| |/ |/| | | | | | | | | Otherwise, when a new syspath is assigned to the sd-device object, sd_device_get_sysname() or _sysnum() will provide an outdated device name or number.
* | Merge pull request #25915 from poettering/arm-timer-relLuca Boccassi2023-01-071-0/+3
|\ \ | | | | | | pid1: rework service_arm_timer() to optionally take a relative time v…
| * | sd-event: don't mistake USEC_INFINITY passed in for overflowLennart Poettering2023-01-061-0/+3
| |/ | | | | | | | | | | | | | | | | Let's pass USEC_INFINITY from sd_event_source_set_time_relative() to sd_event_source_set_time() instead of raising EOVERFLOW. We should raise EOVERFLOW only if your addition fails, but not if the input already is USEC_INFINITY, since it's an entirely valid operation to have an infinite time-out, and we should support that.
* | sd_notify: support AF_VSOCKLuca Boccassi2023-01-051-7/+60
|/ | | | | | | | Allow sending notifications via AF_VSOCK, so that VMs can communicate to the hypervisor/VMM that they are finished booting. Note that if the hypervisor does not support SOCK_DGRAM over AF_VSOCK (ie: qemu at the time of writing), SOCK_SEQPACKET will be used instead.
* prioq: make prioq_reshuffle() voidLennart Poettering2022-12-231-4/+1
| | | | | | | | | | | We never use the return value, and it's confusing and kinda pointless what we return there. Hence drop it. Originally noticed by: tristone13th <tristone13th@outlook.com> Alternative to: #25810
* tree-wide: use -EBADF moreYu Watanabe2022-12-213-4/+4
|
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-206-8/+8
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-196-6/+7
| | | | In some places, initialization is dropped when unnecesary.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-1924-55/+54
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* sd-event: never pass negative errnos as signalfd to signalfdZbigniew Jędrzejewski-Szmek2022-12-191-1/+3
| | | | | We treat any negative value as "invalid fd", but signalfd only accepts -1.
* sd-netlink: add a test for rtnl_set_link_name()Nick Rosbrook2022-12-151-0/+27
| | | | | Add a test that verifies a deleted alternative name is restored on error in rtnl_set_link_name().
* sd-netlink: restore altname on error in rtnl_set_link_nameNick Rosbrook2022-12-151-3/+16
| | | | | | | If a current alternative name is to be used to rename a network interface, the alternative name must be removed first. If interface renaming fails, restore the alternative name that was deleted if necessary.
* sd-netlink: do not swap old name and alternative nameNick Rosbrook2022-12-151-13/+0
| | | | | | | | | Commit 434a348380 ("netlink: do not fail when new interface name is already used as an alternative name") added logic to set the old interface name as an alternative name, but only when the new name is currently an alternative name. This is not the desired outcome in most cases, and the important part of this commit was to delete the new name from the list of alternative names if necessary.
* sd-id128: also refuse an empty invocation IDYu Watanabe2022-12-151-0/+3
|
* sd-id128: allow sd_id128_get_machine() and friend to be called with NULLYu Watanabe2022-12-151-18/+10
| | | | It may be useful to check if the machine ID or friends is set or not.
* sd-id128: make sd_id128_get_machine() or friends return -EUCLEAN when an ID ↵Yu Watanabe2022-12-152-15/+19
| | | | | | | | | | | is in an invalid format EINVAL suggests that the caller passes an invalid argument. EIO is for "input/output error", i.e. the error you'd get if the disk or file system is borked, and this error code could be returned by the underlying read/write functions. Let's make the functions return an unambiguous error code.
* sd-id128: fold do_sync flag into Id128FormatFlagYu Watanabe2022-12-122-6/+8
|
* sd-id128: make sd_id128_get_boot() and friend return -ENOSYS when /proc/ is ↵Yu Watanabe2022-12-121-0/+3
| | | | not mounted
* sd-id128: make sd_id128_get_boot() and friend return -ENOMEDIUMYu Watanabe2022-12-121-0/+3
|
* sd-id128: make id128_read() or friends return -ENOPKG when the file contents ↵Yu Watanabe2022-12-124-35/+33
| | | | | | | | | is "uninitialized" Then, this drops ID128_PLAIN_OR_UNINIT. Also, this renames Id128Format -> Id128FormatFlag, and make it bitfield. Fixes #25634.
* sd-id128: several cleanupsYu Watanabe2022-12-122-46/+33
| | | | | | - use SD_ID128_STRING_MAX or friend, - use sizeof(sd_id128_t), - use newly introduced ascii_ishex().
* test: name_assign_type sysattr never exists for enumerated devicesYu Watanabe2022-12-121-7/+8
| | | | As we filtered out network devices in the test.
* sd-device: fix double-freeYu Watanabe2022-12-121-2/+7
| | | | | | | | | | If an attribute is read but the value is not used (i.e. ret_value is NULL), then sd_device_get_sysattr_value() mistakenly frees the read data even though it is cached internally. Fixes a bug introduced by acfc2a1d15560084e077ffb3be472cd117e9020a. Fixes #25702.
* core/unit: allow overriding an ongoing freeze operationmsizanoen12022-12-081-0/+1
| | | | | | | Sometimes a freeze operation can hang due to the presence of kernel threads inside the unit cgroup (e.g. QEMU-KVM). This ensures that the ThawUnit operation invoked by systemd-sleep at wakeup always thaws the unit.
* journal: Ratelimit more log messagesDaan De Meyer2022-12-052-8/+16
| | | | Followup for 8522691d4da.
* journal: Use shared log ratelimit constantDaan De Meyer2022-12-052-10/+9
| | | | | Instead of maintaining two different constants, move the constant to journal-internal.h and share it between files.
* sd-netlink: fix assertion triggered by message_get_serial()Yu Watanabe2022-11-301-1/+2
| | | | | | This fixes an issue introduced by 7b34bae3b1a8726e241a56600a6edf9b3733a4f4. Fixes https://github.com/systemd/systemd/pull/25565#issuecomment-1331353945.
* sd-netlink: append instead of prepend multipart messageYu Watanabe2022-11-261-9/+14
| | | | | | | | | | | | | | | | | | | | | | | Previously, e.g., networkd enumerated network interfaces with ifindex in a decreasing order, as sd-netlink inverses the order of the received multipart messages. Let's keep the order of the multipart messages. Hopefully this changes no behavior, as our code do not depend on the order of the received multipart messages. Before: === Nov 26 09:35:10 systemd[1]: Starting Network Configuration... Nov 26 09:35:11 systemd-networkd[36185]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a Nov 26 09:35:12 systemd-networkd[36185]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a Nov 26 09:35:12 systemd-networkd[36185]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a After: === Nov 26 09:45:18 systemd[1]: Starting Network Configuration... Nov 26 09:45:19 systemd-networkd[38372]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a Nov 26 09:45:19 systemd-networkd[38372]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a Nov 26 09:45:19 systemd-networkd[38372]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a
* sd-netlink: do not link non-multipart messagesYu Watanabe2022-11-261-33/+35
| | | | | | | | Previously, if a single packet contains multiple non-multipart messages, then the messages were linked and saved as a single entry, especially even if the messages has different serial numbers. Though, not sure if the kernel sends such packet. But at least for safety, let's link only multipart messages.
* sd-netlink: split out parse_message_one() from socket_read_message()Yu Watanabe2022-11-261-39/+60
| | | | | No functional change, just refactoring and preparation for later commits.
* sd-netlink: do not use serials currently queuedYu Watanabe2022-11-261-1/+10
|
* sd-netlink: also manage received messages by serialYu Watanabe2022-11-263-13/+41
| | | | | Then, we can easily find the received message matching with requested serial.
* sd-netlink: reimplement received message queueYu Watanabe2022-11-263-68/+46
| | | | | By using OrderedSet and Hashmap, we can drop all memmove() calls. No functional changes, just refactoring.
* sd-netlink: introduce netlink_queue_received_message() and friendYu Watanabe2022-11-263-44/+41
| | | | No functional change, just refactoring.
* sd-netlink: fix segfaultYu Watanabe2022-11-261-1/+2
|