1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00
Commit Graph

53374 Commits

Author SHA1 Message Date
Christian Wehrli
3b55bd2fa9 po: Translated using Weblate (German)
Currently translated at 71.4% (135 of 189 strings)

Co-authored-by: Christian Wehrli <christian@chw.onl>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main
2021-09-16 20:05:00 +02:00
Lennart Poettering
281752e406
Merge pull request #20763 from poettering/fileio-test
test-fileio: test read_virtual_file() with more files from /proc
2021-09-16 17:47:03 +02:00
Piotr Drąg
f0c5e8d452 po: add false positives to POTFILES.skip 2021-09-16 16:19:32 +01:00
Daan De Meyer
f2ed82d510 core: Introduce build_managed_oom_cgroups_json()
Will be reused to build the varlink message contents sent by user
instances of systemd to systemd-oomd's varlink server in a future
commit.
2021-09-16 12:26:29 +01:00
Daan De Meyer
71feeae4bf oom: Introduce process_managed_oom_message()
Gets rid of a few gotos, allows removing the extra ret variable and
will also be used in a future commit by the codepath that receives
cgroups from user instances of systemd.
2021-09-16 12:26:29 +01:00
Daan De Meyer
ccf7cf2aa4 oom: Add missing sd-bus.h include 2021-09-16 12:26:26 +01:00
Lennart Poettering
f3b751220b test-fileio: test read_virtual_file() with more files from /proc
i.e. let's pick some files we know are too large, or where struct stat's
.st_size is zero even though non-empty, and test read_virtual_file()
with that, to ensure things are handled sensibly. Goal is to ensure all
three major codepaths in read_virtual_file() are tested.

Prompted-by: #20743
2021-09-16 12:23:32 +02:00
Lennart Poettering
00bd9a4a82 fileio: fix truncated read handling in read_virtual_file()
We mishandled the case where the size we read from the file actually
matched the maximum size fully. In that case we cannot really make a
determination whether the file was fully read or only partially. In that
case let's do another loop, so that we operate with a buffer, and
we can detect the EOF (which will be signalled to us via a short read).
2021-09-16 12:23:25 +02:00
Yu Watanabe
f782eee68a journal,network,timesync: fix segfault on 32bit timeval/timespec systems
Fixes #20741.
2021-09-16 11:47:44 +02:00
Anita Zhang
5aaa55d841 fileio: start with 4k buffer for procfs
There's a very gradual increase of anonymous memory in systemd-journald that
blames to 2ac67221bb.

systemd-journald makes many calls to read /proc/PID/cmdline and
/proc/PID/status, both of which tend to be well under 4K. However the
combination of allocating 4M read buffers, then using `realloc()` to
shrink the buffer in `read_virtual_file()` appears to be creating
fragmentation in the heap (when combined with the other allocations
systemd-journald is doing).

