]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
13 months agocore: port unit_fork_helper_process() and unit_fork_and_watch_rm_rf() to PidRef 29152/head
Lennart Poettering [Sun, 10 Sep 2023 14:41:43 +0000 (16:41 +0200)] 
core: port unit_fork_helper_process() and unit_fork_and_watch_rm_rf() to PidRef

13 months agocore: port unit_main_pid() + unit_control_pid() to PidRef and drop unit_kill_common()
Lennart Poettering [Sun, 10 Sep 2023 14:25:02 +0000 (16:25 +0200)] 
core: port unit_main_pid() + unit_control_pid() to PidRef and drop unit_kill_common()

This ports over unit_main_pid() + unit_control_pid() to return PidRef*
pointers (which also means the underlying UnitVTable function pointers
are changed accordingly).

This then uses te functions to simplify the unit_kill() call, by
avoiding the kill() vtable indirection and instead just suing
unit_main_pid() and unit_control_pid() directly.

13 months agopidref: add sigqueue() helper
Lennart Poettering [Sun, 10 Sep 2023 14:17:35 +0000 (16:17 +0200)] 
pidref: add sigqueue() helper

13 months agocore: port over unit_kill_context() to PidRef
Lennart Poettering [Sun, 10 Sep 2023 13:12:59 +0000 (15:12 +0200)] 
core: port over unit_kill_context() to PidRef

13 months agocore: port service_set_main_pid() to PidRef
Lennart Poettering [Sun, 10 Sep 2023 12:49:16 +0000 (14:49 +0200)] 
core: port service_set_main_pid() to PidRef

13 months agoMerge pull request #29206 from mrc0mmand/lsan-followup
Mike Yuan [Mon, 18 Sep 2023 15:00:04 +0000 (23:00 +0800)] 
Merge pull request #29206 from mrc0mmand/lsan-followup

core: limit the LSan shenanigans to PID 1

13 months agoupdate TODO
Lennart Poettering [Mon, 18 Sep 2023 14:20:44 +0000 (16:20 +0200)] 
update TODO

13 months agoman: Mention that JSON user record files should have the .user extension
Daan De Meyer [Mon, 18 Sep 2023 11:23:58 +0000 (13:23 +0200)] 
man: Mention that JSON user record files should have the .user extension

13 months agologind: slightly tweak error message about not enough swap for hibernation
Lennart Poettering [Mon, 18 Sep 2023 08:41:50 +0000 (10:41 +0200)] 
logind: slightly tweak error message about not enough swap for hibernation

Let's tweak the message if not enough swap is around slightly: systems
might have plenty swap backed by incompatible storage (specifically:
swap files on btrfs), but we (currently) do not support hibernating to
that.

Hence let's say *suitable* swap space and talk about *compatibility* of
backing storage.

Hopefully this will make things a bit clearer to users.

Prompted by: #29189

13 months agodoc: add a markdown doc giving an overview over the fdstore
Lennart Poettering [Mon, 18 Sep 2023 11:33:06 +0000 (13:33 +0200)] 
doc: add a markdown doc giving an overview over the fdstore

And link it up everywhere.

13 months agomeson: restore tools/meson-vcs-tag.sh
Zbigniew Jędrzejewski-Szmek [Mon, 11 Sep 2023 14:46:04 +0000 (16:46 +0200)] 
meson: restore tools/meson-vcs-tag.sh

This conceptually reverts e95acdfe1d3a790e18617bb992a712b34f41800d,
but the actual contents of the script are taken from the command invocation
in meson with all the updates that happened in the meantime.

One small change is that I replaced () by {}: this avoids one subprocess spawn.
People were worried about the cost of vcs_tag(), and this microoptimization may
help a bit. I measured the speed on machine, and noop rebuilds are still about
100–120 ms.

The logic is entirely moved to the script. This makes the meson config simpler
and also makes it easier to use it externally.

The script is needed for in-place rpm builds, see README.build-in-place.md [1],
where it is invoked from the spec file to determine the project version.

[1] https://src.fedoraproject.org/rpms/systemd/blob/rawhide/f/README.build-in-place.md

13 months agomeson: fix TODO regarding next meson version
Luca Boccassi [Mon, 18 Sep 2023 11:30:53 +0000 (12:30 +0100)] 
meson: fix TODO regarding next meson version

13 months agovimrc: explicitly set shiftwidth for the C file type 29206/head
Frantisek Sumsal [Mon, 18 Sep 2023 10:36:11 +0000 (12:36 +0200)] 
vimrc: explicitly set shiftwidth for the C file type

If you start editing a shell script and then open a buffer with a C
file, the shiftwidth set by the previous autocommand for the sh file
type would not be reset to the original (global) 8ch. Let's fix this by
explicitly setting the shiftwidth in the C file type autocommand as
well.

13 months agocore: limit the LSan shenanigans to PID 1
Frantisek Sumsal [Mon, 18 Sep 2023 10:34:42 +0000 (12:34 +0200)] 
core: limit the LSan shenanigans to PID 1

Addresses https://github.com/systemd/systemd/pull/29194#pullrequestreview-1630530753.
Follow-up to ae5ce7e.

