| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Follow-up for c26948c6dae1d2ca13499b36f193b13a0760834c
We only want to get rid of cred mount here, and RuntimeDirectory=
is documented to be retained for SERVICE_EXITED state.
Fixes #35427
|
|
|
|
|
|
|
|
|
| |
By default mount(8), umount(8), swapon(8) and swapoff(8) should run with
with the SMACK label inherited from systemd rather than the default one
meant for services.
Fixes: aa5ae9711ef3cd0c69b7fcfbd65bca05fb704a8a
Follow-up-for: 20bbf5ee4c6c80599a91e7a4b7474e931a27db4a
|
|
|
|
|
|
|
|
| |
unit_verify_contexts()
While at it, allow "mixed" for all unit types too, i.e.
also apply ebc2259da1d1579347b86fc2ebca9f96334b6f22 to
socket/mount/swap units.
|
|
|
|
| |
It seems unnecessary to duplicate the func ptrs everywhere.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, unit_setup_cgroup_runtime() is called in
various _coldplug() functions if the unit is not inactive.
That seems unnecessary though, and kinda defeats the purpose
of CGroupRuntime. If we need to fork off a process for the unit
or got something during deserialization, the CGroupRuntime
would be automatically set up by unit_prepare_exec() /
cgroup_runtime_deserialize_one(). Otherwise it would mean
the cgroup doesn't exist and we don't need to allocate
that in the first place.
Plus, note that socket units might also carry a cgroup with
ExecStartPre=/ExecStartPost=/... Hence the existing code
is really inconsistent.
|
|
|
|
|
|
|
|
|
| |
Follow-up for ba31a5018f99864c22dd4e0f10712456c7abc934
'new' is already used as a macro for memory allocation.
Let's avoid the confusion here.
Addresses https://github.com/systemd/systemd/pull/31902#discussion_r1557672858
|
| |
|
|
|
|
|
| |
socket and service units output there ExecCommand/ExecStatus definitions
already, but this was missing in mount/swap. Fix that.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, when downgrading from a version with pidfd support to a
version without pidfd support, all information about running processes
is lost as the newer systemd will serialized pidfds which are not recognized
by the older systemd when deserializing.
To improve the situation, let's serialize both the pid and the pidfd.
This is safe because existing versions will either replace the first
deserialized pidref with the second one or discard the second one in
favor of the first one depending on the unit and field. Older versions
that don't support pidfd's will silently discard any fields that contain
a pidfd as those will try to parse the field as a pid and since a pidfd
field will start with '@', those versions will debug error log and ignore
the value.
To make sure we reuse the existing pidfd as much as possible, the pidfd
is serialized first. Both for scopes and service main pids, if the same
pid is seen multiple times, the first pidref is kept. So by serializing
the pidfd first we make sure the original pidfd is used instead of the
new one which is opened when deserializing the first pid field.
For other control units, older versions with pidfd support will discard
the first pidfd and replace it with a new pidfd from the second pid field.
This is a slight regression on downgrades, but we make sure it doesn't
happen for future versions (and older versions when this commit is
backported) by modifying the logic to only use the first successfully
deserialized pidref so that the raw pid without pidfd is discarded instead
of it replacing the existing pidfd.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Follow-up for ba31a5018f99864c22dd4e0f10712456c7abc934
Another stupid mistake... Shouldn't have
written anything when I was tired.
|
|
|
|
| |
Follow-up for e9fa1bf704ad2f0a7e257e29889315118b0df459
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This refactors the Unit structure a bit: all cgroup-related state fields
are moved to a new structure CGroupRuntime, which is only allocated as
we realize a cgroup.
This is both a nice cleanup and should make unit structures considerably
smaller that have no cgroup associated, because never realized or
because they belong to a unit type that doesn#t have cgroups anyway.
This makes things nicely symmetric:
ExecContext → static user configuration about execution
ExecRuntime → dynamic user state of execution
CGroupContext → static user configuration about cgroups
CGroupRuntime → dynamic user state of cgroups
And each time the XyzContext is part of the unit type structures such as
Service or Slice that need it, but the runtime object is only allocated
when a unit is started.
|
| |
|
|
|
|
| |
No functional change, just refactoring.
|
|
|
|
| |
No functional changes. Just refactoring.
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's hard to oversee the assigned processing priorities of the various
event sources we have. Let's unify them in a table (an enum), where we
can have a single consisten look at them, and then reference the table
entries by expressive symbols.
This doesn#t change behaviour in any way, it just gives each priority a
nice label, but doesn't change any of the priorities.
Prompted by: #30799
|
|
|
|
|
|
|
|
| |
This is the equivalent of RequiresMountsFor=, but adds Wants= instead
of Requires=. It will be useful for example for the autogenerated
systemd-cryptsetup units.
Fixes https://github.com/systemd/systemd/issues/11646
|
| |
|
| |
|
| |
|
|
|
|
|
| |
When switching to serialization later, the Unit object will not be
serialized, move parameters around instead
|
|
|
|
|
| |
When switching to serialization later, the Manager object will not be
serialized, move parameters around instead
|
|
|
|
| |
One major step towards total pidfdification of systemd.
|
|
|
|
|
|
|
|
|
|
|
| |
This makes sure unit_watch_pid() and unit_unwatch_pid() will track
processes by pidfd if supported. Also ports over some related code.
Should not really change behaviour.
Note that this does *not* add support waiting for POLLIN on the pidfds
as additional exit notification. This is left for a later commit (this
commit is already large enough), in particular as that would add new
logic and not just convert existing logic.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| | |
core: introduce UnitDefaults structure for unit defaults
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
| |
This is supposed to be a help for compilers to apply optimizations on
functions where they can't determine whether they are const/pure on
their own. For static, local functions the compiler can do this on its
own easily however, hence the decoration with pure/const is just noise.
Let's drop it, and let the compiler to its thing better.
(Use it for exported functions, since compilers can't 'reach-over' into
other modules to determine if they are pure, except if LTO is used)
|
|\
| |
| | |
Restore ordering between vconsole-setup and firstboot services
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit e019ea738d63d5f7803f378f8bd3e074d66be08f.
In the new approach, a lock on /dev/console will be used. This lock will solve
the issue for services which run in early boot. Services which run later are
ordered after sysinit.target, so they'll run much later anyway so this
automatic dependency is not useful. Let's remove it again to make the code
simpler.
|
|/ |
|
| |
|
|
|
|
|
|
| |
This essentially reverts 2ad2e41a72ec19159c0746a78e15ff880fe32a63.
No longer needed after dropping UNIT_NOTIFY_WILL_AUTO_RESTART.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal of this change is to delay getty services until after
systemd-vconsole-setup has finished. systemd-vconsole-setup starts loadkeys,
and it seems that when loadkeys is interrupted by the TTY hangup call we do
when starting tty services [1], so that loadkeys starts getting EIO from the
ioctl("/dev/tty1", KDSKBENT) syscall it does.
Fixes #26908.
[1] https://github.com/legionus/kbd/issues/92#issuecomment-1554451788
Initially I wanted to add ordering dependencies to individual units, but
TTYVHangup= can be added to other various external units too. The solution with
an implicit dependency should cover those cases too.
|
|
|
|
|
| |
This is just another piece of runtime data so let's store it in
ExecRuntime alongside the other runtime data.
|
|
|
|
|
|
|
|
| |
Currently, exec runtimes can be shared between units (using
JoinsNamespaceOf=). Let's introduce a concept of a private exec
runtime that isn't shared with JoinsNamespaceOf=. The existing
ExecRuntime struct is renamed to ExecRuntimeShared and becomes a
private member of the new private ExecRuntime.
|
|
|
|
|
| |
Let's mimick what we do for DynamicUser and have two separate functions
for unreffing and destroying a ExecSharedRuntime object.
|
|
|
|
| |
Preparation for next commit
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
processes
This augments the existing KillUnit() + Kill() methods with
QueueSignalUnit() + QueueSignal(), which are what sigqueue() is to
kill().
This is useful for sending our new SIGRTMIN+18 control signals to system
services.
|