]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoman: document REMOTE_ADDR/REMOTE_PORT along with the other env vars 26579/head
Lennart Poettering [Fri, 24 Feb 2023 09:21:49 +0000 (10:21 +0100)] 
man: document REMOTE_ADDR/REMOTE_PORT along with the other env vars

2 years agomanager: be more careful with env var clean-up
Lennart Poettering [Fri, 24 Feb 2023 09:15:35 +0000 (10:15 +0100)] 
manager: be more careful with env var clean-up

Let's add some more env vars we nowadays set for activated services to
the list of env vars we strip from the environment block we pass on.

2 years agoMerge pull request #26574 from YHNdnzj/sd-login-new-interface
Yu Watanabe [Fri, 24 Feb 2023 00:20:52 +0000 (09:20 +0900)] 
Merge pull request #26574 from YHNdnzj/sd-login-new-interface

sd-login: add two interfaces for retriving session info

2 years agoman,catalog: fix typo
Yu Watanabe [Thu, 23 Feb 2023 23:52:39 +0000 (08:52 +0900)] 
man,catalog: fix typo

Follow-up for #26448.

2 years agoshared: move cg_set_access() declaration to right header file
Lennart Poettering [Thu, 23 Feb 2023 17:27:43 +0000 (18:27 +0100)] 
shared: move cg_set_access() declaration to right header file

This function was moved from cgroup-util.c to cgroup-setup.c a while
back, but the prototype in the matching header files wasn't migrated.
Let's fix that.

2 years agojournal-file: Improve debug messages
Daan De Meyer [Thu, 23 Feb 2023 14:55:36 +0000 (15:55 +0100)] 
journal-file: Improve debug messages

2 years agojournal-file: Fix return value in bump_entry_array()
Daan De Meyer [Thu, 23 Feb 2023 14:40:38 +0000 (15:40 +0100)] 
journal-file: Fix return value in bump_entry_array()

2 years agosystemctl: use bus_message_hash_ops
Yu Watanabe [Thu, 23 Feb 2023 12:49:29 +0000 (21:49 +0900)] 
systemctl: use bus_message_hash_ops

2 years agoman: link up sd_event_add_memory_pressure() more
Lennart Poettering [Thu, 23 Feb 2023 16:22:57 +0000 (17:22 +0100)] 
man: link up sd_event_add_memory_pressure() more

2 years agosd-login: add sd_session_get_start_time 26574/head
Mike Yuan [Thu, 23 Feb 2023 17:45:50 +0000 (01:45 +0800)] 
sd-login: add sd_session_get_start_time

2 years agosd-login: add sd_session_get_username
Mike Yuan [Thu, 23 Feb 2023 16:48:10 +0000 (00:48 +0800)] 
sd-login: add sd_session_get_username

2 years agoMerge pull request #26258 from DaanDeMeyer/boot-smbios
Daan De Meyer [Thu, 23 Feb 2023 14:59:18 +0000 (15:59 +0100)] 
Merge pull request #26258 from DaanDeMeyer/boot-smbios

stub: Read extra kernel command line items from SMBIOS

2 years agoMerge pull request #26535 from yuwata/systemctl-list-cleanups
Yu Watanabe [Thu, 23 Feb 2023 12:38:13 +0000 (21:38 +0900)] 
Merge pull request #26535 from yuwata/systemctl-list-cleanups

systemctl-list: several cleanups

2 years agoMerge pull request #26560 from yuwata/journal-send-fix-memleak-and-cleanups
Yu Watanabe [Thu, 23 Feb 2023 12:37:20 +0000 (21:37 +0900)] 
Merge pull request #26560 from yuwata/journal-send-fix-memleak-and-cleanups

sd-journal: several fixlets and cleanups for sd_journal_send()

2 years agocore/dbus-socket: check the socket path is absolute
Yu Watanabe [Thu, 23 Feb 2023 09:03:50 +0000 (18:03 +0900)] 
core/dbus-socket: check the socket path is absolute

In config_parse_socket_listen(), we have checked the path is absolute,
however we have not in the dbus method.

2 years agoexecute: pass ambient caps from PAM through to invoked service
Lennart Poettering [Wed, 22 Feb 2023 12:06:29 +0000 (13:06 +0100)] 
execute: pass ambient caps from PAM through to invoked service

