chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
job: allow job_free() only on already unlinked jobs
[elogind.git]
/
src
/
core
/
manager.c
diff --git
a/src/core/manager.c
b/src/core/manager.c
index c8ac29be5b00e24cc49cf878c240d13b6c1bb432..aa918f1bd0d0d1cde30c4a69da2358af01564aab 100644
(file)
--- a/
src/core/manager.c
+++ b/
src/core/manager.c
@@
-63,6
+63,7
@@
#include "exit-status.h"
#include "virt.h"
#include "watchdog.h"
#include "exit-status.h"
#include "virt.h"
#include "watchdog.h"
+#include "cgroup-util.h"
/* As soon as 16 units are in our GC queue, make sure to run a gc sweep */
#define GC_QUEUE_ENTRIES_MAX 16
/* As soon as 16 units are in our GC queue, make sure to run a gc sweep */
#define GC_QUEUE_ENTRIES_MAX 16
@@
-661,13
+662,15
@@
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
return r;
}
return r;
}
+static void transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies);
+
static void transaction_delete_job(Manager *m, Job *j, bool delete_dependencies) {
assert(m);
assert(j);
/* Deletes one job from the transaction */
static void transaction_delete_job(Manager *m, Job *j, bool delete_dependencies) {
assert(m);
assert(j);
/* Deletes one job from the transaction */
-
manager_
transaction_unlink_job(m, j, delete_dependencies);
+ transaction_unlink_job(m, j, delete_dependencies);
if (!j->installed)
job_free(j);
if (!j->installed)
job_free(j);
@@
-709,8
+712,10
@@
static void transaction_abort(Manager *m) {
while ((j = hashmap_first(m->transaction_jobs)))
if (j->installed)
transaction_delete_job(m, j, true);
while ((j = hashmap_first(m->transaction_jobs)))
if (j->installed)
transaction_delete_job(m, j, true);
- else
+ else {
+ transaction_unlink_job(m, j, true);
job_free(j);
job_free(j);
+ }
assert(hashmap_isempty(m->transaction_jobs));
assert(hashmap_isempty(m->transaction_jobs));
@@
-757,7
+762,7
@@
static void transaction_merge_and_delete_job(Manager *m, Job *j, Job *other, Job
assert(j->unit == other->unit);
assert(!j->installed);
assert(j->unit == other->unit);
assert(!j->installed);
- /* Merges 'other' into 'j' and then deletes
j
. */
+ /* Merges 'other' into 'j' and then deletes
'other'
. */
j->type = t;
j->state = JOB_WAITING;
j->type = t;
j->state = JOB_WAITING;
@@
-802,6
+807,7
@@
static void transaction_merge_and_delete_job(Manager *m, Job *j, Job *other, Job
other->object_list = NULL;
transaction_delete_job(m, other, true);
}
other->object_list = NULL;
transaction_delete_job(m, other, true);
}
+
static bool job_is_conflicted_by(Job *j) {
JobDependency *l;
static bool job_is_conflicted_by(Job *j) {
JobDependency *l;
@@
-1439,6
+1445,7
@@
static Job* transaction_add_one_job(Manager *m, JobType type, Unit *unit, bool o
LIST_PREPEND(Job, transaction, f, j);
if (hashmap_replace(m->transaction_jobs, unit, f) < 0) {
LIST_PREPEND(Job, transaction, f, j);
if (hashmap_replace(m->transaction_jobs, unit, f) < 0) {
+ LIST_REMOVE(Job, transaction, f, j);
job_free(j);
return NULL;
}
job_free(j);
return NULL;
}
@@
-1451,7
+1458,7
@@
static Job* transaction_add_one_job(Manager *m, JobType type, Unit *unit, bool o
return j;
}
return j;
}
-
void manager_
transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies) {
+
static void
transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies) {
assert(m);
assert(j);
assert(m);
assert(j);
@@
-3165,12
+3172,15
@@
int manager_set_default_controllers(Manager *m, char **controllers) {
assert(m);
assert(m);
- if (!(l = strv_copy(controllers)))
+ l = strv_copy(controllers);
+ if (!l)
return -ENOMEM;
strv_free(m->default_controllers);
m->default_controllers = l;
return -ENOMEM;
strv_free(m->default_controllers);
m->default_controllers = l;
+ cg_shorten_controllers(m->default_controllers);
+
return 0;
}
return 0;
}