summaryrefslogtreecommitdiff
path: root/dbus-manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 17:37:56 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 18:00:22 +0200
commitb152adec93b05c0d01b240e0f28326eb1d8e18e9 (patch)
tree240e8dc421b7a786c9eaddc116709c7f7e595c91 /dbus-manager.c
parent51a1a79d3fbb23cfb4ce07ea218e77efbce94cdd (diff)
dbus: add Dump() D-Bus call
Diffstat (limited to 'dbus-manager.c')
-rw-r--r--dbus-manager.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/dbus-manager.c b/dbus-manager.c
index 7549164829..2323260dbb 100644
--- a/dbus-manager.c
+++ b/dbus-manager.c
@@ -49,6 +49,7 @@
" </method>" \
" <method name=\"Subscribe\"/>" \
" <method name=\"Unsubscribe\"/>" \
+ " <method name=\"Dump\"/>" \
" <signal name=\"UnitNew\">" \
" <arg name=\"id\" type=\"s\"/>" \
" <arg name=\"unit\" type=\"o\"/>" \
@@ -330,6 +331,35 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection
if (!(reply = dbus_message_new_method_return(message)))
goto oom;
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1", "Dump")) {
+ FILE *f;
+ char *dump = NULL;
+ size_t size;
+
+ if (!(reply = dbus_message_new_method_return(message)))
+ goto oom;
+
+ if (!(f = open_memstream(&dump, &size)))
+ goto oom;
+
+ manager_dump_units(m, f, NULL);
+ manager_dump_jobs(m, f, NULL);
+
+ if (ferror(f)) {
+ fclose(f);
+ free(dump);
+ goto oom;
+ }
+
+ fclose(f);
+
+ if (!dbus_message_append_args(reply, DBUS_TYPE_STRING, &dump, DBUS_TYPE_INVALID)) {
+ free(dump);
+ goto oom;
+ }
+
+ free(dump);
+
} else if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
char *introspection = NULL;
FILE *f;