Commit Graph

54306 Commits

Author SHA1 Message Date
Emily Gonyer
be7148ebed Change gendered terms to be gender-neutral (#21325)
Some typos are also fixed.
2021-11-12 16:09:56 +01:00
Lennart Poettering
b0c4b28246 pid1: add a manager_trigger_run_queue() helper
We have two different places where we re-trigger the run queue now.
let's unify it under a common function, that is part of the Manager
code.

Follow-up for #20953
2021-11-12 15:52:37 +01:00
Lennart Poettering
6ebbcafeb4 Merge pull request #20953 from msekletar/mount-ratelimit-followup-20329
Delay running mount start jobs when we /p/s/mountinfo event source is rate limited
2021-11-12 09:23:47 +01:00
Jonas Witschel
6401279fee test: add regression test for systemd-run --scope [--user]
systemd-run --scope --user failed to run in system 249.6, cf. #21297. Add tests
for systemd-run --scope and systemd-run --scope --user to make sure this does
not regress again.
2021-11-12 13:31:46 +09:00
Lennart Poettering
e7cef2a6ea macro-fundamental: fix bool → sd_bool 2021-11-11 23:50:52 +00:00
Luca Boccassi
977e68c71b Merge pull request #21285 from poettering/boot-os-rel-fix
sd-boot/bootspec: os-release parsing fixes
2021-11-11 20:23:17 +00:00
Luca Boccassi
1977d1477f Merge pull request #21241 from wat-ze-hex/2021-11-04-fix-bpf-foreign-realization
core, bpf: fix bpf-foreign cgroup controller realization
2021-11-11 18:49:50 +00:00
Lennart Poettering
af11e0ef84 update TODO 2021-11-11 18:38:26 +01:00
Lennart Poettering
f22abf384d types-fundamental: introduce sd_true + sd_false
I think we should stick to the rule that stuff defined in
types-fundamental.h either:

1. adds a prefixed concept "sd_xyz" that maps differently in the two
   environments

2. adds a non-prefixed concept "xyz" that adds a type otherwise missing
   in one of the two environments but with the same definition as in the
   other.

i.e. if have have some concept that might differ the way its set up in
the two environments it really should be prefixed by "sd_" to make clear
it has semantics we defined. Only drop the prefix if it really means the
exact same thin in all environments.

Now, sd_bool is defined prefixed, because its either mapped to "BOOLEAN"
(which is an integer) in UEFI or "bool" (which is C99 _Bool) in
userspace. size_t is not defined prefixed, because it's mapped to the
same thing ultimately (on the UEFI its mapped to UINTN, but that in turn
is defined as being the type for the size of memory objects, thus it's
really the same as userspace size_t).

So far "true" and "false" where defined unprefixed even though they map
to values of different types. typeof(true) in userspace would reveal
_Bool, but typeof(false) in UEFI would reveal BOOLEAN. The distinction
actually does matter in comparisons (i.e. (_Bool) 1 == (_Bool) 2 holds
while (BOOLEAN) 1 == (BOOLEAN) 2 does not hold).

Hence, let's add sd_true and sd_false, thus indicating we defined our
own concept here, and it has similar but different semantics in UEFI and
in userspace.
2021-11-11 17:23:34 +01:00
Lennart Poettering
e514b5071c fundamental: rename type.h → types-fundamental.h
"type.h" is a very generic name, but this header is very specific to
making the "fundaemtnal" stuff work, it maps genric types in two
distinct ways. Hence let's make clear in the header name already what
this is about.
2021-11-11 17:23:09 +01:00
Lennart Poettering
81d9db6805 boot: line-break magic[] array to match osrel[] line breaks 2021-11-11 17:23:04 +01:00
Lennart Poettering
c2caeb5d54 bootspec: catch up with sd-boot's bootspec implementation
Let's parse the same fields and use them the same way as in sd-boot.

Fixes: #20093
2021-11-11 17:22:59 +01:00
Lennart Poettering
df33178416 boot: when we can't boot use the right boot loader entry display title in log message 2021-11-11 17:22:55 +01:00
Lennart Poettering
18fde343a8 boot: clean up unified boot loader entry name/version extraction
Let's make sure IMAGE_ID/IMAGE_VERSION are properly honoured, and
explain in a long comment why.

Let's also use ID= field again, which was lost by accident.

(While we are at it do some minimal OOM checks wherever we touch
something)
2021-11-11 17:22:31 +01:00
Lennart Poettering
31f7765762 bootspec: fix comment that says exactly the opposite of what is true 2021-11-11 17:22:27 +01:00
Lennart Poettering
1ce915a91c boot: const arguments should be const
Unfortunately they forgot the "const" decoration on the MetaiMatch()
prototype, but let that omission not leak into our code, let's hide it
away in the innermost use.
2021-11-11 17:22:23 +01:00
Lennart Poettering
b78a282181 boot: ternary op is your friend 2021-11-11 17:22:18 +01:00
Lennart Poettering
08cd8c4307 boot: add comments what closely related ConfigEntry fields are about 2021-11-11 17:21:37 +01:00
Michal Sekletar
edc027b4f1 mount: retrigger run queue after ratelimit expired to run delayed mount start jobs
Fixes #20329
2021-11-11 17:04:39 +01:00
Michal Sekletar
a7c93dfe91 mount: make mount units start jobs not runnable if /p/s/mountinfo ratelimit is in effect 2021-11-11 17:04:39 +01:00
Michal Sekletar
705578c3b9 core: rename/generalize UNIT(u)->test_start_limit() hook
Up until now the main reason why we didn't proceed with starting the
unit was exceed start limit burst. However, for unit types like mounts
the other reason could be effective ratelimit on /proc/self/mountinfo
event source. That means our mount unit state may not reflect current
kernel state. Hence, we need to attempt to re-run the start job again
after ratelimit on event source expires.

As we will be introducing another reason than start limit let's rename
the virtual function that implements the check.
2021-11-11 17:04:36 +01:00
Michal Sekletar
fd69f22475 sd-event: introduce callback invoked when event source ratelimit expires 2021-11-11 17:02:56 +01:00
Jonas Witschel
c65417a011 scope: count successful cgroup additions when delegating via D-Bus
Since commit 8d3e4ac7cd ("scope: refuse
activation of scopes if no PIDs to add are left") all "systemd-run --scope
--user" calls fail because cgroup attachments delegated to the system instance
are not counted towards successful additions. Fix this by incrementing the
return value in case unit_attach_pid_to_cgroup_via_bus() succeeds, similar to
what happens when cg_attach() succeeds directly.

Note that this can *not* distinguish the case when
unit_attach_pid_to_cgroup_via_bus() has been run successfully, but all
processes to attach are gone in the meantime, unlike the checks that commit
8d3e4ac7cd adds for the system instance. This is
because even though unit_attach_pid_to_cgroup_via_bus() leads to an internal
unit_attach_pids_to_cgroup() call, the return value over D-Bus does not include
the number of successfully attached processes and is always NULL on success.

Fixes: #21297
2021-11-11 15:19:51 +00:00
ml
84b10e536c man: remove unintentionally repetitive words 2021-11-11 14:36:50 +01:00
Lennart Poettering
371264b6c6 Merge pull request #21302 from yuwata/udev-drop-colon-from-ID_NET_NAME_MAC
udev: drop colon from ID_NET_NAME_MAC
2021-11-11 14:36:28 +01:00