Commit Graph

6050 Commits

Author SHA1 Message Date
Yu Watanabe
7f5c82aaf3 tree-wide: insert missing space after comma 2024-04-13 05:44:04 +09:00
Yu Watanabe
87bbcb26c8 Merge pull request #32255 from YHNdnzj/strextendf
shared/killall: minor modernization
2024-04-13 05:10:20 +09:00
Mike Yuan
dbbc86ffbd string-util: correct comment in strextendf_with_separator 2024-04-13 02:35:01 +08:00
Zbigniew Jędrzejewski-Szmek
c71b50179e meson: do not fail build with newer kernel headers
systemd-255 is failing a build with the latest kernel headers… Let's downgrade
this warning, because it's fine if there's a file system we don't know about
and it makes thing less brittle if we don't treat this as a hard error.

(I initially conditionalized this on BUILD_MODE, but I don't think we need a
hard error there either. A warning will be noticed and fixed.)
2024-04-12 11:44:58 +01:00
Frantisek Sumsal
edda10f2ae tree-wide: make sure net/if.h is included before any linux/ header
The linux/ headers include linux/libc-compat.h that makes sure the
linux/ headers won't redeclare symbols already declared by net/if.h, but
glibc's net/if.h doesn't do that, so if the include order is reversed
we'll end up with a bunch of errors about redeclared stuff:

[3/519] Compiling C object test-network-tables.p/src_network_test-network-tables.c.o
FAILED: test-network-tables.p/src_network_test-network-tables.c.o
cc -Itest-network-tables.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 -Isrc/libsystemd-network -I../src/libsystemd-network -Isrc/network -I../src/network -I../src/network/netdev -I../src/network/tc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -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=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -DTEST_CODE=1 -MD -MQ test-network-tables.p/src_network_test-network-tables.c.o -MF test-network-tables.p/src_network_test-network-tables.c.o.d -o test-network-tables.p/src_network_test-network-tables.c.o -c ../src/network/test-network-tables.c
In file included from ../src/basic/linux/if_bonding.h:47,
                 from ../src/network/netdev/bond.h:5,
                 from ../src/network/test-network-tables.c:3:
../src/basic/linux/if.h:111:41: error: redeclaration of enumerator ‘IFF_UP’
  111 | #define IFF_UP                          IFF_UP
      |                                         ^~~~~~
../src/basic/linux/if.h:84:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’
   84 |         IFF_UP                          = 1<<0,  /* sysfs */
      |         ^~~~~~
../src/basic/linux/if.h:112:41: error: redeclaration of enumerator ‘IFF_BROADCAST’
  112 | #define IFF_BROADCAST                   IFF_BROADCAST
      |                                         ^~~~~~~~~~~~~
...

This also drops remaining workarounds from the last time this issue was
brought up (6f270e6bd8) since they shouldn't be needed anymore if the
order of the includes is the "correct" one. I also added a comment to
each affected include when this is inevitably encountered again in the
future.

Resolves: #32160
2024-04-09 21:19:15 +02:00
Mike Yuan
74531a93d6 pidref: 0 -> NULL for pointer 2024-04-10 01:45:12 +08:00
Mike Yuan
7fe28d8386 uid-range: place 'ret' param at last 2024-04-08 20:14:38 +08:00
Mike Yuan
0aec92a5cc uid-range: use FOREACH_ARRAY at one more place 2024-04-08 20:14:38 +08:00
Yu Watanabe
6952ebae3b tree-wide: drop several remaining license headers
And downgrade the license of utf8.c to LGPL-2.0-or-later, to follow the
original license.
2024-04-08 10:14:50 +02:00
Lennart Poettering
3b2874952f cgroup-util: add helpers for opening cgroup by id 2024-04-06 16:08:23 +02:00
Lennart Poettering
cb1b813f0d lock-util: make global lock return parameter to image_path_lock() optional
When adding unprivileged nspawn support we don't really want a global
lock file, since we cannot even access the dir they are stored in, hence
make the concept optional.

