From 76bf48b7d09b6e22d1952ac2fa07fec8ee501b76 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 23 Sep 2010 15:38:42 +0200 Subject: dbus: export number of total failed jobs on D-Bus interface --- src/dbus-manager.c | 2 ++ src/job.c | 6 +++++- src/manager.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dbus-manager.c b/src/dbus-manager.c index eeea821e45..efff06a18e 100644 --- a/src/dbus-manager.c +++ b/src/dbus-manager.c @@ -133,6 +133,7 @@ " \n" \ " \n" \ " \n" \ + " \n" \ " \n" \ " \n" \ " \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 }, diff --git a/src/job.c b/src/job.c index ac3bb9d729..c219b0d18b 100644 --- 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); diff --git a/src/manager.h b/src/manager.h index c404443f52..df87ed6b62 100644 --- a/src/manager.h +++ b/src/manager.h @@ -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); -- cgit v1.2.3-54-g00ecf