To help mitigate this, try reading /proc with a 4K buffer as
`read_virtual_file()` did before 2ac67221bb.
If it isn't big enough then try again with the larger buffers.
2021-09-16 11:31:29 +02:00
Luca Boccassi
1dcd91ad11
Merge pull request #20758 from yuwata/test-17-udev-cleanups
test: several cleanups for TEST-17-UDEV
2021-09-16 09:45:10 +01:00
Yu Watanabe
2d253d7206
Merge pull request #20721 from mrc0mmand/test-storage-lvm
test: udev/LVM storage tests
2021-09-16 12:39:24 +09:00
Yu Watanabe
73bf0f2ace
Merge pull request #20738 from mrc0mmand/ci-llvm-13
ci: build with clang-13
2021-09-16 09:32:21 +09:00
Lennart Poettering
28078aa5cc
Merge pull request #20483 from medhefgo/boot
sd-boot: Add support for changing console mode at runtime
2021-09-16 00:03:41 +02:00
Lennart Poettering
46ebc0a6f5
Merge pull request #20731 from a-wai/main
hostnamed: add support for getting the chassis type from device-tree
2021-09-16 00:02:05 +02:00
Lennart Poettering
3d7e273dba
Merge pull request #20746 from poettering/sysctl-rework
various sysctl-util.c cleanups
2021-09-16 00:01:18 +02:00
Yu Watanabe
a871f3bb54 test: drop unnecessary sleep and 'udevadm settle'
After the triggered events are processed, all symlinks which store
watch handles should be valid.
2021-09-16 06:55:11 +09:00
Yu Watanabe
a9d8bebacd test: use --settle option for udevadm trigger 2021-09-16 06:55:11 +09:00
Yu Watanabe
e70f57796d test: use --settle option for udevadm trigger
Then, we can drop the loops.
This also drops unnecessary `udevadm control --reload`.
2021-09-16 06:55:04 +09:00
Yu Watanabe
9228ecaf8c test: use /dev/null instead of the loop back network interface
It should faster to be processed. So, we can shorten the timeout.
Also, this makes the test use `udevadm trigger`.
2021-09-16 06:46:19 +09:00
Yu Watanabe
26146d82db test: use --settle option for udevadm trigger 2021-09-16 06:39:48 +09:00
Luca Boccassi
a51f6dba60
Merge pull request #20751 from poettering/watchdog-tweaklet
two minor watchdog tweaklets
2021-09-15 21:48:39 +01:00
Frantisek Sumsal
0203b2e4be test: basic LVM tests 2021-09-15 20:17:50 +02:00
Daan De Meyer
adbd80f510 sd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()
According to the documentation, Setting the data threshold to zero disables the
data threshold alltogether. Let's make sure we actually implement this behaviour
in sd_journal_enumerate_fields() by only applying the data threshold if it exceeds
zero.
2021-09-16 00:12:25 +09:00
Hugo Carvalho
08987f9115 po: Added translation using Weblate (Portuguese)
Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
2021-09-15 23:50:54 +09:00
Arnaud Ferraris
e6e6ca8251 hostnamed: add support for getting the chassis type from device-tree
Device-tree based devices can't get the chassis type from DMI or ACPI,
and so far need a custom `/etc/machine-info` to set this property right.

A new 'chassis-type' toplevel device tree property has recently been
approved into the DT specification, making it possible to automate
chassis type detection on such devices.

This patch therefore falls back to reading this device-tree property if
nothing is available through both DMI and ACPI.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
2021-09-15 16:46:07 +02:00
Arnaud Ferraris
533f11c529 basic: nulstr-util: add nulstr_get() returning the matching string
Currently `nulstr_contains` returns a boolean, making it difficult to
identify which of the input strings matches the "needle".

Adding a new `nulstr_get()` function, returning a const pointer to the
matching string, eases this process and allows us to directly re-use the
result of a call to this function without additional processing or
memory allocation.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
2021-09-15 16:45:58 +02:00
Lennart Poettering
3448711b7e test: add test case for sysctl-util.[ch] 2021-09-15 16:32:40 +02:00
Lennart Poettering
89edc243e4 test: make array in test-sysctl fully read-only 2021-09-15 16:32:40 +02:00
Lennart Poettering
20240b071b sysctl-util: per coding style, compare chars explicit against 0. 2021-09-15 16:32:40 +02:00
Lennart Poettering
d1469b7095 sysctl-util: make sysctl_read_ip_property() a wrapper around sysctl_read()
let's do what we did for sysctl_write()/sysctl_write_ip_property() also
for the read paths: i.e. make one a wrapper of the other, and add more
careful input validation.
2021-09-15 16:32:40 +02:00
Lennart Poettering
f9755203b9 sysctl-util: modernize sysctl_read() a bit
Let's add similar path validation to sysctl_read() as we already have in
sysctl_write().

Let's also drop the trailing newline from the returned string, like
sysctl_read_ip_property() already does it.