If a PAM service sets some ambient caps, we should honour that, hence
query it, and merge it with our own ambient settings.

This needs to be done manually since otherwise dropping privs via
setresuid() will undo all such caps, and we need to manually tweak
things to keep them.

2 years agoMerge pull request #26563 from dtardon/fd-init
Zbigniew Jędrzejewski-Szmek [Thu, 23 Feb 2023 10:43:09 +0000 (11:43 +0100)] 
Merge pull request #26563 from dtardon/fd-init

Initialize fds with -EBADF + drop one unneeded initialization

2 years agoMerge pull request #26556 from keszybz/list-timers-optimize-left
Zbigniew Jędrzejewski-Szmek [Thu, 23 Feb 2023 10:37:48 +0000 (11:37 +0100)] 
Merge pull request #26556 from keszybz/list-timers-optimize-left

Do not say " left" on every timer in LEFT column

2 years agosystemctl: cleanups for list-paths 26535/head
Yu Watanabe [Wed, 22 Feb 2023 07:28:43 +0000 (16:28 +0900)] 
systemctl: cleanups for list-paths

- Rename struct path_info -> PathInfo,
- Drop struct path_infos,
- Use CLEANUP_ARRAY(),

No functional change, just refactoring.

2 years agosystemctl: cleanups for list-automounts
Yu Watanabe [Wed, 22 Feb 2023 07:12:29 +0000 (16:12 +0900)] 
systemctl: cleanups for list-automounts

- Rename struct automount_info -> AutomountInfo,
- use CLEANUP_ARRAY(), and etc.

No functional change, just refactoring.

2 years agosystemctl: cleanups for list-timers
Yu Watanabe [Wed, 22 Feb 2023 06:57:33 +0000 (15:57 +0900)] 
systemctl: cleanups for list-timers

- Rename struct timer_info -> TimerInfo,
- use CLEANUP_ARRAY().

No functional change, just refactoring.

2 years agosystemctl: cleanups for list-sockets
Yu Watanabe [Wed, 22 Feb 2023 06:20:20 +0000 (15:20 +0900)] 
systemctl: cleanups for list-sockets

- Rename struct socket_info -> SocketInfo.
- Drop own_triggered field, and always copy the triggered field.
- Use CLEANUP_ARRAY().

No functional changes, just refactoring.

2 years agovmm: Modernize get_smbios_table() 26258/head
Daan De Meyer [Wed, 22 Feb 2023 16:04:58 +0000 (17:04 +0100)] 
vmm: Modernize get_smbios_table()

2 years agostub: Read extra kernel command line items from SMBIOS
Daan De Meyer [Mon, 30 Jan 2023 15:26:50 +0000 (16:26 +0100)] 
stub: Read extra kernel command line items from SMBIOS

Let's read more kernel command line arguments from SMBIOS OEM string
io.systemd.stub.kernel-cmdline-extra. This allows adding debug kernel
command line arguments when booting in qemy without having to modify
the UKI.

2 years agobootctl: drop unneeded initialization 26563/head
David Tardon [Thu, 23 Feb 2023 08:50:26 +0000 (09:50 +0100)] 
bootctl: drop unneeded initialization

2 years agovmm: Add smbios_find_oem_string()
Daan De Meyer [Mon, 30 Jan 2023 15:26:14 +0000 (16:26 +0100)] 
vmm: Add smbios_find_oem_string()

This function can be used to find SMBIOS strings in the SMBIOS Type 11
table.

2 years agovmm: Add more const
Daan De Meyer [Mon, 30 Jan 2023 20:15:12 +0000 (21:15 +0100)] 
vmm: Add more const

SMBIOS tables are immutable, so let's access it via const pointers
where possible.

2 years agoefi-string: Add efi_memchr()
Daan De Meyer [Tue, 31 Jan 2023 14:39:40 +0000 (15:39 +0100)] 
efi-string: Add efi_memchr()

2 years agotree-wide: initialize fds with -EBADF
David Tardon [Thu, 23 Feb 2023 08:48:54 +0000 (09:48 +0100)] 
tree-wide: initialize fds with -EBADF

2 years agoMerge pull request #26458 from yuwata/core-network-namespace-remount-sysfs
Lennart Poettering [Thu, 23 Feb 2023 08:44:06 +0000 (09:44 +0100)] 
Merge pull request #26458 from yuwata/core-network-namespace-remount-sysfs

