summaryrefslogtreecommitdiff
path: root/src/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-09 22:32:30 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-09 22:32:30 +0200
commit69dd2852bb2c433b517d89792adb4461a4178aa1 (patch)
treef303fd9de62719c117a68c336bac5999ead3a3af /src/job.c
parent6e98720f14dc25ee1d43f951d5c4d79b04ad7506 (diff)
manager: when two pending jobs conflict, keep the one that "conflicts", remove the one that is "conflicted"
This gives the writer of units control which unit is kept and which is stopped when two units conflict.
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/job.c b/src/job.c
index d08bfe9a77..c3b529e920 100644
--- a/src/job.c
+++ b/src/job.c
@@ -93,7 +93,7 @@ void job_free(Job *j) {
free(j);
}
-JobDependency* job_dependency_new(Job *subject, Job *object, bool matters) {
+JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool conflicts) {
JobDependency *l;
assert(object);
@@ -109,6 +109,7 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters) {
l->subject = subject;
l->object = object;
l->matters = matters;
+ l->conflicts = conflicts;
if (subject)
LIST_PREPEND(JobDependency, subject, subject->subject_list, l);
@@ -533,6 +534,14 @@ int job_finish_and_invalidate(Job *j, bool success) {
other->meta.job->type == JOB_VERIFY_ACTIVE ||
other->meta.job->type == JOB_RELOAD_OR_START))
job_finish_and_invalidate(other->meta.job, false);
+
+ SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTED_BY], i)
+ if (!other->meta.ignore_dependency_failure &&
+ other->meta.job &&
+ (other->meta.job->type == JOB_START ||
+ other->meta.job->type == JOB_VERIFY_ACTIVE ||
+ other->meta.job->type == JOB_RELOAD_OR_START))
+ job_finish_and_invalidate(other->meta.job, false);
}
}