From 10a94420172b33a7472a16b2e829689dbc570cad Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 13 Apr 2010 20:59:01 +0200 Subject: systemctl: show sub state along active state --- dbus-unit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'dbus-unit.c') diff --git a/dbus-unit.c b/dbus-unit.c index de5236a64e..7897b857b6 100644 --- a/dbus-unit.c +++ b/dbus-unit.c @@ -49,6 +49,7 @@ static const char introspection[] = " " " " " " + " " " " " " " " @@ -113,6 +114,23 @@ static int bus_unit_append_active_state(Manager *m, DBusMessageIter *i, const ch return 0; } +static int bus_unit_append_sub_state(Manager *m, DBusMessageIter *i, const char *property, void *data) { + Unit *u = data; + const char *state; + + assert(m); + assert(i); + assert(property); + assert(u); + + state = unit_sub_state_to_string(u); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &state)) + return -ENOMEM; + + return 0; +} + static int bus_unit_append_can_reload(Manager *m, DBusMessageIter *i, const char *property, void *data) { Unit *u = data; dbus_bool_t b; @@ -202,6 +220,7 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusMessage *message { "org.freedesktop.systemd1.Unit", "Description", bus_unit_append_description, "s", u }, { "org.freedesktop.systemd1.Unit", "LoadState", bus_unit_append_load_state, "s", &u->meta.load_state }, { "org.freedesktop.systemd1.Unit", "ActiveState", bus_unit_append_active_state, "s", u }, + { "org.freedesktop.systemd1.Unit", "SubState", bus_unit_append_sub_state, "s", u }, { "org.freedesktop.systemd1.Unit", "FragmentPath", bus_property_append_string, "s", u->meta.fragment_path }, { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestamp", bus_property_append_uint64, "t", &u->meta.active_enter_timestamp }, { "org.freedesktop.systemd1.Unit", "ActiveExitTimestamp", bus_property_append_uint64, "t", &u->meta.active_exit_timestamp }, -- cgit v1.2.3-54-g00ecf