diff options
author | Benjamin Berg <bberg@redhat.com> | 2020-07-28 19:12:56 +0200 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2020-10-23 09:58:41 +0200 |
commit | 7f3b86a4979bb84566b46006f3e04c1033504585 (patch) | |
tree | 4732181f6572cceeb13543486003961b111b5747 | |
parent | basic: Define macros for special user slices (diff) | |
download | systemd-7f3b86a4979bb84566b46006f3e04c1033504585.tar.xz systemd-7f3b86a4979bb84566b46006f3e04c1033504585.zip |
core: Move user units into app.slice by default
This changes the default from putting all units into the root slice to
placing them into the app slice in the user manager. The advantage is
that we get the right behaviour in most cases, and we'll need special
case handling in all other cases anyway.
Note that we have currently defined that applications *should* start
their unit names with app-, so we could also move only these by creating
a drop-in for app-.scope and app-.service.
However, that would not answer the question on how we should manage
session.slice. And we would end up placing anything that does not fit
the system (e.g. anything started by dbus-broker currently) into the
root slice.
-rw-r--r-- | src/core/unit.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 680f4c569bd..40578cb3fa5 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3345,12 +3345,16 @@ int unit_set_default_slice(Unit *u) { if (MANAGER_IS_SYSTEM(u->manager)) slice_name = strjoina("system-", escaped, ".slice"); else - slice_name = strjoina(escaped, ".slice"); - } else - slice_name = - MANAGER_IS_SYSTEM(u->manager) && !unit_has_name(u, SPECIAL_INIT_SCOPE) - ? SPECIAL_SYSTEM_SLICE - : SPECIAL_ROOT_SLICE; + slice_name = strjoina("app-", escaped, ".slice"); + } else { + if (MANAGER_IS_SYSTEM(u->manager)) + slice_name = + unit_has_name(u, SPECIAL_INIT_SCOPE) + ? SPECIAL_ROOT_SLICE + : SPECIAL_SYSTEM_SLICE; + else + slice_name = SPECIAL_APP_SLICE; + } r = manager_load_unit(u->manager, slice_name, NULL, NULL, &slice); if (r < 0) |