13 months agoMerge pull request #29204 from poettering/pe-section-fix
Luca Boccassi [Mon, 18 Sep 2023 10:47:29 +0000 (11:47 +0100)] 
Merge pull request #29204 from poettering/pe-section-fix

man: systemd-stub fixes

13 months agoman: fix counting of resource types 29204/head
Lennart Poettering [Mon, 18 Sep 2023 09:19:26 +0000 (11:19 +0200)] 
man: fix counting of resource types

13 months agoman: link UKI spec from sd-stub
Lennart Poettering [Mon, 18 Sep 2023 09:19:17 +0000 (11:19 +0200)] 
man: link UKI spec from sd-stub

13 months agoman: drop duplicate .uname documentation, add .sbat documentation
Lennart Poettering [Mon, 18 Sep 2023 09:08:55 +0000 (11:08 +0200)] 
man: drop duplicate .uname documentation, add .sbat documentation

This fixes the PE section documentation in the systemd-stub man page:
for some reason .uname was listed twice, and .sbat was still missing.
Address that.

Also, let's reorder things to to match the "canonical" ordering we also
use for measurement in sd-stub. The order makes sense and there's really
no reason to depart from that here.

Minor other tweaks.

Reverts b6f2e6860220aa89550f690b12246c4e8eb6e908, among other things

13 months agohwdb: Add quirk for teclast x3 plus (G4K3) rotation (#29202)
commondservice [Mon, 18 Sep 2023 08:38:56 +0000 (16:38 +0800)] 
hwdb: Add quirk for teclast x3 plus (G4K3) rotation (#29202)

Original info:
acpi:KIOX000A:KIOX000A:

dmi:bvnTECLAST:bvrG4K3_A1tPAD3.01:bd08/25/2017:br5.12:efr14.4:svnTECLAST:pnX3Plus:pvrDefaultstring:rvnTECLAST:rnX3Plus:rvrDefaultstring:cvnDefaultstring:ct30:cvrDefaultstring:skuG4K3_A1:

It seems that teclast x3 plus has another sku G4K2. Not owning that sku, I decide not to cover the change on G4K2.

13 months agoupdate TODO
Lennart Poettering [Mon, 18 Sep 2023 07:59:12 +0000 (09:59 +0200)] 
update TODO

13 months agomeson: add TODO to switch to new 'follow_symlinks' option in the future
Luca Boccassi [Sun, 17 Sep 2023 11:51:15 +0000 (12:51 +0100)] 
meson: add TODO to switch to new 'follow_symlinks' option in the future

Newly added and will be in the next release of Meson

13 months agoRevert "ci: temporarily disable Packit's i386"
Frantisek Sumsal [Sun, 17 Sep 2023 17:37:45 +0000 (19:37 +0200)] 
Revert "ci: temporarily disable Packit's i386"

The original issue [0] should be resolved in the current Rawhide.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=2237392

This reverts commit 3bf7d7963784669f876fab46e13f71faaf61cb27.

13 months agoMerge pull request #29119 from yuwata/network-dhcp-server-allow-null-server-address
Luca Boccassi [Sun, 17 Sep 2023 11:36:33 +0000 (12:36 +0100)] 
Merge pull request #29119 from yuwata/network-dhcp-server-allow-null-server-address

network/dhcp-server: allow null server address

13 months agocore: redirect LSan's report to /dev/console during manager exit
Frantisek Sumsal [Sat, 16 Sep 2023 19:44:48 +0000 (21:44 +0200)] 
core: redirect LSan's report to /dev/console during manager exit

When exiting PID 1 we most likely don't have stdio/stdout open, so the
final LSan check would not print any actionable information and would
just crash PID 1 leading up to a kernel panic, which is a bit annoying.
Let's instead attempt to open /dev/console, and if we succeed redirect
LSan's report there.

The result is a bit messy, as it's slightly interleaved with the kernel
panic, but it's definitely better than not having the stack trace at
all:

[  OK  ] Reached target final.target.
[  OK  ] Finished systemd-poweroff.service.
[  OK  ] Reached target poweroff.target.

=================================================================
3 1m  43.251782] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[   43.252838] CPU: 2 PID: 1 Comm: systemd Not tainted 6.4.12-200.fc38.x86_64 #1
==[1==ERR O R :4 3Le.a2k53562] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
[   43.254683] Call Trace:
[   43.254911]  <TASK>
[   43.255107]  dump_stack_lvl+0x47/0x60
S[ a  43.n2555i05]  panic+t0x192/0x350
izer[   :43.255966 ]  do_exit+0x990/0xdb10
etec[   43.256504]  do_group_exit+0x31/0x80
[   43.256889]  __x64_sys_exit_group+0x18/0x20
[   43.257288]  do_syscall_64+0x60/0x90
o_user_mod leaks[   43.257618]  ? syscall_exit_t

+0x2b/0x40
[   43.258411]  ? do_syscall_64+0x6c/0x90
1mDirect le[   43.258755]  ak of 21 byte(s)? exc_page_fault+0x7f/0x180
[   43.259446]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
 [   43.259901] RiIP: 0033:0x7f357nb8f3ad4
 1 objec[   43.260354] Ctode: 48 89 (f7 0f 05 c3 sf3 0f 1e fa b8 3b 00 00 00) 0f 05 c3 0f 1f 4 0 00 f3 0f 1e fa 50 58 b8 e7 00 00 00 48 83 ec 08 48 63 ff 0f 051
[   43.262581] RSP: 002b:00007ffc25872440 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7
a RBX: 00007f357be9b218 RCX: 00007f357b8f3ad4m:ffd
[   43.264512] RDX: 0000000000000001 RSI: 00007f357b933b63 RDI: 0000000000000001
[   43.265355] RBP: 00007f357be9b218 R08: efffffffffffffff R09: 00007ffc258721ef
[   43.266191] R10: 000000000000003f R11: 0000000000000202 R12: 00000fe6ae9e0000
[   43.266891] R13: 00007f3574f00000 R14: 0000000000000000 R15: 0000000000000007
[   43.267517]  </TASK>

    #0 0x7f357b8814a8 in strdup (/lib64/libasan.so.8+0x814a8) (BuildId: e5f0a0d511a659fbc47bf41072869139cb2db47f)
    #1 0x7f3578d43317 in cg_path_decode_unit ../src/basic/cgroup-util.c:1132
    #2 0x7f3578d43936 in cg_path_get_unit ../src/basic/cgroup-util.c:1190
    #3 0x7f3578d440f6 in cg_pid_get_unit ../src/basic/cgroup-util.c:1234
    #4 0x7f35789263d7 in bus_log_caller ../src/shared/bus-util.c:734
    #5 0x7f357a9cf10a in method_reload ../src/core/dbus-manager.c:1621
    #6 0x7f3578f77497 in method_callbacks_run ../src/libsystemd/sd-bus/bus-objects.c:406
    #7 0x7f3578f80dd8 in object_find_and_run ../src/libsystemd/sd-bus/bus-objects.c:1319
    #8 0x7f3578f82487 in bus_process_object ../src/libsystemd/sd-bus/bus-objects.c:1439
    #9 0x7f3578fe41f1 in process_message ../src/libsystemd/sd-bus/sd-bus.c:3007
    #10 0x7f3578fe477b in process_running ../src/libsystemd/sd-bus/sd-bus.c:3049
    #11 0x7f3578fe75d1 in bus_process_internal ../src/libsystemd/sd-bus/sd-bus.c:3269
    #12 0x7f3578fe776e in sd_bus_process ../src/libsystemd/sd-bus/sd-bus.c:3296
    #13 0x7f3578feaedc in io_callback ../src/libsystemd/sd-bus/sd-bus.c:3638
    #14 0x7f35791c2f68 in source_dispatch ../src/libsystemd/sd-event/sd-event.c:4187
    #15 0x7f35791cc6f9 in sd_event_dispatch ../src/libsystemd/sd-event/sd-event.c:4808
    #16 0x7f35791cd830 in sd_event_run ../src/libsystemd/sd-event/sd-event.c:4869
    #17 0x7f357abcd572 in manager_loop ../src/core/manager.c:3244
    #18 0x41db21 in invoke_main_loop ../src/core/main.c:1960
    #19 0x426615 in main ../src/core/main.c:3125
    #20 0x7f3577c49b49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #21 0x7f3577c49c0a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #22 0x408494 in _start (/usr/lib/systemd/systemd+0x408494) (BuildId: fe61e1b0f00b6a36aa34e707a98c15c52f6b960a)

SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
[   43.295912] Kernel Offset: 0x7000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[   43.297036] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100 ]---

