From a16e112358ea8fea381ee106b89e645aed8b0a8c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 21 Apr 2010 03:27:44 +0200 Subject: reload: implement reload/reexec logic --- dbus-manager.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'dbus-manager.c') 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 @@ " " \ " " \ " " \ + " " \ + " " \ + " " \ " " \ " " \ " " \ @@ -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); -- cgit v1.2.3-54-g00ecf