(I checked all users of this, they don't care)
2021-09-15 16:32:40 +02:00
Lennart Poettering
6aebfec3a5 sysctl-util: make sysctl_write_ip_property() a wrapper around sysctl_write()
It does the same stuff, let's use the same codepaths as much as we can.

And while we are at it, let's generate good error codes in case we are
called with unsupported parameters/let's validate stuff more that might
originate from user input.
2021-09-15 16:32:40 +02:00
Jan Janssen
1b965abc66 sd-boot: Add support for changing console mode at runtime 2021-09-15 16:32:18 +02:00
Lennart Poettering
13239c86e0 sysctl-util: rework sysctl_write() to wrap write_string_file()
The sysctl_write_ip_property() call already uses write_string_file(), so
let's do so here, too, to make the codepaths more uniform.

While we are at it, let's also validate the passed path a bit, since we
shouldn't allow sysctls with /../ or such in the name. Hence simplify
the path first, and then check if it is normalized, and refuse if not.
2021-09-15 16:19:45 +02:00
Lennart Poettering
be991d7678 fileio: set O_NOCTTY when reading virtual files
Better be safe than sorry, maybe someone points this call to a TTY one
day, and we'd rather not make it our controlling TTY in that case.
2021-09-15 16:19:45 +02:00
Lennart Poettering
7ab7547a40 fileio: lower maximum virtual file buffer size by one byte
When reading virtual files (i.e. procfs, sysfs, …) we currently put a
limit of 4M-1 on that. We have to pick something, and we have to read
these files in a single read() (since the kernel generally doesn't
support continuation read()s for them). 4M-1 is actually the maximum
size the kernel allows for reads from files in /proc/sys/, all larger
reads will result in an ENOMEM error (which is really weird, but the
kernel does what the kernel does). Hence 4M-1 sounds like a smart
choice.

However, we made one mistake here: in order to be able to detect EOFs
properly we actually read one byte more than we actually intend to
return: if that extra byte can be read, then we know the file is
actually larger than our limit and we can generate an EFBIG error from
that. However, if it cannot be read then we know EOF was hit, and we are
good. So ultimately after all we issued a single 4M read, which the
kernel then responds with ENOMEM to.  And that means read_virtual_file()
actually doesn't work properly right now on /proc/sys/. Let's fix that.

The fix is simple, lower the limit of the the buffer we intend to return
by one, i.e. 4M-2. That way, the read() we'll issue is exactly as large
as the limit the kernel allows, and we still get safely detect EOF from
it.
2021-09-15 16:19:45 +02:00
Lennart Poettering
84b5e291e2 watchdog: add ", ignoring" to log messages about errors we ignore
As per coding style. Also downgrade relevant log messages to
LOG_WARNING.
2021-09-15 16:01:02 +02:00
Lennart Poettering
a4588af942 watchdog: pass right error code to log function so that %m works 2021-09-15 16:00:20 +02:00
Frantisek Sumsal
2ea7eb003c repart: mark an assert()-only variable as unused
otherwise compilation with -Db_ndebug=true complains about a
set-but-not-used variable:

```
 ../src/partition/repart.c:907:33: error: variable 'left' set but not used [-Werror,-Wunused-but-set-variable]
                 uint64_t start, left;
                                                 ^
                                                 1 error generated.
```
2021-09-15 15:46:19 +02:00
Luca Boccassi
8f8e9ad7cb
Merge pull request #20650 from fbuihuu/watchdog-rework
Watchdog rework
2021-09-15 14:44:49 +01:00
Franck Bui
f6fca35e64 journalctl: never fail at flushing when the flushed flag is set
Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).

However since commit 4f413af2a0, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.

This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.
2021-09-15 15:10:15 +02:00
Luca Boccassi
e236711fd7 test: document autopkgtest CI infrastructure 2021-09-15 14:58:38 +02:00
Yu Watanabe
65bf08dd4a
Merge pull request #20729 from yuwata/ethtool-features-set
ethtool-util: support more offloading feature settings
2021-09-15 20:28:24 +09:00
Yu Watanabe
2c577df6f7
Merge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor-rule-and-nexthops
network: introduce NetworkConfigSource/State
2021-09-15 20:26:44 +09:00
Yu Watanabe
3c76b1a157
Merge pull request #20742 from pdmorrow/startup_cpus
add StartupAllowedCPUs= and StartupAllowedMemoryNodes= directives
2021-09-15 20:26:10 +09:00
Frantisek Sumsal
d7ac09520b tree-wide: mark set-but-not-used variables as unused to make LLVM happy
LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which
trips over some intentionally set-but-not-used variables or variables
attached to cleanup handlers with side effects (`_cleanup_umask_`,
`_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.):

```
../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable]
        _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL;
                                                     ^
                                                     1 error generated.
```
2021-09-15 13:09:45 +02:00
Franck Bui
10fd2b1180 watchdog: use MIN() in update_timeout()
Also the previous expression was probably wrong as "(int) t >= INT_MAX" is
likely to always evaluate to false.
2021-09-15 12:14:53 +02:00
Franck Bui
484752e26a shutdown: introduce init_watchdog()
No functional change.
2021-09-15 12:14:53 +02:00
Franck Bui
bcc3a1830e watchdog: constify watchdog_set_device() parameter 2021-09-15 12:14:53 +02:00