X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fdbus-manager.c;h=c717ccd81f49e8332e8551e7d91595ea008abc49;hb=d06428248aa80f72862b86297335ee01c31d918b;hp=5daccb14e811f8f14cb7d224a7e181391824f1ae;hpb=398ef8ba0266cca453d90a90b3a2aa1caa44189f;p=elogind.git diff --git a/src/dbus-manager.c b/src/dbus-manager.c index 5daccb14e..c717ccd81 100644 --- a/src/dbus-manager.c +++ b/src/dbus-manager.c @@ -62,6 +62,16 @@ " \n" \ " \n" \ " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -121,6 +131,7 @@ " \n" \ " \n" \ " \n" \ + " \n" \ " \n" #define INTROSPECTION_BEGIN \ @@ -229,6 +240,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, { "org.freedesktop.systemd1.Manager", "SysVInitPath", bus_property_append_strv, "as", m->lookup_paths.sysvinit_path }, { "org.freedesktop.systemd1.Manager", "SysVRcndPath", bus_property_append_strv, "as", m->lookup_paths.sysvrcnd_path }, { "org.freedesktop.systemd1.Manager", "NotifySocket", bus_property_append_string, "s", m->notify_socket }, + { "org.freedesktop.systemd1.Manager", "ControlGroupHierarchy", bus_property_append_string, "s", m->cgroup_hierarchy }, { NULL, NULL, NULL, NULL, NULL } }; @@ -237,6 +249,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusMessage *reply = NULL; char * path = NULL; JobType job_type = _JOB_TYPE_INVALID; + bool reload_if_possible = false; assert(connection); assert(message); @@ -308,7 +321,13 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, job_type = JOB_RESTART; else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "TryRestartUnit")) job_type = JOB_TRY_RESTART; - else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetJob")) { + else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ReloadOrRestartUnit")) { + reload_if_possible = true; + job_type = JOB_RESTART; + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "ReloadOrTryRestartUnit")) { + reload_if_possible = true; + job_type = JOB_TRY_RESTART; + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetJob")) { uint32_t id; Job *j; @@ -737,6 +756,13 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if ((r = manager_load_unit(m, name, NULL, &error, &u)) < 0) return bus_send_error_reply(m, connection, message, &error, r); + if (reload_if_possible && unit_can_reload(u)) { + if (job_type == JOB_RESTART) + job_type = JOB_RELOAD_OR_START; + else if (job_type == JOB_TRY_RESTART) + job_type = JOB_RELOAD; + } + if (job_type == JOB_START && u->meta.only_by_dependency) { dbus_set_error(&error, BUS_ERROR_ONLY_BY_DEPENDENCY, "Unit may be activated by dependency only."); return bus_send_error_reply(m, connection, message, &error, -EPERM);