Originally noticed in https://github.com/systemd/systemd/pull/28579.

13 months agoMerge pull request #29197 from takaswie/topic/hwdb/ieee1394-unit-function
Yu Watanabe [Sun, 17 Sep 2023 05:23:38 +0000 (07:23 +0200)] 
Merge pull request #29197 from takaswie/topic/hwdb/ieee1394-unit-function

hwdb: ieee1394 unit function: fulfill Weiss Engieering FireWire models

13 months agohwdb: ieee1394-unit-function: add Weiss Engieering MAN301 29197/head
Takashi Sakamoto [Sun, 17 Sep 2023 02:52:28 +0000 (11:52 +0900)] 
hwdb: ieee1394-unit-function: add Weiss Engieering MAN301

Michele Perrone contributes configuration ROM image for Weiss MAN301, which
includes two units for 1394TA AV/C devices 1.0 and TCAT general protocol.

* https://lore.kernel.org/alsa-devel/20230822135807.GA470519@workstation.local/

This commit adds hwdb entry for the model.

13 months agohwdb: ieee1394-unit-function: add Weiss Engineering INT203 entry with older firmware
Takashi Sakamoto [Sun, 17 Sep 2023 02:52:28 +0000 (11:52 +0900)] 
hwdb: ieee1394-unit-function: add Weiss Engineering INT203 entry with older firmware

Michele Perrone reported that the model ID for INT203 with initial firmware
is 0x00000a.