core: remount sysfs when network and mount namespace are enabled

2 years agosd-event: fix error handling
Yu Watanabe [Wed, 22 Feb 2023 22:31:01 +0000 (07:31 +0900)] 
sd-event: fix error handling

Follow-up for 6d2326e036ceed30f9ccdb0266713c10a44dcf6c.

2 years agoMerge pull request #26559 from yuwata/sd-event-memory-pressure-follow-ups
Lennart Poettering [Thu, 23 Feb 2023 08:27:20 +0000 (09:27 +0100)] 
Merge pull request #26559 from yuwata/sd-event-memory-pressure-follow-ups

sd-event: follow-ups for memory pressure event source

2 years agosystemctl-list-units: drop unused return value
Yu Watanabe [Wed, 22 Feb 2023 07:38:36 +0000 (16:38 +0900)] 
systemctl-list-units: drop unused return value

2 years agosystemctl-list-units: fix memleak on error
Yu Watanabe [Wed, 22 Feb 2023 07:38:18 +0000 (16:38 +0900)] 
systemctl-list-units: fix memleak on error

2 years agosd-journal: fix memleak and freeing invalid pointers 26560/head
Yu Watanabe [Thu, 23 Feb 2023 02:39:42 +0000 (11:39 +0900)] 
sd-journal: fix memleak and freeing invalid pointers

This also makes
- use GREEDY_REALLOC() or GREEDY_REALLOC0(),
- use CLEANUP_ARRAY() macro.

2 years agoio-util: drop double evaluation in IOVEC_INIT_STRING()
Yu Watanabe [Thu, 23 Feb 2023 04:10:31 +0000 (13:10 +0900)] 
io-util: drop double evaluation in IOVEC_INIT_STRING()

This also makes IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() identical.

2 years agoio-util: introduce IOVEC_NULL
Yu Watanabe [Thu, 23 Feb 2023 04:09:46 +0000 (13:09 +0900)] 
io-util: introduce IOVEC_NULL

2 years agoio-util: introduce iovec_array_free()
Lennart Poettering [Thu, 23 Feb 2023 02:42:11 +0000 (11:42 +0900)] 
io-util: introduce iovec_array_free()

It will be used in later commits.

2 years agotest-execute: add test for PrivateNetwork= with/without mount namespacing 26458/head
Yu Watanabe [Fri, 17 Feb 2023 05:26:29 +0000 (14:26 +0900)] 
test-execute: add test for PrivateNetwork= with/without mount namespacing

2 years agocore/namespace: mount new sysfs when new network namespace is requested
Yu Watanabe [Fri, 17 Feb 2023 04:50:17 +0000 (13:50 +0900)] 
core/namespace: mount new sysfs when new network namespace is requested

Even when a mount namespace is created, previously host's sysfs is used,
especially with RootDirectory= or RootImage=, thus service processes can
still access the properties of the network interfaces in the main network
namespace through sysfs.

This makes, sysfs is remounted with the new network namespace tag, except
when PrivateMounts= is explicitly disabled. Hence, the properties of the
network interfaces in the main network namespace cannot be accessed by
service processes through sysfs.

Fixes #26422.

2 years agocore/namespace: introduce a new namespace mount mode PRIVATE_SYSFS
Yu Watanabe [Sat, 18 Feb 2023 00:44:43 +0000 (09:44 +0900)] 
core/namespace: introduce a new namespace mount mode PRIVATE_SYSFS

This is useful when a service running with a new network namespace.

The mount mode is not used yet, but will be used in a later commit.

2 years agocore/namespace: rename SYSFS -> BIND_SYSFS
Yu Watanabe [Fri, 17 Feb 2023 22:12:37 +0000 (07:12 +0900)] 
core/namespace: rename SYSFS -> BIND_SYSFS

No functional change, just preparation for later commits.

2 years agomount-util: introduce remount_sysfs()
Yu Watanabe [Fri, 17 Feb 2023 23:45:24 +0000 (08:45 +0900)] 
mount-util: introduce remount_sysfs()

This is useful when creating a new network namespace. Unlike procfs,
we need to remount sysfs, otherwise properties of the network interfaces
in the main network namespace are still accessible through the old sysfs,
e.g. /sys/class/net/eth0. All sub-mounts previously mounted on the sysfs
are moved onto the new sysfs mount.

