summaryrefslogtreecommitdiff
path: root/dbus-unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-13 20:59:01 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-13 20:59:01 +0200
commit10a94420172b33a7472a16b2e829689dbc570cad (patch)
tree5499d906a3d812ab936d16faceaf1741bd6d0c2f /dbus-unit.c
parentc27488016e0e90569260bc513fa95acbad512ff5 (diff)
systemctl: show sub state along active state
Diffstat (limited to 'dbus-unit.c')
-rw-r--r--dbus-unit.c19
1 files changed, 19 insertions, 0 deletions
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[] =
" <property name=\"Description\" type=\"s\" access=\"read\"/>"
" <property name=\"LoadState\" type=\"s\" access=\"read\"/>"
" <property name=\"ActiveState\" type=\"s\" access=\"read\"/>"
+ " <property name=\"SubState\" type=\"s\" access=\"read\"/>"
" <property name=\"FragmentPath\" type=\"s\" access=\"read\"/>"
" <property name=\"ActiveEnterTimestamp\" type=\"t\" access=\"read\"/>"
" <property name=\"ActiveExitTimestamp\" type=\"t\" access=\"read\"/>"
@@ -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 },