* https://lore.kernel.org/alsa-devel/a5b63c37-7f6f-46f3-a87f-e4e7c0c9b5c8@weiss.ch/

This commit fulfills the entry corresponding to it as well as supplemental
comment denoting to it.

13 months agohwdb: ieee1394-unit-function: add Weiss Engineering DAC202 (Maya edition)
Takashi Sakamoto [Sun, 17 Sep 2023 02:52:28 +0000 (11:52 +0900)] 
hwdb: ieee1394-unit-function: add Weiss Engineering DAC202 (Maya edition)

Michele Perrone and Ralf Anderegg contribute to ALSA dice driver to support
products of Weiss Engineering. Their patch includes support for DAC202 Maya
edition.

* https://lore.kernel.org/alsa-devel/24703333-9250-40bf-e736-a5f3c4862034@weiss.ch/

This commit fulfulls an entry for the model as well as supplemental comment
to DAC2/Minerva.

13 months agohwdb: ieee1394-unit-function: remove superfluous Weiss Engineering DAC1 entry
Takashi Sakamoto [Sun, 17 Sep 2023 02:52:28 +0000 (11:52 +0900)] 
hwdb: ieee1394-unit-function: remove superfluous Weiss Engineering DAC1 entry

Michele Perrone and Rolf Anderegg reported that their product with
model_id 0x000005 was experimental for internal use and never for
consumer market.

* https://lore.kernel.org/alsa-devel/a5b63c37-7f6f-46f3-a87f-e4e7c0c9b5c8@weiss.ch/

This commit deletes corresponding entry.

13 months agohwdb: Add Logitech G502 X
Michael Kuhn [Sat, 16 Sep 2023 17:54:48 +0000 (19:54 +0200)] 
hwdb: Add Logitech G502 X

The already existing entry refers to the Logitech G502 X LIGHTSPEED,
rename it accordingly.

DPI and frequency were taken from Logitech G HUB and
https://www.logitech.com/assets/66240/2/g502-x-corded-gaming-mice-artanis.pdf

13 months agodoc: Scope is automatic for IPv6 address
Tj [Fri, 15 Sep 2023 08:20:04 +0000 (09:20 +0100)] 
doc: Scope is automatic for IPv6 address

The kernel automatically sets the scope of IPv6 addresses. That is
0 (global), 254 (host), 253 (link).

13 months agoMerge pull request #29184 from keszybz/more-pager
Mike Yuan [Fri, 15 Sep 2023 11:53:58 +0000 (19:53 +0800)] 
Merge pull request #29184 from keszybz/more-pager

Use the pager in more places

13 months agoman: add versioned version of --no-pager, use for systemd-path 29184/head
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2023 20:28:23 +0000 (22:28 +0200)] 
man: add versioned version of --no-pager, use for systemd-path

13 months agopath: add --no-pager option, enable pager by default
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2023 20:30:14 +0000 (22:30 +0200)] 
path: add --no-pager option, enable pager by default

When called with no argument, to list all known values, it is likely that it's
used by somebody to look at all the whole list. The output is more than a page,
so let's enable the pager.

13 months agopath: rename functions
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2023 10:45:43 +0000 (12:45 +0200)] 
path: rename functions

When this was originally added in 9a00f57a5ba7ed431e6bac8d8b36518708503b4e,
the lookup function was called sd_path_home. But it was generalized a long time
ago.

13 months agopath: modernize, return first error
Zbigniew Jędrzejewski-Szmek [Thu, 14 Sep 2023 10:42:50 +0000 (12:42 +0200)] 
path: modernize, return first error

13 months agobootctl: use pager in help
Zbigniew Jędrzejewski-Szmek [Tue, 12 Sep 2023 14:45:22 +0000 (16:45 +0200)] 
bootctl: use pager in help

The output is more than one page, let's enable the pager.

13 months agoexport: use highlighting in --help
Zbigniew Jędrzejewski-Szmek [Tue, 12 Sep 2023 14:44:52 +0000 (16:44 +0200)] 
export: use highlighting in --help

13 months agoRevert "mkosi: pin CentOS9 kernel to working version"
Frantisek Sumsal [Wed, 6 Sep 2023 19:20:01 +0000 (21:20 +0200)] 
Revert "mkosi: pin CentOS9 kernel to working version"

The original issue should be fixed in kernel-5.14.0-362.el9.

This reverts commit b0881b65a69e83decab3df0d2b23206cea59bb1b.

13 months agopo: Translated using Weblate (Russian)
Sergey A [Tue, 12 Sep 2023 14:35:50 +0000 (16:35 +0200)] 
po: Translated using Weblate (Russian)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Sergey A <sw@atrus.ru>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ru/
Translation: systemd/main

13 months agoMerge pull request #29156 from bluca/signal_dump_jobs
Luca Boccassi [Mon, 11 Sep 2023 19:41:09 +0000 (20:41 +0100)] 
Merge pull request #29156 from bluca/signal_dump_jobs

core: dump jobs list on sigrtmin+18 with 0x500