The function will be used in later commits.

2 years agocore/execute: make PrivateMounts= tristate
Yu Watanabe [Fri, 17 Feb 2023 06:35:48 +0000 (15:35 +0900)] 
core/execute: make PrivateMounts= tristate

No functional change, just preparation for later commits.

2 years agocore/dbus-util: introduce bus_set_transient_tristate()
Yu Watanabe [Fri, 17 Feb 2023 06:33:13 +0000 (15:33 +0900)] 
core/dbus-util: introduce bus_set_transient_tristate()

This will be used in later commits.

2 years agobus-util: introduce bus_property_get_tristate()
Yu Watanabe [Fri, 17 Feb 2023 06:32:39 +0000 (15:32 +0900)] 
bus-util: introduce bus_property_get_tristate()

This will be used in later commits.

2 years agocore/execute: introduce exec_needs_ipc_namespace() helper function
Yu Watanabe [Fri, 17 Feb 2023 22:07:50 +0000 (07:07 +0900)] 
core/execute: introduce exec_needs_ipc_namespace() helper function

This also fixes a missing condition in exec_runtime_make().

2 years agocore/execute: introduce exec_needs_network_namespace() helper function
Yu Watanabe [Fri, 17 Feb 2023 06:32:02 +0000 (15:32 +0900)] 
core/execute: introduce exec_needs_network_namespace() helper function

2 years agocore/namespace: drop unused field in NamespaceInfo
Yu Watanabe [Fri, 17 Feb 2023 05:58:22 +0000 (14:58 +0900)] 
core/namespace: drop unused field in NamespaceInfo

2 years agoMerge pull request #26555 from poettering/cleanup-array
Yu Watanabe [Thu, 23 Feb 2023 06:08:56 +0000 (15:08 +0900)] 
Merge pull request #26555 from poettering/cleanup-array

add gcc cleanup attribute based logic to destroy arrays

2 years agotree-wide: port various things over to CLEANUP_ARRAY() 26555/head
Lennart Poettering [Wed, 22 Feb 2023 22:12:53 +0000 (23:12 +0100)] 
tree-wide: port various things over to CLEANUP_ARRAY()

2 years agomemory-util: add a concept for gcc cleanup attribute based array destruction
Lennart Poettering [Wed, 22 Feb 2023 22:10:25 +0000 (23:10 +0100)] 
memory-util: add a concept for gcc cleanup attribute based array destruction

2 years agosd-event: fix error handling 26559/head
Yu Watanabe [Thu, 23 Feb 2023 02:04:44 +0000 (11:04 +0900)] 
sd-event: fix error handling

Follow-up for 158fe190afe37b222c9dc2c53bd7be426b92ef89.

2 years agosd-event: fix use of uninitialized variable
Yu Watanabe [Thu, 23 Feb 2023 02:03:17 +0000 (11:03 +0900)] 
sd-event: fix use of uninitialized variable

Follow-up for 158fe190afe37b222c9dc2c53bd7be426b92ef89.

Fixes CID#1505670.

2 years agoMerge pull request #26557 from poettering/more-cap-utils
Yu Watanabe [Thu, 23 Feb 2023 01:44:53 +0000 (10:44 +0900)] 
Merge pull request #26557 from poettering/more-cap-utils

new helper for cap-list.[ch] + capability-util.[ch]

2 years agoMerge pull request #26542 from medhefgo/boot-device-path
Yu Watanabe [Thu, 23 Feb 2023 01:26:40 +0000 (10:26 +0900)] 
Merge pull request #26542 from medhefgo/boot-device-path

boot: Misc device path improvements

2 years agosd-event: always initialize sd_event.perturb
Yu Watanabe [Wed, 22 Feb 2023 22:31:01 +0000 (07:31 +0900)] 
sd-event: always initialize sd_event.perturb

If the boot ID cannot be obtained, let's first fallback to the machine
ID, and if still cannot, then let's use 0.
Otherwise, no timer event source cannot be triggered.

Fixes #26549.

2 years agoexecute: modernizations
Lennart Poettering [Wed, 22 Feb 2023 12:06:11 +0000 (13:06 +0100)] 
execute: modernizations

