X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmanager.c;h=54df7ebe5f94a2bfdc83f5e260a28e8978100e34;hb=731a676c206bb1b48e7f736ce9f5b730252d1601;hp=9957bbf12ac56d26b1a64315f4a739c1600e041e;hpb=dc1ecd78e9f046880d10ddb45cf9b06df1084b10;p=elogind.git diff --git a/src/manager.c b/src/manager.c index 9957bbf12..54df7ebe5 100644 --- a/src/manager.c +++ b/src/manager.c @@ -41,6 +41,8 @@ #include #endif +#include + #include "manager.h" #include "hashmap.h" #include "macro.h" @@ -58,7 +60,6 @@ #include "special.h" #include "bus-errors.h" #include "exit-status.h" -#include "sd-daemon.h" #include "virt.h" /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ @@ -1609,7 +1610,9 @@ static int transaction_add_job_and_dependencies( dbus_error_free(e); } - } else if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) { + } + + if (type == JOB_STOP || type == JOB_RESTART || type == JOB_TRY_RESTART) { SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_REQUIRED_BY], i) if ((r = transaction_add_job_and_dependencies(m, type, dep, ret, true, override, false, false, ignore_order, e, NULL)) < 0) { @@ -1632,6 +1635,20 @@ static int transaction_add_job_and_dependencies( } } + if (type == JOB_RELOAD || type == JOB_RELOAD_OR_START) { + + SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_PROPAGATE_RELOAD_TO], i) { + r = transaction_add_job_and_dependencies(m, JOB_RELOAD, dep, ret, false, override, false, false, ignore_order, e, NULL); + + if (r < 0) { + log_warning("Cannot add dependency reload job for unit %s, ignoring: %s", dep->meta.id, bus_error(e, r)); + + if (e) + dbus_error_free(e); + } + } + } + /* JOB_VERIFY_STARTED, JOB_RELOAD require no dependency handling */ } @@ -3112,36 +3129,20 @@ void manager_recheck_syslog(Manager *m) { if (m->running_as != MANAGER_SYSTEM) return; - if ((u = manager_get_unit(m, SPECIAL_SYSLOG_SOCKET))) { - SocketState state; - - state = SOCKET(u)->state; - - if (state != SOCKET_DEAD && - state != SOCKET_FAILED && - state != SOCKET_RUNNING) { - - /* Hmm, the socket is not set up, or is still - * listening, let's better not try to use - * it. Note that we have no problem if the - * socket is completely down, since there - * might be a foreign /dev/log socket around - * and we want to make use of that. - */ - - log_close_syslog(); - return; - } + u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET); + if (u && SOCKET(u)->state != SOCKET_RUNNING) { + log_close_syslog(); + return; } - if ((u = manager_get_unit(m, SPECIAL_SYSLOG_TARGET))) - if (TARGET(u)->state != TARGET_ACTIVE) { - log_close_syslog(); - return; - } + u = manager_get_unit(m, SPECIAL_JOURNALD_SERVICE); + if (u && SERVICE(u)->state != SERVICE_RUNNING) { + log_close_syslog(); + return; + } - /* Hmm, OK, so the socket is either fully up, or fully down, - * and the target is up, then let's make use of the socket */ + /* Hmm, OK, so the socket is fully up and the service is up + * too, then let's make use of the thing. */ log_open(); }