chiark / gitweb /
journal: when the same entry is in two files, skip over them in sync
[elogind.git] / src / unit.c
index 5006742d9da83f65922c38694c74e2dc226e93c3..903a8e4da4a4ae6731ad2c7b6d3839fa506448a1 100644 (file)
@@ -573,7 +573,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
          * logging daemon is run first. */
 
         if (u->meta.manager->running_as == MANAGER_SYSTEM)
-                if ((r = unit_add_two_dependencies_by_name(u, UNIT_REQUIRES, UNIT_AFTER, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
+                if ((r = unit_add_two_dependencies_by_name(u, UNIT_REQUIRES, UNIT_AFTER, SPECIAL_STDOUT_SYSLOG_BRIDGE_SOCKET, NULL, true)) < 0)
                         return r;
 
         return 0;
@@ -686,9 +686,17 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                         fprintf(f, "%s\tControlGroup: %s:%s\n",
                                 prefix, b->controller, b->path);
 
-                LIST_FOREACH(by_unit, a, u->meta.cgroup_attributes)
+                LIST_FOREACH(by_unit, a, u->meta.cgroup_attributes) {
+                        char *v = NULL;
+
+                        if (a->map_callback)
+                                a->map_callback(a->controller, a->name, a->value, &v);
+
                         fprintf(f, "%s\tControlGroupAttribute: %s %s \"%s\"\n",
-                                prefix, a->controller, a->name, a->value);
+                                prefix, a->controller, a->name, v ? v : a->value);
+
+                        free(v);
+                }
 
                 if (UNIT_VTABLE(u)->dump)
                         UNIT_VTABLE(u)->dump(u, f, prefix2);
@@ -766,7 +774,7 @@ int unit_add_default_target_dependency(Unit *u, Unit *target) {
         /* If either side wants no automatic dependencies, then let's
          * skip this */
         if (!u->meta.default_dependencies ||
-            target->meta.default_dependencies)
+            !target->meta.default_dependencies)
                 return 0;
 
         /* Don't create loops */
@@ -880,16 +888,20 @@ int unit_start(Unit *u) {
         if (u->meta.load_state != UNIT_LOADED)
                 return -EINVAL;
 
-        /* If this is already (being) started, then this will
-         * succeed. Note that this will even succeed if this unit is
-         * not startable by the user. This is relied on to detect when
-         * we need to wait for units and when waiting is finished. */
+        /* If this is already started, then this will succeed. Note
+         * that this will even succeed if this unit is not startable
+         * by the user. This is relied on to detect when we need to
+         * wait for units and when waiting is finished. */
         state = unit_active_state(u);
         if (UNIT_IS_ACTIVE_OR_RELOADING(state))
                 return -EALREADY;
 
-        /* If the conditions failed, don't do anything at all */
-        if (!unit_condition_test(u)) {
+        /* If the conditions failed, don't do anything at all. If we
+         * already are activating this call might still be useful to
+         * speed up activation in case there is some hold-off time,
+         * but we don't want to recheck the condition in that case. */
+        if (state != UNIT_ACTIVATING &&
+            !unit_condition_test(u)) {
                 log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
                 return -EALREADY;
         }
@@ -2423,13 +2435,7 @@ void unit_status_printf(Unit *u, const char *format, ...) {
         if (!UNIT_VTABLE(u)->show_status)
                 return;
 
-        if (u->meta.manager->running_as != MANAGER_SYSTEM)
-                return;
-
-        /* If Plymouth is running make sure we show the status, so
-         * that there's something nice to see when people press Esc */
-
-        if (!u->meta.manager->show_status && !plymouth_running())
+        if (!manager_get_show_status(u->meta.manager))
                 return;
 
         if (!manager_is_booting_or_shutting_down(u->meta.manager))