2 years agotree-wide: use unlink_and_freep() moreover
Lennart Poettering [Wed, 22 Feb 2023 22:13:31 +0000 (23:13 +0100)] 
tree-wide: use unlink_and_freep() moreover

2 years agocapability-util: add new capability_get_ambient() helper 26557/head
Lennart Poettering [Wed, 22 Feb 2023 12:05:44 +0000 (13:05 +0100)] 
capability-util: add new capability_get_ambient() helper

2 years agocap-list: add capability_set_to_string_negative()
Lennart Poettering [Wed, 22 Feb 2023 12:05:07 +0000 (13:05 +0100)] 
cap-list: add capability_set_to_string_negative()

2 years agocap-list: add capability_set_to_strv()
Lennart Poettering [Mon, 20 Feb 2023 10:46:08 +0000 (11:46 +0100)] 
cap-list: add capability_set_to_strv()

2 years agosystemctl: make list-timers not say "left" in "LEFT" column 26556/head
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 22:42:17 +0000 (23:42 +0100)] 
systemctl: make list-timers not say "left" in "LEFT" column

We would print:
NEXT                        LEFT          LAST                        PASSED        UNIT                           >
Wed 2023-02-22 23:55:00 CET 20min left    Wed 2023-02-22 23:25:00 CET 9min ago      pmlogger_check.timer           >
Wed 2023-02-22 23:55:10 CET 21min left    Wed 2023-02-22 23:25:16 CET 8min ago      pmlogger_farm_check.timer      >
Wed 2023-02-22 23:58:00 CET 23min left    Wed 2023-02-22 23:28:02 CET 6min ago      pmie_check.timer               >
Wed 2023-02-22 23:58:10 CET 24min left    Wed 2023-02-22 23:28:11 CET 5min ago      pmie_farm_check.timer          >
Thu 2023-02-23 00:00:00 CET 25min left    Wed 2023-02-22 00:00:10 CET 23h ago       logrotate.timer                >
Thu 2023-02-23 00:00:00 CET 25min left    Wed 2023-02-22 00:00:10 CET 23h ago       unbound-anchor.timer           >
Thu 2023-02-23 00:08:00 CET 33min left    Wed 2023-02-22 00:08:05 CET 23h ago       pmie_daily.timer               >
Thu 2023-02-23 00:10:00 CET 35min left    Wed 2023-02-22 00:10:03 CET 23h ago       pmlogger_daily.timer           >
Thu 2023-02-23 00:14:14 CET 40min left    Wed 2023-02-22 22:35:09 CET 58min ago     dnf-makecache.timer            >
Thu 2023-02-23 05:05:04 CET 5h 30min left Wed 2023-02-22 03:29:00 CET 20h ago       plocate-updatedb.timer         >
Thu 2023-02-23 11:34:34 CET 12h left      Wed 2023-02-22 11:34:33 CET 11h ago       systemd-tmpfiles-clean.timer   >
Sun 2023-02-26 01:00:00 CET 3 days left   Mon 2023-02-20 07:51:59 CET 2 days ago    raid-check.timer               >
Mon 2023-02-27 00:19:48 CET 4 days left   Mon 2023-02-20 07:51:59 CET 2 days ago    fstrim.timer                   >
Mon 2023-02-27 12:34:36 CET 4 days left   Tue 2023-02-21 08:22:14 CET 1 day 15h ago archlinux-keyring-wkd-sync.time>

The "left" part uses precious screen estate and is pretty much implied
by the column name. Drop it.

2 years agoshared/format-table: optionally print timestamps without "left"
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 22:40:04 +0000 (23:40 +0100)] 
shared/format-table: optionally print timestamps without "left"

This just adds the base functionality and some unit tests.
With TABLE_TIMESTAMP_RELATIVE we print "5s ago" and "5s left",
with the new TABLE_TIMESTAMP_LEFT, we print "5s ago" but "5s".
This is more useful for cases where we generally only want to
print timestamps in the future.

2 years agosd-journal: fix build with older glibc
Frantisek Sumsal [Wed, 22 Feb 2023 19:43:52 +0000 (20:43 +0100)] 
sd-journal: fix build with older glibc

In older glibc (like 2.28 on CentOS Stream 8) there is no wrapper
for the gettid() syscall, so we need to provide our own.