Some minor other modernizations.
2024-04-06 16:08:23 +02:00
Lennart Poettering
e4f62e7a12 namespace-util: add new helper is_our_namespace() 2024-04-06 16:08:23 +02:00
Lennart Poettering
574a07c79d namespace-util: add namespace_open_by_type() helper 2024-04-06 16:08:23 +02:00
Lennart Poettering
2ad2f0c89e namespace-util: add detach_mount_namespace_userns() 2024-04-06 16:08:23 +02:00
Lennart Poettering
e02fb2099c namespace-util: add helper for allocating an empty userns fd 2024-04-06 16:08:23 +02:00
Lennart Poettering
5783b4a954 namespace-util: add detach_mount_namespace_harder()
This is just like detach_mount_namespace() but if need be uses unpriv
user namespaces to be able to execute CLONE_NEWNS.
2024-04-06 16:08:23 +02:00
Lennart Poettering
afdd0efa63 uid-range: add some basic operations on UidRange objects
Helpers to compare and get size, and whether the object is empty.
2024-04-06 16:08:23 +02:00
Lennart Poettering
20ba086e77 uid-range: add new uid_range_load_userns_by_fd() helper
This is similar to uid_range_load_userns() but instead of reading the
uid_map off a process it reads it off a userns fd.

(Of course the kernel has no API for this right now, hence we fork off a
throw-away process which joins the user namespace, and then read off the
data from there.)
2024-04-06 16:08:23 +02:00
Lennart Poettering
6ebb53d945 uid-range: optionally load outside view of UID range from uid_map procfs file 2024-04-06 16:08:23 +02:00
Lennart Poettering
5bff40e719 uid-range: add uid_range_overlaps() helper 2024-04-06 16:08:23 +02:00
Luca Boccassi
e92042269e Merge pull request #32123 from mrc0mmand/assorted-tweaks
A couple of assorted tweaks
2024-04-05 22:22:06 +01:00
Mike Yuan
99f3b67f3f os-util: use ENDSWITH_SET where appropriate
Addresses https://github.com/systemd/systemd/pull/31435#discussion_r1553969156

Co-authored-by: Lennart Poettering <lennart@poettering.net>
2024-04-06 02:16:53 +08:00
Zbigniew Jędrzejewski-Szmek
c1e7f938ca Merge pull request #31435 from bluca/portable_fix_versioned
portable: assorted bug fixes
2024-04-05 17:04:17 +02:00
Frantisek Sumsal
e55db9e792 log: fix comment 2024-04-05 12:14:18 +02:00
Mike Yuan
596c9e671a string-util: add missing assertion in cellescape 2024-04-03 23:51:11 +08:00
Luca Boccassi
1c6ca6d924 Merge pull request #32065 from bluca/dlopen_debug
dlopen: fix bpf symbol loading check and log at debug level when loading a library
2024-04-03 16:36:35 +01:00
Luca Boccassi
26cbb21449 Merge pull request #32019 from bluca/gcrypt_dlopen
gcrypt: dlopenify for libsystemd
2024-04-03 16:10:00 +01:00
Luca Boccassi
dd6c0df65c dlopen: log debug message when a library is dlopened
Useful to track what is being used and when
2024-04-03 14:23:04 +01:00
Luca Boccassi
8707c9b244 gcrypt: dlopenify for libsystemd
gcrypt is used only for journal sealing operations in libsystemd, so it
can be made into a dlopen dependency that is used only on demand. This
allows to reduce the footprint of libsystemd in the most common cases.

