X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fjob.c;h=1411603e0b6d51fa6bd8402ee7b9b817ac2bbe4e;hb=7e803f5ecf689216d6fcd8a1d19a442f234bf28b;hp=ef5dbce1a336af9464db91c34d77de8d39c5895a;hpb=8e07fc41f86d41e68c5663b2a3c620a0adedcc11;p=elogind.git diff --git a/src/core/job.c b/src/core/job.c index ef5dbce1a..1411603e0 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -352,6 +352,9 @@ bool job_type_is_redundant(JobType a, UnitActiveState b) { return b == UNIT_ACTIVATING; + case JOB_NOP: + return true; + default: assert_not_reached("Invalid job type"); } @@ -542,6 +545,8 @@ int job_run_and_invalidate(Job *j) { r = job_finish_and_invalidate(j, JOB_SKIPPED, true); else if (r == -ENOEXEC) r = job_finish_and_invalidate(j, JOB_INVALID, true); + else if (r == -EPROTO) + r = job_finish_and_invalidate(j, JOB_ASSERT, true); else if (r == -EAGAIN) { j->state = JOB_WAITING; m->n_running_jobs--; @@ -639,7 +644,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { manager_flip_auto_status(u->manager, true); unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format); - manager_status_printf(u->manager, false, NULL, + manager_status_printf(u->manager, STATUS_TYPE_NORMAL, NULL, "See \"systemctl status %s%s%s\" for details.", quotes ? "'" : "", u->id, quotes ? "'" : ""); break; @@ -655,6 +660,11 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format); break; + case JOB_ASSERT: + manager_flip_auto_status(u->manager, true); + unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "ASSERT" ANSI_HIGHLIGHT_OFF, format); + break; + default: ; } @@ -858,14 +868,18 @@ finish: static int job_dispatch_timer(sd_event_source *s, uint64_t monotonic, void *userdata) { Job *j = userdata; + Unit *u; assert(j); assert(s == j->timer_event_source); - log_warning_unit(j->unit->id, "Job %s/%s timed out.", - j->unit->id, job_type_to_string(j->type)); + log_warning_unit(j->unit->id, "Job %s/%s timed out.", j->unit->id, job_type_to_string(j->type)); + u = j->unit; job_finish_and_invalidate(j, JOB_TIMEOUT, true); + + failure_action(u->manager, u->job_timeout_action, u->job_timeout_reboot_arg); + return 0; } @@ -1185,6 +1199,7 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = { [JOB_DEPENDENCY] = "dependency", [JOB_SKIPPED] = "skipped", [JOB_INVALID] = "invalid", + [JOB_ASSERT] = "assert", }; DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);