../src/libsystemd/sd-journal/journal-send.c: In function ‘close_journal_fd’:
../src/libsystemd/sd-journal/journal-send.c:88:25: error: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
         if (getpid() != gettid())
                         ^~~~~~
                         getgid
../src/libsystemd/sd-journal/journal-send.c:88:25: warning: nested extern declaration of ‘gettid’ [-Wnested-externs]
cc1: some warnings being treated as errors

Follow-up to 50b35193ec.

2 years agoboot: Take advantage of packed device paths 26542/head
Jan Janssen [Sat, 7 Jan 2023 11:03:28 +0000 (12:03 +0100)] 
boot: Take advantage of packed device paths

Now that device path types are marked as packed we can safely cast and
access them. If we ever take the address of a member, we would get a
compiler warning.

2 years agoboot: Add GUID format helper macro
Jan Janssen [Wed, 22 Feb 2023 14:19:14 +0000 (15:19 +0100)] 
boot: Add GUID format helper macro

2 years agoboot: Move more device path helpers to device-path-util.c
Jan Janssen [Sat, 7 Jan 2023 10:58:14 +0000 (11:58 +0100)] 
boot: Move more device path helpers to device-path-util.c

This also renames them to stay consistent with our naming style.

2 years agoboot: Remove some device path helper macros
Jan Janssen [Sat, 7 Jan 2023 10:46:41 +0000 (11:46 +0100)] 
boot: Remove some device path helper macros

In gnu-efi/EDK2 device paths are not marked as packed and instead the
Length field is split into 2 bytes. Accessing those requires these
helper macros as device paths may be unaligned.

Since our own efi headers define device path structs as packed, we can
access these directly, making code much more readable.

2 years agoboot: Split out device path functions
Jan Janssen [Sat, 7 Jan 2023 10:39:07 +0000 (11:39 +0100)] 
boot: Split out device path functions

No code changes aside from renaming path_replace_hd() and making its
parameter take any device path node type.

2 years agoboot: Move disk_get_part_uuid into part-discovery.c
Jan Janssen [Sat, 7 Jan 2023 10:21:56 +0000 (11:21 +0100)] 
boot: Move disk_get_part_uuid into part-discovery.c

Thematically, they are similar and disk.c is awfully small to warrant
the separation.

2 years agoMerge pull request #26540 from poettering/systemctl-list-tweaks
Lennart Poettering [Wed, 22 Feb 2023 20:19:40 +0000 (21:19 +0100)] 
Merge pull request #26540 from poettering/systemctl-list-tweaks

small tweaks to "systemctl list-automounts" + "systemctl list-timers" tabular output

2 years agotest: add coverage for #24177
Frantisek Sumsal [Wed, 22 Feb 2023 15:43:42 +0000 (16:43 +0100)] 
test: add coverage for #24177

Original issue: https://bugzilla.redhat.com/show_bug.cgi?id=1985288

2 years agosmack-util: Fix compilation error when smack is disabled
Daan De Meyer [Wed, 22 Feb 2023 14:47:54 +0000 (15:47 +0100)] 
smack-util: Fix compilation error when smack is disabled

2 years agosystemctl: read 64bit integers into uint64_t 26540/head
Lennart Poettering [Wed, 22 Feb 2023 18:00:28 +0000 (19:00 +0100)] 
systemctl: read 64bit integers into uint64_t

usec_t is also a uint64_t internally, hence this doesn't actually change
anything. However, on the conceptual level, sd-bus expects a uint64_t
hence give it one.

2 years agosystemctl: suppress timeout display if unset in list-automounts
Lennart Poettering [Wed, 22 Feb 2023 12:42:02 +0000 (13:42 +0100)] 
systemctl: suppress timeout display if unset in list-automounts

If the timeout is zero it's not set, let's suppress the output then.

2 years agosystemctl: right-align left/passed columns in list-timers
Lennart Poettering [Wed, 22 Feb 2023 12:40:53 +0000 (13:40 +0100)] 
systemctl: right-align left/passed columns in list-timers

Timespans are probably best right-aligned, in particular if they
systematically end in either " ago" or " left" because they are used as
"relative timestamps".

2 years agoefi-string: Add startswith8()
Daan De Meyer [Mon, 30 Jan 2023 15:25:23 +0000 (16:25 +0100)] 
efi-string: Add startswith8()