Keep systemd-pull and systemd-resolved with normal linking, as they are
executables, and usually built with OpenSSL support anyway.
2024-04-03 11:50:25 +01:00
Mike Yuan
80d1d9f5db efivars: minor modernization for efi_set_variable 2024-04-03 10:03:53 +08:00
Mike Yuan
1ca89d32ae signal-util: make struct timespec const 2024-04-03 10:03:53 +08:00
Mike Yuan
65b584334d time-util: drop unneeded 'struct' 2024-04-03 10:03:53 +08:00
Daan De Meyer
cde08933a9 Fix assertion in socknameinfo_pretty() 2024-03-31 23:40:38 +01:00
Yu Watanabe
0966933b3d unit-def: append trailing comma for the last entry 2024-03-29 13:53:01 +09:00
Luca Boccassi
37543971af os-util: allow matching versioned image with extension-release file
Currently app_1.0.raw is refused if it contains extension-release.d/extension-release.app,
which stops one from using versioned images without using the force flag to disable
the check. Relax it so that only the actual name, and not the version, is compared, like
it already happens in other places.
2024-03-28 14:20:20 +00:00
Mike Yuan
f8c700791e string-util: modernize string_contains_word_strv a bit
Also correct the comment on flags.
2024-03-28 17:16:25 +08:00
Mike Yuan
981b033510 basic/string-table: remove unnecessary brackets 2024-03-25 23:10:52 +08:00
Friedrich Altheide
5e3c08d375 basic/virt: Fix virtualbox detection on proprietary system via board_vendor
Identify an virtualbox instance even if product_name, sys_vendor and bios_vendor reflect the
information of the real hardware, by checking if board_vendor == "Oracle Corporation"

This fixes #13429 again
The previous fix was removed in #21127
2024-03-24 18:02:42 +00:00
Zbigniew Jędrzejewski-Szmek
1934242b72 Drop unnecessary path_equal_ptr() wrapper
path_equal already works with NULL pointers.
2024-03-23 13:21:06 +01:00
Daan De Meyer
16f182e59a Merge pull request #31839 from DaanDeMeyer/log
log: Add per target log levels
2024-03-22 15:11:11 +01:00
Daan De Meyer
e8815abff6 log: Add per target log levels
For CI in mkosi, I want to configure systemd to log at debug level
to the journal, but not to the console. While we already have max
level settings for journald's forwarding settings, not every log line
goes to the journal, specifically during early boot and when units
are connected directly to the console (think systemd-firstboot), so
let's extend the log level options we already have to allow specifying
a comma separated list of values and lets allow prefixing values with
the log target they apply to to make this possible.
2024-03-22 12:46:32 +01:00
Yu Watanabe
431f2ffbea Merge pull request #31892 from YHNdnzj/machinectl-minor-cleanup
machinectl: minor modernization, use FOREACH_ARRAY
2024-03-22 08:10:39 +09:00
Mike Yuan
66d826026e cgroup-util: use path_find_first_component where appropriate
Prompted by 8922a728f7
2024-03-22 08:00:55 +09:00
Mike Yuan
51e0149173 nulstr-util: minor cleanup 2024-03-22 01:44:45 +08:00
Yu Watanabe
839dce5ecb Merge pull request #31862 from keszybz/add-strdup_to-helper
Add strdup_to() helper
2024-03-21 14:47:05 +09:00
Unique-Usman
c0cd99eee6 Follow up with the PR #31819 2024-03-20 15:48:05 +00:00
Luca Boccassi
c3a55dc469 Merge pull request #31844 from keszybz/missing-extra-checks
Add static asserts to verify that our missing_*.h headers defines are actually correct
2024-03-20 15:47:05 +00:00
Zbigniew Jędrzejewski-Szmek
196166dbb1 basic/unit-name: use strdup_to() in slice_build_parent_slice()
The handling of the buffer is not obvious, so add a comment.
2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek
4ab305fa3b basic/time-util: use strdup_to() and reformat a bit 2024-03-20 15:18:21 +01:00
Zbigniew Jędrzejewski-Szmek
6a705f1234 Replace strdup_or_null() by strdup_to()
I didn't know that this helper existed… It is very similar to strdup_to_full(),
but all callers can actually be replaced by strdup_to(), which has more fitting
semantics.
2024-03-20 15:18:21 +01:00