[systemd-commits] 3 commits - src/core src/shared

Michal Schmidt michich at kemper.freedesktop.org
Sat Mar 2 09:02:22 PST 2013


 src/core/job.c     |    4 ++--
 src/core/manager.c |    5 +++--
 src/core/unit.c    |    6 +++---
 src/shared/util.h  |    1 +
 4 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 076a24adf4bfbb9c5aa8167e102c253c7e1c651e
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sat Mar 2 13:16:27 2013 +0100

    job: print the "OK" status messages in normal green
    
    The "OK" status messages should not draw attention to themselves.
    It's better if they're not printed in bright/bold. Leave that
    to errors and warnings.
    
    Use a plain inconspicuous enterprisey green.

diff --git a/src/core/job.c b/src/core/job.c
index 90de550..d5b7987 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -644,7 +644,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
 
                 case JOB_DONE:
                         if (u->condition_result)
-                                unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format);
+                                unit_status_printf(u, ANSI_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format);
                         break;
 
                 case JOB_FAILED:
@@ -678,7 +678,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
 
                 case JOB_DONE:
                 case JOB_FAILED:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format);
+                        unit_status_printf(u, ANSI_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, format);
                         break;
 
                 default:
diff --git a/src/shared/util.h b/src/shared/util.h
index b5ad1ff..27b21f9 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -57,6 +57,7 @@ union dirent_storage {
 #define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
 #define ANSI_RED_ON "\x1B[31m"
 #define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
+#define ANSI_GREEN_ON "\x1B[32m"
 #define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
 #define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
 #define ANSI_HIGHLIGHT_OFF "\x1B[0m"

commit e970a72e94413d9011d510c97eadfdc85c96ccc0
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sat Mar 2 12:44:41 2013 +0100

    manager: turn a superfluous check into assert
    
    The crash that the check prevented has been fixed by commit 9e9e2b7.

diff --git a/src/core/manager.c b/src/core/manager.c
index d976581..91d773c 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -269,8 +269,9 @@ static void manager_print_jobs_in_progress(Manager *m) {
                 if (j->state == JOB_RUNNING && counter++ == print_nr)
                         break;
 
-	if (!j)
-		return;
+        /* m->n_running_jobs must be consistent with the contents of m->jobs,
+         * so the above loop must have succeeded in finding j. */
+        assert(counter == print_nr + 1);
 
         cylon_pos = m->jobs_in_progress_iteration % 14;
         if (cylon_pos >= 8)

commit 6b19ad24d3b6ade48d9e3d29e5348fc6b8d7c811
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Sat Mar 2 12:29:04 2013 +0100

    unit: count deserialized job only after it's definitely installed
    
    Installation of a deserialized job may fail (though purely in theory),
    so increase the running job counter only when succeeding.

diff --git a/src/core/unit.c b/src/core/unit.c
index 2f0ac00..a6cc3b6 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2441,15 +2441,15 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
                                         return r;
                                 }
 
-                                if (j->state == JOB_RUNNING)
-                                        u->manager->n_running_jobs++;
-
                                 r = job_install_deserialized(j);
                                 if (r < 0) {
                                         hashmap_remove(u->manager->jobs, UINT32_TO_PTR(j->id));
                                         job_free(j);
                                         return r;
                                 }
+
+                                if (j->state == JOB_RUNNING)
+                                        u->manager->n_running_jobs++;
                         } else {
                                 /* legacy */
                                 JobType type = job_type_from_string(v);



More information about the systemd-commits mailing list