startswith() from string-util-fundamental.h is defined for sd_char
which is char16_t, so let's add an implementation for char as well.

2 years agoefi-string: Fix strchr() null byte handling
Daan De Meyer [Mon, 30 Jan 2023 15:22:10 +0000 (16:22 +0100)] 
efi-string: Fix strchr() null byte handling

strchr() should be able to search for the terminating null byte,
our implementation doesn't, let's fix that.

2 years agoMerge pull request #26448 from poettering/sd-event-mempress
Lennart Poettering [Wed, 22 Feb 2023 15:23:59 +0000 (16:23 +0100)] 
Merge pull request #26448 from poettering/sd-event-mempress

sd-event: add memory pressure event source

2 years agosystemctl: warn if units disabled in user scope are still enabled globally
Mike Yuan [Sun, 12 Feb 2023 13:08:28 +0000 (21:08 +0800)] 
systemctl: warn if units disabled in user scope are still enabled globally

Fixes #18271

2 years agosystemctl: show "Until:" field only for service and scope units
Yu Watanabe [Wed, 22 Feb 2023 04:26:28 +0000 (13:26 +0900)] 
systemctl: show "Until:" field only for service and scope units

Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.

Fixes #26473.

2 years agoMerge pull request #26528 from keszybz/valgrind-simplification
Yu Watanabe [Wed, 22 Feb 2023 14:04:12 +0000 (23:04 +0900)] 
Merge pull request #26528 from keszybz/valgrind-simplification

Drop the -Dvalgrind configuration option

2 years agoMerge pull request #26500 from DaanDeMeyer/repart-mountpoints
Daan De Meyer [Wed, 22 Feb 2023 13:25:45 +0000 (14:25 +0100)] 
Merge pull request #26500 from DaanDeMeyer/repart-mountpoints

repart: Several CopyFiles= improvements

2 years agoman: document the new sd_event_add_memory_pressure() API 26448/head
Lennart Poettering [Thu, 16 Feb 2023 16:24:28 +0000 (17:24 +0100)] 
man: document the new sd_event_add_memory_pressure() API

2 years agotest: add test for new memory pressure logic
Lennart Poettering [Fri, 10 Feb 2023 12:29:58 +0000 (13:29 +0100)] 
test: add test for new memory pressure logic

it tests both real PSI stuff (if available) and fake pressure via
AF_UNIX and FIFO notification.

2 years agosd-event: add high-level sd_event_add_memory_pressure() event source
Lennart Poettering [Fri, 10 Feb 2023 15:44:24 +0000 (16:44 +0100)] 
sd-event: add high-level sd_event_add_memory_pressure() event source

Typically, in reasonably complex programs we want to realease various
caches (such as glibc allocation caches) in case of memory pressure.
Let's add explicit infrastructure for that to sd-event, that can hook
Linux' Pressure Stall Information (PSI) logic with our event loop.

This adds sd_event_add_memory_pressure() as easy, one-step API to
install an even source that is called under memory pressure.

The parameters which file to watch (the per-cgroup PSI file, or the
system-wide file /proc/pressure/memory) can be configured via env vars.
The idea is that the service manager sooner or later gains controls for
setting this up correctly.

Alternatively to the PSI a similar logic is supported but instead of
waiting for POLLPRI on a procfs/cgroupfs fd we'll wait for POLLIN on
FIFO or AF_UNIX sockets. This is useful for testing, and possibly in
other environments, for example to hook up this protocol directly with
GNOME's low memory monitor.

By default this watches on the cgroup-local PSI so that we aren't
affected by pressure on cgroups we are not related to.

2 years agorepart: Exclude APIVFS mountpoint directories 26500/head
Daan De Meyer [Mon, 20 Feb 2023 15:39:34 +0000 (16:39 +0100)] 
repart: Exclude APIVFS mountpoint directories

Also exclude APIVFS and temporary files directories from the copy
operation so that these files don't accidentally end up in images.

2 years agocopy: Support both inode exclusion and contents exclusion
Daan De Meyer [Mon, 20 Feb 2023 19:30:44 +0000 (20:30 +0100)] 
copy: Support both inode exclusion and contents exclusion