13 months agoserialize: don#t allocate 1M on the stack just like that
Lennart Poettering [Mon, 11 Sep 2023 10:21:14 +0000 (12:21 +0200)] 
serialize: don#t allocate 1M on the stack just like that

Prompted by: https://github.com/systemd/systemd/pull/27890#issuecomment-1712841117

13 months agologind: add PrepareForShutdownWithMetadata signal
Luca Boccassi [Wed, 30 Aug 2023 18:51:13 +0000 (19:51 +0100)] 
logind: add PrepareForShutdownWithMetadata signal

The existing signal doesn't say which type of shutdown is going to happen.
With the introduction of soft-reboot, it is useful to have this information
broadcasted, so that clients can choose to do different things based on the
reboot type.
Add a{sv} as the payload so that more metadata can be added later if
needed, without needing to add yet another signal.
Send both old and new signal for backward compatibility, and send the new
one first so that clients can just wait for the first one on both old and
new systems.

13 months agocore: dump jobs list on sigrtmin+18 with 0x500 29156/head
Luca Boccassi [Sun, 10 Sep 2023 21:52:05 +0000 (22:52 +0100)] 
core: dump jobs list on sigrtmin+18 with 0x500

13 months agocore: use structured initialization in exec_context_init
Luca Boccassi [Fri, 1 Sep 2023 01:30:09 +0000 (02:30 +0100)] 
core: use structured initialization in exec_context_init

13 months agoMerge pull request #29130 from poettering/unit-defaults
Luca Boccassi [Sat, 9 Sep 2023 18:15:46 +0000 (19:15 +0100)] 
Merge pull request #29130 from poettering/unit-defaults

core: introduce UnitDefaults structure for unit defaults

13 months agoMerge pull request #29142 from poettering/pidref
Luca Boccassi [Sat, 9 Sep 2023 17:39:16 +0000 (18:39 +0100)] 
Merge pull request #29142 from poettering/pidref

core: first step towards a pidfd focused future

13 months agoMerge pull request #29143 from DaanDeMeyer/mkosi-presets
Luca Boccassi [Sat, 9 Sep 2023 15:38:29 +0000 (16:38 +0100)] 
Merge pull request #29143 from DaanDeMeyer/mkosi-presets

Various mkosi improvements

13 months agomkosi: Conditionally use tools tree 29143/head
Daan De Meyer [Sat, 9 Sep 2023 10:20:26 +0000 (12:20 +0200)] 
mkosi: Conditionally use tools tree

If the systemd version on the host is too old and there's no local
build directory, use the default tools tree which will build an
image containing all the tooling required to build systemd and use
that to build the other presets.

13 months agomkosi: Only build system preset by default
Daan De Meyer [Sat, 9 Sep 2023 08:20:01 +0000 (10:20 +0200)] 
mkosi: Only build system preset by default

Let's not build all presets by default, but only the system preset.
Also, let's only make the system preset depend on the initrd preset
if we're building a bootable disk image. This means that if we build
the system image as a cpio, uki or directory, the initrd preset will
be skipped as it's not necessary, making the build a little faster.

13 months agomkosi: Move to Fedora 39
Daan De Meyer [Fri, 8 Sep 2023 20:04:28 +0000 (22:04 +0200)] 
mkosi: Move to Fedora 39

13 months agomkosi: Update to latest
Daan De Meyer [Sat, 9 Sep 2023 13:45:41 +0000 (15:45 +0200)] 
mkosi: Update to latest

13 months agomkosi: Make sure custom installkernel scripts are not used
Daan De Meyer [Sat, 9 Sep 2023 09:31:26 +0000 (11:31 +0200)] 
mkosi: Make sure custom installkernel scripts are not used

The kernel has this horrible build system feature where distros
can ship /sbin/installkernel and it'll automatically be used by
make install. Let's make sure that doesn't happen as on Debian this
script puts the kernel under the wrong name causing mkosi build
failures.

13 months agoMerge pull request #29117 from Werkov/memory_available
Mike Yuan [Sat, 9 Sep 2023 12:52:05 +0000 (20:52 +0800)] 
Merge pull request #29117 from Werkov/memory_available

Make MemoryAvailable= more useful

13 months agoupdate TODO 29142/head
Lennart Poettering [Sat, 9 Sep 2023 07:56:29 +0000 (09:56 +0200)] 
update TODO

13 months agomachined: port over to PidRef too
Lennart Poettering [Sat, 9 Sep 2023 10:57:46 +0000 (12:57 +0200)] 
machined: port over to PidRef too

13 months agologind: also port session leader tracking over to PidRef
Lennart Poettering [Sat, 9 Sep 2023 10:35:07 +0000 (12:35 +0200)] 
logind: also port session leader tracking over to PidRef

13 months agocore: don't manually destroy timer when we can't spawn a child
Lennart Poettering [Sat, 9 Sep 2023 10:09:53 +0000 (12:09 +0200)] 
core: don't manually destroy timer when we can't spawn a child

Let's stop manually destroying the timers when we fail to spawn a child.
We don't do this in any of the similar codepaths in any of the unit
types, only in two specific ones in socket/swap. Destroying the timer is
unnecessary, since this is done anyway in the _set_state() call of each
unit type if not appropriate, and every failure path here runs through
that anyway.

