diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-07-10 23:39:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-07-10 23:41:04 +0200 |
commit | 7fb3ee51c1b37738fd0ea2c81dfd6c336144698a (patch) | |
tree | 1a0def1b9d80726c7c12d2154446b48cb25c3fca /src/core/dbus-unit.c | |
parent | f2d4f98d5873e0649b79b04b967fc9625ab3a350 (diff) |
user-sessions: rely on PID 1 to kill sessions
As we want to centralized cgroup access we should stop killing the user
sessions directly from the systemd-user-sessions service. Instead, rely
on PID 1 doing this by adding the right ordering dependencies to the
session scope units.
Diffstat (limited to 'src/core/dbus-unit.c')
-rw-r--r-- | src/core/dbus-unit.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index e07a28e32d..57fac00d19 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -844,6 +844,63 @@ static int bus_unit_set_transient_property( unit_write_drop_in(u, mode, "Slice", contents); } return 1; + + } else if (streq(name, "Requires") || + streq(name, "RequiresOverridable") || + streq(name, "Requisite") || + streq(name, "RequisiteOverridable") || + streq(name, "Wants") || + streq(name, "BindsTo") || + streq(name, "Conflicts") || + streq(name, "Before") || + streq(name, "After") || + streq(name, "OnFailure") || + streq(name, "PropagatesReloadTo") || + streq(name, "ReloadPropagatedFrom") || + streq(name, "PartOf")) { + + UnitDependency d; + DBusMessageIter sub; + + d = unit_dependency_from_string(name); + if (d < 0) + return -EINVAL; + + if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_ARRAY || + dbus_message_iter_get_element_type(i) != DBUS_TYPE_STRING) + return -EINVAL; + + dbus_message_iter_recurse(i, &sub); + while (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { + const char *other; + + dbus_message_iter_get_basic(&sub, &other); + + if (!unit_name_is_valid(other, false)) + return -EINVAL; + + if (mode != UNIT_CHECK) { + _cleanup_free_ char *label = NULL, *contents = NULL; + + r = unit_add_dependency_by_name(u, d, other, NULL, true); + if (r < 0) + return r; + + label = strjoin(name, "-", other, NULL); + if (!label) + return -ENOMEM; + + contents = strjoin("[Unit]\n", name, "=", other, "\n", NULL); + if (!contents) + return -ENOMEM; + + unit_write_drop_in(u, mode, label, contents); + } + + dbus_message_iter_next(&sub); + } + + return 1; } return 0; |