summaryrefslogtreecommitdiff
path: root/dbus-manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-21 03:27:44 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-21 03:27:44 +0200
commita16e112358ea8fea381ee106b89e645aed8b0a8c (patch)
treef38b204ec041c25974397a7711a105cbe7509c07 /dbus-manager.c
parent0d9068141e07ba29483ebe8bc4aaed6aacde1562 (diff)
reload: implement reload/reexec logic
Diffstat (limited to 'dbus-manager.c')
-rw-r--r--dbus-manager.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/dbus-manager.c b/dbus-manager.c
index 734ed7b886..a8bf7e52c9 100644
--- a/dbus-manager.c
+++ b/dbus-manager.c
@@ -56,6 +56,9 @@
" <arg nane=\"cleanup\" type=\"b\" direction=\"in\"/>" \
" <arg name=\"unit\" type=\"o\" direction=\"out\"/>" \
" </method>" \
+ " <method name=\"Reload\"/>" \
+ " <method name=\"Reexecute\"/>" \
+ " <method name=\"Exit\"/>" \
" <signal name=\"UnitNew\">" \
" <arg name=\"id\" type=\"s\"/>" \
" <arg name=\"unit\" type=\"o\"/>" \
@@ -504,6 +507,37 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection
free(introspection);
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Reload")) {
+
+ assert(!m->queued_message);
+
+ /* Instead of sending the reply back right away, we
+ * just remember that we need to and then send it
+ * after the reload is finished. That way the caller
+ * knows when the reload finished. */
+
+ if (!(m->queued_message = dbus_message_new_method_return(message)))
+ goto oom;
+
+ m->exit_code = MANAGER_RELOAD;
+
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Reexecute")) {
+
+ if (!(reply = dbus_message_new_method_return(message)))
+ goto oom;
+
+ m->exit_code = MANAGER_REEXECUTE;
+
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Exit")) {
+
+ if (m->running_as == MANAGER_INIT)
+ return bus_send_error_reply(m, message, NULL, -ENOTSUP);
+
+ if (!(reply = dbus_message_new_method_return(message)))
+ goto oom;
+
+ m->exit_code = MANAGER_EXIT;
+
} else
return bus_default_message_handler(m, message, NULL, properties);