In some cases, we want to exclude a directory's contents but not
the directory itself. In other cases, we want to exclude a directory
and its contents. Let's extend the denylist logic in copy.h to support
both by changing the denylist from a set to hashmap so we can store the
deny type as the value.

We also modify the repart ExcludeFiles= option to make use of this. If
a directory to exclude ends with a "/", we'll only exclude its contents.
Otherwise, we'll exclude the full directory.

2 years agorepart: Refactor make_copy_files_denylist() a bit
Daan De Meyer [Mon, 20 Feb 2023 15:18:08 +0000 (16:18 +0100)] 
repart: Refactor make_copy_files_denylist() a bit

2 years agotest-set: inline two iterator declarations 26528/head
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:15:22 +0000 (11:15 +0100)] 
test-set: inline two iterator declarations

2 years agosd-journal: use a dynamic check for valgrind
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:35:25 +0000 (11:35 +0100)] 
sd-journal: use a dynamic check for valgrind

I left this one as a separate commit because it is more involved.
We want people to compile with valgrind support, but we don't want to
use a slow hash function unless we're actually running under valgrind.
So the compile-time check is changed to a runtime check. When compiled
with optimization, the compiler should elide the checks on the constants,
and only leave the check for RUNNING_ON_VALGRIND. It is wrapped with
_unlikely_ so that the else branch is put in the hot path.

2 years agomeson: merge our two valgrind configuration conditions into one
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2023 18:59:57 +0000 (19:59 +0100)] 
meson: merge our two valgrind configuration conditions into one

Most of the support for valgrind was under HAVE_VALGRIND_VALGRIND_H, i.e. we
would enable if the valgrind headers were found. The operations then we be
conditionalized on RUNNING_UNDER_VALGRIND.

But in a few places we had code which was conditionalized on VALGRIND, i.e. the
config option. I noticed because I compiled with -Dvalgrind=true on a machine
that didn't have valgrind.h, and the build failed because
RUNNING_UNDER_VALGRIND was not defined. My first idea was to add a check that
the header is present if the option is set, but it seems better to just remove
the option. The code to support valgrind is trivial, and if we're
!RUNNING_UNDER_VALGRIND, it has negligible cost. And the case of running under
valgrind is always some special testing/debugging mode, so we should just do
those extra steps to make valgrind output cleaner. Removing the option makes
things simpler and we don't have to think if something should be covered by the
one or the other configuration bit.

I had a vague recollection that in some places we used -Dvalgrind=true not
for valgrind support, but to enable additional cleanup under other sanitizers.
But that code would fail to build without the valgrind headers anyway, so
I'm not sure if that was still used. If there are uses like that, we can
extend the condition for cleanup_pools().

2 years agotest-set: drop left-over valgrind check
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:13:48 +0000 (11:13 +0100)] 
test-set: drop left-over valgrind check

In b01f31954f1c7c4601925173ae2638b572224e9a mempool_use_allowed
was dropped, but apparently it was forgotten here.

2 years agohwdb: fix swapped buttons for Logitech Lift left
Vít Zikmund [Wed, 22 Feb 2023 07:27:17 +0000 (08:27 +0100)] 
hwdb: fix swapped buttons for Logitech Lift left

2 years agotest: add another stress test for devlink creation
Yu Watanabe [Mon, 16 Jan 2023 02:00:04 +0000 (11:00 +0900)] 
test: add another stress test for devlink creation

2 years agotree-wide: fix typo
Yu Watanabe [Wed, 22 Feb 2023 05:46:19 +0000 (14:46 +0900)] 
tree-wide: fix typo

2 years agoMerge pull request #26203 from medhefgo/meson
Yu Watanabe [Wed, 22 Feb 2023 01:27:16 +0000 (10:27 +0900)] 
Merge pull request #26203 from medhefgo/meson

meson: Use dicts for test/fuzzer definitions

2 years agoMerge pull request #26529 from medhefgo/boot-misc
Yu Watanabe [Wed, 22 Feb 2023 01:16:23 +0000 (10:16 +0900)] 
Merge pull request #26529 from medhefgo/boot-misc

boot: Misc changes

2 years agoMerge pull request #26491 from dtardon/list-paths
Yu Watanabe [Wed, 22 Feb 2023 00:29:54 +0000 (09:29 +0900)] 
Merge pull request #26491 from dtardon/list-paths

Add systemctl list-paths