Commit graph

66388 commits

Author SHA1 Message Date
Yu Watanabe 22f37744ca meson: move declaration of socket-activate 2023-08-01 02:31:36 +09:00
Yu Watanabe bd31a348bf meson: move declarations of bootctl and friends
This also drops unnecessary dependency on libblkid from
systemd-boot-check-no-failures.
2023-08-01 02:31:36 +09:00
Yu Watanabe dbab4fb9e5 meson: move declaration of user-sessions 2023-08-01 02:31:36 +09:00
Yu Watanabe b8ed1bf8ee meson: move declarations of logind and friends 2023-08-01 02:31:36 +09:00
Yu Watanabe c19cd86542 meson: move declarations of resolved and friends 2023-08-01 02:31:36 +09:00
Yu Watanabe ec57a4ea49 meson: move declarations of dissect and friends 2023-08-01 02:31:36 +09:00
Yu Watanabe 7409342236 meson: move declarations of hibernate-resume 2023-08-01 02:31:36 +09:00
Yu Watanabe 2a4566203e meson: move declarations of several generators 2023-08-01 02:31:36 +09:00
Yu Watanabe dd1f738e40 meson: move declarations of journald and friends 2023-08-01 02:31:36 +09:00
Yu Watanabe f727f3b963 meson: move declaration of systemd-analyze 2023-08-01 02:31:36 +09:00
Frantisek Sumsal f7e5f39d61 resolvectl: initialize the server state
Since not all fields of the dispatch table are mandatory we might end up
reading garbage if the optional field is not set.

In CIs we were lucky enough (or probably unfortunate enough) that the
garbage was printable, but in other cases the `show-server-state` verb
would just fail with:

$ resolvectl show-server-state
Failed to print table: Invalid argument

Follow-up to bc837621a3.
2023-08-01 02:31:20 +09:00
Yu Watanabe 279b5d4a8c
Merge pull request #28153 from yuwata/meson-use-template
meson: use template to declare executables and modules
2023-08-01 02:22:15 +09:00
Yu Watanabe 983d329450
Merge pull request #28568 from yuwata/network-address-next
network: bunch of cleanups and fixes for addressing
2023-08-01 02:14:19 +09:00
Yu Watanabe 2668d040c1 fstab-util: use pointer returned by startswith() 2023-08-01 02:12:29 +09:00
Yu Watanabe e4f2f14f1e
Merge pull request #28577 from yuwata/udev-split-files
udev: split files
2023-08-01 02:12:05 +09:00
Yu Watanabe 0bf67ba2d4 test: update comment to make it consistent with the condition
Follow-up for 6425dec88b.
2023-07-31 15:48:54 +01:00
Luca Boccassi 26172880f2
Merge pull request #28599 from keszybz/two-compilation-fixes
Two compilation fixes
2023-07-31 15:37:59 +01:00
Yu Watanabe c0af9dee0d udev: move declaration of ResolveNameTiming to udev-rules.c
It is only used by udevd and udevadm, not necessary in src/shared.

This also moves UDEV_NAME_SIZE and friends.
2023-07-31 23:23:00 +09:00
Yu Watanabe 04a1ee5867 udev: move udev_parse_config_full() to udevd.c
Then, rename it to manager_parse_udev_config().

No functional change, just refactoring.
2023-07-31 23:23:00 +09:00
Yu Watanabe 5d7e51b10e udev: rename test-udevd.c -> test-udev-manager.c 2023-07-31 23:23:00 +09:00
Yu Watanabe 81c32b1d41 udev: split udevd.c into two 2023-07-31 23:23:00 +09:00
Yu Watanabe 6bd4bad6b9 udev: move arg_xyz into Manager
No functional changes, just preparation for later commits.
2023-07-31 23:23:00 +09:00
Yu Watanabe 79d2ecaf63 udev: drop mostly unused Manager.pid
It is only used by the assertion in event_queue_insert().
We have similar check e.g. in sd-bus or sd-event, but udevd.c is not a
library code, hence such check is not necessary.
2023-07-31 23:23:00 +09:00
Yu Watanabe 8ebc7314e8 udev: merge manager_clear_for_worker() with manager_free()
The function manager_clear_for_worker() is now not called by workers,
and only called from manager_free(). Let's merge them.

