]> err.no Git - systemd/commitdiff
dbus: export number of total failed jobs on D-Bus interface
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Sep 2010 13:38:42 +0000 (15:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Sep 2010 13:38:42 +0000 (15:38 +0200)
src/dbus-manager.c
src/job.c
src/manager.h

index eeea821e454c203f0d899f510ff11aa9ce87f7e6..efff06a18e574ecc1cfb5de5a32556fd28b98990 100644 (file)
         "  <property name=\"NNames\" type=\"u\" access=\"read\"/>\n"    \
         "  <property name=\"NJobs\" type=\"u\" access=\"read\"/>\n"     \
         "  <property name=\"NInstalledJobs\" type=\"u\" access=\"read\"/>\n" \
+        "  <property name=\"NFailedJobs\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"Progress\" type=\"d\" access=\"read\"/>\n"  \
         "  <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"ConfirmSpawn\" type=\"b\" access=\"read\"/>\n" \
@@ -267,6 +268,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 { "org.freedesktop.systemd1.Manager", "NNames",        bus_manager_append_n_names,    "u",  NULL               },
                 { "org.freedesktop.systemd1.Manager", "NJobs",         bus_manager_append_n_jobs,     "u",  NULL               },
                 { "org.freedesktop.systemd1.Manager", "NInstalledJobs",bus_property_append_uint32,    "u",  &m->n_installed_jobs },
+                { "org.freedesktop.systemd1.Manager", "NFailedJobs",   bus_property_append_uint32,    "u",  &m->n_failed_jobs  },
                 { "org.freedesktop.systemd1.Manager", "Progress",      bus_manager_append_progress,   "d",  NULL               },
                 { "org.freedesktop.systemd1.Manager", "Environment",   bus_property_append_strv,      "as", m->environment     },
                 { "org.freedesktop.systemd1.Manager", "ConfirmSpawn",  bus_property_append_bool,      "b",  &m->confirm_spawn  },
index ac3bb9d72962c53655c3b671ea828b1febe7a49f..c219b0d18ba926fb5c1871a3871306c0e7af3f2c 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -478,9 +478,13 @@ int job_finish_and_invalidate(Job *j, bool success) {
                 return 0;
         }
 
+        j->failed = !success;
+
         log_debug("Job %s/%s finished, success=%s", j->unit->meta.id, job_type_to_string(j->type), yes_no(success));
 
-        j->failed = !success;
+        if (j->failed)
+                j->manager->n_failed_jobs ++;
+
         u = j->unit;
         t = j->type;
         job_free(j);
index c404443f52caebee0b227c6bd01f030f58f8188c..df87ed6b62d8eac7b9b8e2fa62902f0db7bea676 100644 (file)
@@ -210,6 +210,7 @@ struct Manager {
         int n_deserializing;
 
         unsigned n_installed_jobs;
+        unsigned n_failed_jobs;
 };
 
 int manager_new(ManagerRunningAs running_as, Manager **m);