Commit Graph

54110 Commits

Author SHA1 Message Date
Jan Janssen
a8a7723ba9 sd-boot: Move flags helpers to macro-fundamental.h 2021-11-04 18:37:07 +01:00
Jan Janssen
1224d57ba5 sd-boot: Always compile with -ffreestanding and -fshort-wchar
This is not a hosted environment and we should not pretend otherwise
if -ffreestanding is not supported.

With EFI strings being in UCS2, it is not supported to build without
-fshort-wchar as gcc/clang default to a w_char_t size of 4 bytes.

This also makes the charset for wide chars explicit on gcc. This way
we get a nice error message if anyone ever tries to add 💩 to strings.
2021-11-04 18:37:07 +01:00
Jan Janssen
3c86dcc39c sd-boot: Save and restore console attributes
This also only writes the message on a new line if we aren't at the
beginning of one already.
2021-11-04 18:37:07 +01:00
Lennart Poettering
3663f754f1 Merge pull request #21070 from medhefgo/boot-save
sd-boot: Add support to boot last select entry
2021-11-04 17:37:12 +01:00
Lennart Poettering
71bb9594e9 Merge pull request #21030 from DaanDeMeyer/path-skipped
core: Propagate condition failed state from service to path unit.
2021-11-04 15:20:00 +01:00
Zbigniew Jędrzejewski-Szmek
a4eba5d8cf update-helper: add missing loop over user units
Noticed by Luca.

shellcheck doens't catch this, and somehow it was missed in review
and testing ;(
2021-11-04 11:39:04 +01:00
Lennart Poettering
aedec452b9 tree-wide: always use TAKE_FD() when calling rearrange_stdio()
rearrange_stdio() invalidates specified fds even on failure, which means
we should always invalidate the fds we pass in no matter what. Let's
make this explicit by using TAKE_FD() for that everywhere.

Note that in many places we such invalidation doesnt get us much
behaviour-wise, since we don't use the variables anymore later. But
TAKE_FD() in a way is also documentation, it encodes explicitly that the
fds are invalidated here, so I think it's a good thing to always make
this explicit here.
2021-11-03 23:05:26 +00:00
Daan De Meyer
12ab94a1e4 core: Propagate condition failed state to triggering units.
Alternative to https://github.com/systemd/systemd/pull/20531.

Whenever a service triggered by another unit fails condition checks,
stop the triggering unit to prevent systemd busy looping trying to
start the triggered unit.
2021-11-03 20:25:14 +00:00
Yu Watanabe
829b86bc0f Merge pull request #21217 from keszybz/debug-test-process-util
procfs-util: fix confusion wrt. quantity limit and maximum value
2021-11-04 04:03:56 +09:00
Yu Watanabe
3f5e7edbdb Merge pull request #21216 from poettering/take-fd-tweak
fd-util: make TAKE_FD free of double evaluation
2021-11-04 04:01:45 +09:00
Lennart Poettering
b7759c8f0a macro: make TAKE_PTR() side-effect free 2021-11-03 16:36:19 +01:00
Lennart Poettering
7950211df3 tree-wide: port more code to sigkill_wait() 2021-11-03 16:36:19 +01:00
Lennart Poettering
8f03de5323 tree-wide: port various places to use TAKE_PID() 2021-11-03 16:36:09 +01:00
Lennart Poettering
883946f0d2 process-util: rework TAKE_PID() to be side-effect free 2021-11-03 15:57:02 +01:00
Lennart Poettering
2c1612100d process-util: wait for processes we killed even if killing failed
The processes might be zombies in which case killing will fail, but
reaping them still matters.
2021-11-03 15:57:02 +01:00
Lennart Poettering
a70877d881 test: add test that ensures TAKE_FD() works as it should 2021-11-03 15:57:02 +01:00
Lennart Poettering
90d59676b3 fd-util: make TAKE_FD free of double evaluation
Better be safe than sorry.
2021-11-03 15:22:18 +01:00
Zbigniew Jędrzejewski-Szmek
6434a83d01 test-process-util: also add EROFS to the list of "good" errors
It is only added in the one place where we actually try to set the
setting to a new value. Before we were testing if we can set to it the
existing value, which was a noop. We could still get a permission error,
but this is the first place where we would propagate EROFS.
2021-11-03 09:39:16 +01:00
Zbigniew Jędrzejewski-Szmek
c3dead53d5 procfs-util: fix confusion wrt. quantity limit and maximum value
From packit/rawhide-arm64 logs:
Assertion 'limit >= INT_MAX || get_process_ppid(limit+1, NULL) == -ESRCH' failed at src/test/test-process-util.c:855, function test_get_process_ppid(). Aborting.
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

The kernel has a few different limits. In particular kernel.threads-max can be
set to some lower value, and kernel.pid_max can be set to a higher value. This
is nice because it reduces PID reuse, even if the number of threads that is
allowed is limited. But the tests assumed that we cannot have a thread with
PID above MIN(kernel.threads-max, kernel.pid_max-1), which is not valid.

So let's rework the whole thing: let's expose the helpers to read
kernel.threads-max and kernel.pid_max, and print what they return in tests.
procfs_tasks_get_limit() was something that is only used in tests, and wasn't
very well defined, so let's drop it.

Fixes #21193.
2021-11-03 09:36:08 +01:00
Yu Watanabe
ab7b261663 Merge pull request #21210 from yuwata/network-dhcp-server-introduce-router-setting
network: dhcp-server: introduce Router= setting to specify router address
2021-11-03 12:41:34 +09:00
Lennart Poettering
2f2cdd7250 percent-util: clamp percent range before converting to 2^32 scale
Let#s better be safe than sorry and clamp the input, so that we don't
hit overflow issues.
2021-11-03 12:41:17 +09:00
Lennart Poettering
4768cc450d missing: add missing header inclusions
These headers should work without any manual header inclusion.
2021-11-03 12:41:01 +09:00
Yu Watanabe
32d97330df test-network: add a testcase for Router= setting 2021-11-03 03:15:05 +09:00
Yu Watanabe
59aa622013 network: dhcp-server: introduce Router= setting to specify router address
Closes #21202.
2021-11-03 03:15:00 +09:00
Franck Bui
be0cc2ce6c test-keymap-util: always use kbd-model-map we ship
This test makes assumptions on the availability of some mappings contained in
kbd-model-map and therefore strongly relies on the version shipped by
upstream. IOW the test is likely to fail if it's installed on a system with a
more comprehensive kbd-model-map.

This patch makes the upstream kbd-model-map file available via a symlink in
test/testdata/test-keymap-util dir and makes sure that this specific version is
always used by test-keymap-util regardless of whether the test is installed and
run on a different system or directly run (optionally via meson) from the
project working dir.
2021-11-02 16:48:55 +01:00