This also drops unused Manager.rtnl, and outdated comment in
event_free().
2023-07-31 23:23:00 +09:00
Yu Watanabe 987b90f93f udev: split-out worker code from udevd.c
While doing that, the Manager object allocated by the main process
is now _not_ freed in the spawned worker process, to follow our usual
coding style. See discussion in #24043.
2023-07-31 23:23:00 +09:00
Yu Watanabe 0226729181 udev: move several functions from udev-util.c to relevant udevd source files
The functions are only used by udevd (and relevant tests), hence it is
not necessary to be in src/shared.
2023-07-31 23:23:00 +09:00
Yu Watanabe 162d516834 udev: rename test-udev-event.c -> test-udev-spawn.c 2023-07-31 23:23:00 +09:00
Yu Watanabe 0b76cc2fdf udev: split-out formatter and spawning commands from udev-event.c
No functional changes, just refactoring.
2023-07-31 23:23:00 +09:00
Yu Watanabe 1c3edc2ee3 udev: move DEVICE_TRACE() to udev-trace.h
It is only used by udevd, and not necessary in src/shared.
2023-07-31 23:23:00 +09:00
Yu Watanabe 2f7862cc57 meson: sort files 2023-07-31 23:23:00 +09:00
Yu Watanabe 9daec33938 udev-util: drop udev_queue_init() from shared
It is only used in libudev, let's move it.
2023-07-31 23:23:00 +09:00
Yu Watanabe 6d06af80d0 meson: move declaration of PID1 2023-07-31 22:17:34 +09:00
Yu Watanabe 2080c0978d meson: move declarations of nss modules 2023-07-31 22:17:34 +09:00
Yu Watanabe 07e43306b3 meson: move declaration of cryptsetup token modules 2023-07-31 22:17:34 +09:00
Yu Watanabe c335921e13 meson: introduce infra to build executables and shared libraries by using dictionary
That is not used yet. It will be used later.
2023-07-31 22:17:34 +09:00
Yu Watanabe 1d21a7bd99 meson: move declarations of arrays 2023-07-31 22:17:34 +09:00
Yu Watanabe 6756b61626 resolve: initialize 'current' when SD_RESOLVED_NO_STALE is set
Otherwise, the check below is always fail.
```
if (FLAGS_SET(query_flags, SD_RESOLVED_NO_STALE) && j->until_valid < current)
```

Follow-up for 5ed91481ab.
2023-07-31 22:11:58 +09:00
Zbigniew Jędrzejewski-Szmek 6425dec88b tests: skip static asserts on old clang versions
We declare clang >= 10 is supported. The workaround is easy enough, so let's
just do that. Fixes #28598. With Debian clang version 11.0.1-2:

[267/384] Compiling C object test-bitfield.p/src_test_test-bitfield.c.o
FAILED: test-bitfield.p/src_test_test-bitfield.c.o
clang -Itest-bitfield.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Warray-bounds -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=undef -Wfloat-equal -Winit-self -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wunused-function -Wwrite-strings '-Wno-error=#warnings' -Wno-string-plus-int -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-typedef-redefinition -Wno-gnu-variable-sized-type-not-at-end -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -DTEST_CODE=1 -MD -MQ test-bitfield.p/src_test_test-bitfield.c.o -MF test-bitfield.p/src_test_test-bitfield.c.o.d -o test-bitfield.p/src_test_test-bitfield.c.o -c ../src/test/test-bitfield.c
../src/test/test-bitfield.c:216:9: error: static_assert failed due to requirement '__builtin_constant_p(({
    static_assert(sizeof(unsigned char) <= sizeof(unsigned long long), "sizeof(uint8_t) <= sizeof(unsigned long long)");
    static_assert(__builtin_choose_expr(__builtin_constant_p(1), 1, 0) < (int)(sizeof(unsigned char) * 8), "__builtin_choose_expr(__builtin_constant_p(1), 1, 0) < (int)(sizeof(uint8_t) * 8)");
    __builtin_choose_expr(__builtin_constant_p(1), ((unsigned char)1) << (1), ({
        int __unique_prefix__i751 = (1);
        do {
            if ((__builtin_expect(!!(!(__unique_prefix__i751 < (int)sizeof(unsigned char) * 8)), 0)))
                log_assert_failed("UNIQ_T(_i, 751) < (int)sizeof(uint8_t) * 8", (&"../src/test/test-bitfield.c"[(sizeof ("..") - sizeof(const char)) + 1]), 216, __func__);
        } while (0);
        ((unsigned char)1) << __unique_prefix__i751;
    }));
}))' "__builtin_constant_p(INDEX_TO_MASK(uint8_t, 1))"
        assert_cc(__builtin_constant_p(INDEX_TO_MASK(uint8_t, 1)));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/fundamental/macro-fundamental.h:109:25: note: expanded from macro 'assert_cc'
                        ^             ~~~~
