Commit Graph
62710 Commits
Author SHA1 Message Date
Yu Watanabe f2ccc0d3e1 systemctl-list-units: drop unused return value 2023-02-23 15:13:05 +09:00
Yu Watanabe eef96911e1 systemctl-list-units: fix memleak on error 2023-02-23 15:13:05 +09:00
Yu Watanabe dcef5e293f Merge pull request #26555 from poettering/cleanup-array
add gcc cleanup attribute based logic to destroy arrays
2023-02-23 15:08:56 +09:00
Lennart Poettering 8c2d0d3af4 tree-wide: port various things over to CLEANUP_ARRAY() 2023-02-23 11:43:43 +09:00
Lennart Poettering ff3f1464ec memory-util: add a concept for gcc cleanup attribute based array destruction 2023-02-23 11:43:43 +09:00
Yu Watanabe c7d941c527 Merge pull request #26557 from poettering/more-cap-utils
new helper for cap-list.[ch] + capability-util.[ch]
2023-02-23 10:44:53 +09:00
Yu Watanabe 2457a36d30 Merge pull request #26542 from medhefgo/boot-device-path
boot: Misc device path improvements
2023-02-23 10:26:40 +09:00
Yu Watanabe 6d2326e036 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.
2023-02-23 10:11:45 +09:00
Lennart Poettering a954b2492e execute: modernizations 2023-02-23 10:11:09 +09:00
Lennart Poettering 70f1280c83 tree-wide: use unlink_and_freep() moreover 2023-02-23 10:10:48 +09:00
Lennart Poettering a649419aae capability-util: add new capability_get_ambient() helper 2023-02-22 23:45:40 +01:00
Lennart Poettering 66c1e440c7 cap-list: add capability_set_to_string_negative() 2023-02-22 23:45:40 +01:00
Lennart Poettering 8cf4674d86 cap-list: add capability_set_to_strv() 2023-02-22 23:45:40 +01:00
Frantisek Sumsal a90d9ee162 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.
2023-02-23 06:57:44 +09:00
Jan Janssen 10e27f768b 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.
2023-02-22 21:56:26 +01:00
Jan Janssen ea592abfc6 boot: Add GUID format helper macro 2023-02-22 21:56:20 +01:00
Jan Janssen 0b92662821 boot: Move more device path helpers to device-path-util.c
This also renames them to stay consistent with our naming style.
2023-02-22 21:54:11 +01:00
Jan Janssen d755ac6214 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.
2023-02-22 21:54:11 +01:00
Jan Janssen e6d7dc9ada 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.
2023-02-22 21:54:11 +01:00
Jan Janssen 8e760b3fcd boot: Move disk_get_part_uuid into part-discovery.c
Thematically, they are similar and disk.c is awfully small to warrant
the separation.
2023-02-22 21:54:11 +01:00
Lennart Poettering 58a80840e6 Merge pull request #26540 from poettering/systemctl-list-tweaks
small tweaks to "systemctl list-automounts" + "systemctl list-timers" tabular output
2023-02-22 21:19:40 +01:00
Frantisek Sumsal 6299b6e5e6 test: add coverage for #24177
Original issue: https://bugzilla.redhat.com/show_bug.cgi?id=1985288
2023-02-23 04:52:46 +09:00
Daan De Meyer b12525416b smack-util: Fix compilation error when smack is disabled 2023-02-22 20:48:02 +01:00
Lennart Poettering 976baf26d3 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.
2023-02-22 19:00:42 +01:00
Lennart Poettering 21ae8c17d4 systemctl: suppress timeout display if unset in list-automounts
If the timeout is zero it's not set, let's suppress the output then.
2023-02-22 19:00:42 +01:00
Lennart Poettering f168919da8 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".
2023-02-22 18:59:15 +01:00
Lennart Poettering 921330af40 Merge pull request #26448 from poettering/sd-event-mempress
sd-event: add memory pressure event source
2023-02-22 16:23:59 +01:00
Mike Yuan e774d3c9f1 systemctl: warn if units disabled in user scope are still enabled globally
Fixes #18271
2023-02-22 23:05:41 +09:00
Yu Watanabe b59052be26 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.
2023-02-22 23:04:43 +09:00
Yu Watanabe 58fbf167d7 Merge pull request #26528 from keszybz/valgrind-simplification
Drop the -Dvalgrind configuration option
2023-02-22 23:04:12 +09:00
Daan De Meyer 97be742d95 Merge pull request #26500 from DaanDeMeyer/repart-mountpoints
repart: Several CopyFiles= improvements
2023-02-22 14:25:45 +01:00
Lennart Poettering f8a32e679e man: document the new sd_event_add_memory_pressure() API 2023-02-22 13:16:34 +01:00
Lennart Poettering b7dc40e663 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.
2023-02-22 13:14:36 +01:00
Lennart Poettering 158fe190af 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.
2023-02-22 13:09:42 +01:00
Daan De Meyer 4d8ff4e868 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.
2023-02-22 12:44:39 +01:00
Daan De Meyer b63bd125d4 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.
2023-02-22 12:44:36 +01:00
Daan De Meyer 5ab863be51 repart: Refactor make_copy_files_denylist() a bit 2023-02-22 12:44:18 +01:00
Zbigniew Jędrzejewski-Szmek 18e100172c test-set: inline two iterator declarations 2023-02-22 11:39:44 +01:00
Zbigniew Jędrzejewski-Szmek 3dc6b0fcb2 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.
2023-02-22 11:39:44 +01:00
Zbigniew Jędrzejewski-Szmek 50b35193ec 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().
2023-02-22 11:39:44 +01:00
Zbigniew Jędrzejewski-Szmek 3f275dcb84 test-set: drop left-over valgrind check
In b01f31954f mempool_use_allowed
was dropped, but apparently it was forgotten here.
2023-02-22 11:13:57 +01:00
Vít Zikmund 81cfea95e5 hwdb: fix swapped buttons for Logitech Lift left 2023-02-22 19:10:10 +09:00
Yu Watanabe a2e41b817b test: add another stress test for devlink creation 2023-02-22 19:08:26 +09:00
Yu Watanabe 60c5bd7759 tree-wide: fix typo 2023-02-22 14:46:19 +09:00
Yu Watanabe 4788f635e3 Merge pull request #26203 from medhefgo/meson
meson: Use dicts for test/fuzzer definitions
2023-02-22 10:27:16 +09:00
Yu Watanabe b5eba967a9 Merge pull request #26529 from medhefgo/boot-misc
boot: Misc changes
2023-02-22 10:16:23 +09:00
Yu Watanabe 086234e39b Merge pull request #26491 from dtardon/list-paths
Add systemctl list-paths
2023-02-22 09:29:54 +09:00
mooo 8e46b195e0 po: Translated using Weblate (Lithuanian)
Currently translated at 78.2% (151 of 193 strings)

Co-authored-by: mooo <hazap@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/lt/
Translation: systemd/main
2023-02-22 08:37:52 +09:00
Yu Watanabe a06f85a073 Merge pull request #26527 from mrc0mmand/more-tests
test: provide coverage for #26467 and #26483
2023-02-22 08:01:07 +09:00
Дамјан Георгиевски 37fe75a2e6 socket-proxyd: support Type=notify
update examples in the man page too
2023-02-21 22:59:04 +00:00