This brings all these similar codepaths into sync.

13 months agocore: also port swap units to PidRef
Lennart Poettering [Sat, 9 Sep 2023 09:57:39 +0000 (11:57 +0200)] 
core: also port swap units to PidRef

13 months agocore: also port mount units to PidRef
Lennart Poettering [Sat, 9 Sep 2023 09:52:14 +0000 (11:52 +0200)] 
core: also port mount units to PidRef

13 months agocore: convert Socket logic to PidRef too
Lennart Poettering [Sat, 9 Sep 2023 07:55:50 +0000 (09:55 +0200)] 
core: convert Socket logic to PidRef too

Just like the previous commit, but for socket rather than service units.

13 months agocore: reference main/control pid of .service units via PidRef
Lennart Poettering [Sat, 9 Sep 2023 07:49:22 +0000 (09:49 +0200)] 
core: reference main/control pid of .service units via PidRef

The first conversion to PidRef. It's mostly an excercise of
search/replace, but with some special care taken for life-cycle (i.e. we
need to destroy the structure properly once done, to release the pidfd).

It also uses pidfd based killing for some of the killing but leaves most
as it is to make the conversion minimal.

13 months agopidref: add structure that can reference a pid via both pidfd and pid_t
Lennart Poettering [Sat, 9 Sep 2023 07:29:27 +0000 (09:29 +0200)] 
pidref: add structure that can reference a pid via both pidfd and pid_t

Let's start with the conversion of PID 1 to pidfds. Let's add a simple
structure with just two fields that can be used to maintain a reference
to arbitrary processes via both pid_t and pidfd.

This is an embeddable struct, to keep it in line with where we
previously used a pid_t directly to track a process.

Of course, since this might contain an fd on systems where we have pidfd
this structure has a proper lifecycle.

(Note that this is quite different from sd_event_add_child() event
source objects as that one is only for child processes and collects
process results, while this infra is much simpler and more generic and
can be used to reference any process, anywhere in the tree.)

13 months agomkosi: Allow configuring whether to do secure boot and pcrs from CLI
Daan De Meyer [Sat, 9 Sep 2023 08:15:46 +0000 (10:15 +0200)] 
mkosi: Allow configuring whether to do secure boot and pcrs from CLI

13 months agodbus: Document org.freedesktop.systemd1.Service.MemoryAvailable property 29117/head
Michal Koutný [Thu, 7 Sep 2023 18:00:28 +0000 (20:00 +0200)] 
dbus: Document org.freedesktop.systemd1.Service.MemoryAvailable property

The value is an optimistic estimate, make it clear in the docs.

13 months agoMerge pull request #29127 from YHNdnzj/wall-followup
Luca Boccassi [Sat, 9 Sep 2023 00:30:51 +0000 (01:30 +0100)] 
Merge pull request #29127 from YHNdnzj/wall-followup

shared/wall: several cleanups

13 months agoMerge pull request #29116 from yuwata/network-sriov-debug
Luca Boccassi [Sat, 9 Sep 2023 00:28:35 +0000 (01:28 +0100)] 
Merge pull request #29116 from yuwata/network-sriov-debug

network/sr-iov: ignore EINVAL in reading dev_port sysfs attribute

13 months agozsh: busctl: fix flags parsing for properties
Ronan Pigott [Fri, 8 Sep 2023 22:27:39 +0000 (15:27 -0700)] 
zsh: busctl: fix flags parsing for properties

I'm not quite sure what the original intent of this line was, but it
doesn't work in the one call-site the "required" argument is actually
used. The "writable" flag was indexed as a scalar leaving only the
"e" to compare against.

Instead, let's just sort the parsed flags and compare the whole thing.
Also substitute "required" as a pattern, so that pattern based
comparisons may be supported.

13 months agoRevert "tree-wide: Mount file descriptors via /proc/<pid>/fd"
Lennart Poettering [Fri, 8 Sep 2023 19:28:26 +0000 (21:28 +0200)] 
Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd"

13 months agoserialize: add common deserialize_read_line() helper and use it everywhere
Lennart Poettering [Fri, 8 Sep 2023 15:02:11 +0000 (17:02 +0200)] 
serialize: add common deserialize_read_line() helper and use it everywhere

This introduces a common helper replacing three very similar uses.

Prompted by review of: #27890

13 months agoTODO: switch the default wall implementation to sd-login 29127/head
Mike Yuan [Fri, 8 Sep 2023 11:50:02 +0000 (19:50 +0800)] 
TODO: switch the default wall implementation to sd-login

13 months agoshared/wall: fall back to logind if utmpx database doesn't exist
Mike Yuan [Fri, 8 Sep 2023 18:01:57 +0000 (02:01 +0800)] 
shared/wall: fall back to logind if utmpx database doesn't exist

13 months agoshared/wall: several cleanups
Mike Yuan [Fri, 8 Sep 2023 11:16:46 +0000 (19:16 +0800)] 
shared/wall: several cleanups

Follow-up for 53c0397b1dbc95f144d9a551c2086d132933e8ce

