X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fdbus-unit.c;h=8a7ab349d13c5445e5e0a75a410682e946d351db;hb=9444b1f20e311f073864d81e913bd4f32fe95cfd;hp=f4133865538fdc8429a65a58d12faef25a5ad07f;hpb=ae7a7182da31371555fceb2aed609e40a64b900a;p=elogind.git diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index f41338655..8a7ab349d 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -81,6 +81,22 @@ static int bus_unit_append_following(DBusMessageIter *i, const char *property, v return 0; } +static int bus_unit_append_slice(DBusMessageIter *i, const char *property, void *data) { + Unit *u = data; + const char *d; + + assert(i); + assert(property); + assert(u); + + d = strempty(unit_slice_name(u)); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &d)) + return -ENOMEM; + + return 0; +} + static int bus_unit_append_dependencies(DBusMessageIter *i, const char *property, void *data) { Unit *u; Iterator j; @@ -314,7 +330,7 @@ static int bus_unit_append_cgroups(DBusMessageIter *i, const char *property, voi return -ENOMEM; LIST_FOREACH(by_unit, cgb, u->cgroup_bondings) { - char _cleanup_free_ *t = NULL; + _cleanup_free_ char *t = NULL; bool success; t = cgroup_bonding_to_string(cgb); @@ -341,7 +357,7 @@ static int bus_unit_append_cgroup_attrs(DBusMessageIter *i, const char *property return -ENOMEM; LIST_FOREACH(by_unit, a, u->cgroup_attributes) { - char _cleanup_free_ *v = NULL; + _cleanup_free_ char *v = NULL; bool success; if (a->semantics && a->semantics->map_write) @@ -1034,7 +1050,7 @@ int bus_unit_cgroup_unset(Unit *u, DBusMessageIter *iter) { unit_remove_drop_in(u, runtime, controller); /* Try to migrate the old group away */ - if (cg_get_by_pid(controller, 0, &target) >= 0) + if (cg_pid_get_path(controller, 0, &target) >= 0) cgroup_bonding_migrate_to(u->cgroup_bondings, target, false); cgroup_bonding_free(b, true); @@ -1255,6 +1271,7 @@ const BusProperty bus_unit_properties[] = { { "Id", bus_property_append_string, "s", offsetof(Unit, id), true }, { "Names", bus_unit_append_names, "as", 0 }, { "Following", bus_unit_append_following, "s", 0 }, + { "Slice", bus_unit_append_slice, "s", 0 }, { "Requires", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES]), true }, { "RequiresOverridable", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUIRES_OVERRIDABLE]), true }, { "Requisite", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_REQUISITE]), true }, @@ -1284,7 +1301,7 @@ const BusProperty bus_unit_properties[] = { { "SubState", bus_unit_append_sub_state, "s", 0 }, { "FragmentPath", bus_property_append_string, "s", offsetof(Unit, fragment_path), true }, { "SourcePath", bus_property_append_string, "s", offsetof(Unit, source_path), true }, - { "DropinPaths", bus_property_append_strv, "as", offsetof(Unit, dropin_paths), true }, + { "DropInPaths", bus_property_append_strv, "as", offsetof(Unit, dropin_paths), true }, { "UnitFileState", bus_unit_append_file_state, "s", 0 }, { "InactiveExitTimestamp",bus_property_append_usec, "t", offsetof(Unit, inactive_exit_timestamp.realtime) }, { "InactiveExitTimestampMonotonic", bus_property_append_usec, "t", offsetof(Unit, inactive_exit_timestamp.monotonic) },