/usr/include/assert.h:143:24: note: expanded from macro 'static_assert'
                       ^
...
2023-07-31 14:15:24 +02:00
Zbigniew Jędrzejewski-Szmek 7f4b3dc043 gpt-auto-generator: fix warnings about unused func when !ENABLE_EFI 2023-07-31 14:04:55 +02:00
Luca Boccassi b173b8186f
Merge pull request #28596 from keszybz/doc-updates
Two documentation updates
2023-07-31 11:11:11 +01:00
Zbigniew Jędrzejewski-Szmek 377d3a31e6 man/systemd.service: advise Type=exec instead of Type=simple
The descriptions of various options are reworked: first say what protocol
actually is, i.e. describe what type of notification the manager waits
for. Only after that describe various steps and things the service should
do. Also, apply some paragraph breaks.

Instead of recommending Type=simple, recommend Type=exec. Say explicitly that
Type=simple, Type=forking are not recommended. Type=simple ignores failure in a
way that doesn't make any sense except as a historical accident. We introduced
'exec' instead of changing 'simple' to keep backwards-compatiblity, but
'simple' is not very useful. 'forking' works, but is inefficient: correctly
programming the interface requires a lot of work, and at runtime, the
additional one or two forks are just a waste of CPU resources. Furthermore, we
now understand that because of COW traps, they may also increase memory
requirements. There is really no reason to use 'forking', except if it's
already implemented and the code cannot be changed to use 'notify'.

Also, remove the recommendations to use Type=simple to avoid delaying boot. In
most cases, if the service can support notifications about startup, those
should be done.

Overall, for new services, "notify", "notify-reload", and "dbus" are the
types that make sense.
2023-07-31 11:23:36 +02:00
Yu Watanabe 4da252c59a network/address: rename address_kernel_{compare,hash}_func() -> address_{compare,hash}_func()
Previously, we had two compare/hash functions. But we do not have
one of them anymore. Let's rename them.
2023-07-31 18:15:26 +09:00
Yu Watanabe 35f0cd02d8 network/address: drop unused functions 2023-07-31 18:15:26 +09:00
Yu Watanabe f2bcd3245a test-network: add more tests for address properties 2023-07-31 18:15:26 +09:00
Yu Watanabe b5aefc90e6 network/address: check if existing addresses can be updated in more detail
Some properties of address can be updated, but some cannot.
On reconfiguring an interface or restarting networkd, let's keep an
assigned address only when it can be updated later with the requested
setting, and otherwise drop it.
2023-07-31 18:15:26 +09:00
Yu Watanabe f35aecc416 network/address: always set IFA_ADDRESS attribute for IPv6 address on configure
IPv6 address can update the peer address without removing the address.
If an address have a peer, but now we want to drop the peer, we need to
specify a null address in IFA_ADDRESS attribute.

IPv4 address cannot update the peer address, so let's specify peer
address only when necessary.
2023-07-31 18:15:26 +09:00
Yu Watanabe b8e898a681 network/address: make Label= accept an empty string
We usually reset setting when an emptry string is specified.
2023-07-31 18:15:26 +09:00
Yu Watanabe c5874748a4 network/address: add missing space in log message 2023-07-31 18:15:26 +09:00
Yu Watanabe d6b64f7abb network/address: do not set configuring flag when a request is canceled
Fixes copy-and-paste error.
Follow-up for 0a0c2672db.
2023-07-31 18:15:26 +09:00
Zbigniew Jędrzejewski-Szmek 02f7f8aa4f systemd-battery-check: provide more debug logs
The logs would give no hint about the answer to most interesting question: why
we decided to return true or false from the program. If we find batteries
that are low or uncertain, log at info level.
2023-07-31 10:06:04 +01:00