* Split do_wall into wall_utmp and wall_logind
* Don't pass unused arguments
* Add missing asserts
* Modernize error handling
* Don't do anything if neither utmp nor logind is enabled

13 months agoutmp-wtmp: remove unneeded include
Mike Yuan [Fri, 8 Sep 2023 10:44:44 +0000 (18:44 +0800)] 
utmp-wtmp: remove unneeded include

13 months agocgroup: Estimate MemoryAvailable= when DefaultMemoryAccounting=no
Michal Koutný [Thu, 7 Sep 2023 17:48:48 +0000 (19:48 +0200)] 
cgroup: Estimate MemoryAvailable= when DefaultMemoryAccounting=no

Without memory accounting explicitly disabled, we may not obtain current
consumption from all units on the ancestry path.
Use a descendant value as lower bound estimate for ancestors if
ancestor's consumption cannot be directly queried.

This makes MemoryAvailable= an upper bound of available values.

13 months agocgroup: Refactor MemoryAvailable= evaluation
Michal Koutný [Thu, 7 Sep 2023 17:27:52 +0000 (19:27 +0200)] 
cgroup: Refactor MemoryAvailable= evaluation

unit_get_memory_available() duplicates similar logic contained in
unit_get_memory_current(). Instead, it can call it for each unit it
needs data for.
Additionally, simplify the flow by treating all units from leaf to root
uniformly in one loop.

Functional change when a queried unit does not have MemoryAccounting=yes
(or cgroup_path), we will try getting an estimate from ancestors.

13 months agocgroup: Fix MemoryAvailable= by considering physical memory
Michal Koutný [Thu, 7 Sep 2023 16:50:08 +0000 (18:50 +0200)] 
cgroup: Fix MemoryAvailable= by considering physical memory

Currently, querying a unit's available memory would result in infinity
if there are no limits set on the unit or ancestors.
That undermines semantics implied by the name, so look at the physical
memory if the search propagates up to the -.slice.
This makes sense even in systemd user instances, limits of -.slice are
still looked at too.

Also change printed representation of infinite MemoryAvailable which
means we could not figure out a good estimate.

13 months agoconf-parser: parse main config first only if not symlinked to/as drop-in
Mike Yuan [Thu, 7 Sep 2023 13:38:00 +0000 (21:38 +0800)] 
conf-parser: parse main config first only if not symlinked to/as drop-in

Otherwise we'll skip parsing main config directly.

Replaces #27152
Replaces #28956:
chase() is an overkill for determining whether
two files are the same. We only need to check
if the inodes are the same.

13 months agorepart,bootspec: use set_ensure_consume
Mike Yuan [Thu, 7 Sep 2023 15:28:45 +0000 (23:28 +0800)] 
repart,bootspec: use set_ensure_consume

13 months agoukify/man: Look for a config file in systemd folders if not specified
Alvin Alvarado [Fri, 8 Sep 2023 04:02:52 +0000 (14:02 +1000)] 
ukify/man: Look for a config file in systemd folders if not specified

If the user does not specify a config file to use, ukify will try looking for one at {/run,/etc,/usr/local/lib,/usr/lib}/systemd/ukify.conf in order and then use the first one found. Also made sure the --config input is a pathlib.Path by specifying its type in its CONFIG_ITEMS entry.
Big cheers to Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> for helping!

13 months agocore: introduce unit_defaults_init() common initialization helper 29130/head
Lennart Poettering [Fri, 8 Sep 2023 12:26:17 +0000 (14:26 +0200)] 
core: introduce unit_defaults_init() common initialization helper

THis adds a helper for initializing UnitDefaults to our default values.
Previously we'd do that differently in two different locations. Let's
unify this in one, and apply the exact same settings at both as
defaults.

13 months agomanager: add manager_set_unit_defaults() call that sets all unit defaults in one go
Lennart Poettering [Fri, 8 Sep 2023 12:06:42 +0000 (14:06 +0200)] 
manager: add manager_set_unit_defaults() call that sets all unit defaults in one go

No change in behaviour. Just some refactoring.

13 months agomanager: move various fields that declare unit defaults into a new structure UnitDefaults
Lennart Poettering [Fri, 8 Sep 2023 11:37:52 +0000 (13:37 +0200)] 
manager: move various fields that declare unit defaults into a new structure UnitDefaults

This adds a new structure UnitDefaults which embedds the various default
settings for units we maintain. We so far maintained two sets of
variables for this, one in main.c as static variables and one in the
Manager structure. This moves them into a common structure.

This is most just search/replace, i.e. very dumb refactoring.

The fact that we now use a common structure for this allows us further
refactorings later.

Inspired by the discussions on #27890

13 months agonetwork/sr-iov: move common parts to link_set_sr_iov_ifindices() 29116/head
Yu Watanabe [Thu, 7 Sep 2023 15:56:16 +0000 (00:56 +0900)] 
network/sr-iov: move common parts to link_set_sr_iov_ifindices()

This also adds several debugging logs.
No functional change, just refactoring.

13 months agonetwork/sr-iov: ignore -EINVAL in reading dev_port sysfs attribute
Yu Watanabe [Thu, 7 Sep 2023 15:54:08 +0000 (00:54 +0900)] 
network/sr-iov: ignore -EINVAL in reading dev_port sysfs attribute

Fixes #27369.

13 months agotest-network: add testcase for [DHCPServer] ServerAddress= with null address 29119/head
Yu Watanabe [Thu, 7 Sep 2023 21:33:19 +0000 (06:33 +0900)] 
test-network: add testcase for [DHCPServer] ServerAddress= with null address

13 months agoman: update [DHCPServer] ServerAddress=
Yu Watanabe [Thu, 7 Sep 2023 19:08:32 +0000 (04:08 +0900)] 
man: update [DHCPServer] ServerAddress=

13 months agonetwork: allow to set null address for [DHCPServer] ServerAddress=
Yu Watanabe [Thu, 7 Sep 2023 21:35:26 +0000 (06:35 +0900)] 
network: allow to set null address for [DHCPServer] ServerAddress=

And refuse a link-local address.

With the previous commit, now ServerAddress= can take a null address,
but the config parser refused that. Let's allow that now.

13 months agonetwork: find DHCP server address only on loading .network file
Yu Watanabe [Thu, 7 Sep 2023 18:27:07 +0000 (03:27 +0900)] 
network: find DHCP server address only on loading .network file

Previously, we periodically search suitable address for DHCP server,
1. when .network file is loaded,
2. when checking if we can configure sd_dhcp_server object,
3. when configuring sd_dhcp_server.

Especially, the step 2 may be triggered several times.

This makes, when .network file is loaded, find a corresponding Address
object, add a new Address object if not found, then save the found or
added Address object. So, it is not necessary to find address again on
configuring sd_dhcp_server object.

13 months agonetwork: call network_adjust_dhcp_server() from network_drop_invalid_addresses()
Yu Watanabe [Thu, 7 Sep 2023 20:34:32 +0000 (05:34 +0900)] 
network: call network_adjust_dhcp_server() from network_drop_invalid_addresses()

We need to find a suitable static address for the DHCP server.
So, all static addresses must be verified before network_adjust_dhcp_server()
is called. For safety, let's call it from network_drop_invalid_addresses().

No functional change, just refactoring and preparation for later
commits.

13 months agoMerge pull request #29123 from yuwata/conf-parser-cleanups-for-config-section
Mike Yuan [Fri, 8 Sep 2023 10:11:12 +0000 (18:11 +0800)] 
Merge pull request #29123 from yuwata/conf-parser-cleanups-for-config-section

conf-parser: several cleanups and generalizations for ConfigSection

13 months agoMerge pull request #29121 from yuwata/network-drop-duplicated
Luca Boccassi [Fri, 8 Sep 2023 09:42:08 +0000 (10:42 +0100)] 
Merge pull request #29121 from yuwata/network-drop-duplicated

network: drop duplicated checks and function calls

13 months agoMerge pull request #29071 from YHNdnzj/loop-write-full
Lennart Poettering [Fri, 8 Sep 2023 08:24:39 +0000 (10:24 +0200)] 
Merge pull request #29071 from YHNdnzj/loop-write-full

io-util: introduce loop_write_full and use it where appropriate

13 months agomkosi: Drop arch workaround
Daan De Meyer [Fri, 8 Sep 2023 07:47:41 +0000 (09:47 +0200)] 
mkosi: Drop arch workaround

archlinux-keyring was updated in Michel's PPA so let's drop the
workaround.

13 months agoconf-parser: introduce ordered_hashmap_by_section_find_unused_line() 29123/head
Yu Watanabe [Thu, 7 Sep 2023 19:42:48 +0000 (04:42 +0900)] 
conf-parser: introduce ordered_hashmap_by_section_find_unused_line()

13 months agoconf-parser: check overflow in hashmap_find_free_section_line()
Yu Watanabe [Thu, 7 Sep 2023 20:11:57 +0000 (05:11 +0900)] 
conf-parser: check overflow in hashmap_find_free_section_line()

Also, this also renames the function, and makes it optionally takes
a filename.

13 months agoconf-parser: modernize config_section_new()
Yu Watanabe [Thu, 7 Sep 2023 19:59:39 +0000 (04:59 +0900)] 
conf-parser: modernize config_section_new()

- add assertions,
- rename argument to store result.

13 months agohashmap: introduce HASHMAP_BASE_FOREACH() and friend
Yu Watanabe [Thu, 7 Sep 2023 19:39:15 +0000 (04:39 +0900)] 
hashmap: introduce HASHMAP_BASE_FOREACH() and friend

13 months agonetwork: drop duplicated check 29121/head
Yu Watanabe [Thu, 7 Sep 2023 18:26:27 +0000 (03:26 +0900)] 
network: drop duplicated check

The same check is in network_adjust_dhcp_server().

13 months agonetwork: drop duplicated address_set_broadcast()
Yu Watanabe [Thu, 7 Sep 2023 19:16:31 +0000 (04:16 +0900)] 
network: drop duplicated address_set_broadcast()

It will be called later in link_request_address().