diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-19 20:40:05 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-19 21:06:53 +0100 |
commit | 598459cebac7cc93089769a992e7b03287f77e12 (patch) | |
tree | ab690b534e7578ce1d9421d5127224a43fd5fded /src/core/scope.c | |
parent | ae439c9f9b8a9cbb320d66290e3f9ad0e2f37378 (diff) |
core: rework context initialization/destruction logic
Let's automatically initialize the kill, exec and cgroup contexts of the
various unit types when the object is constructed, instead of
invididually in type-specific code.
Also, when PrivateDevices= is set, set DevicePolicy= to closed.
Diffstat (limited to 'src/core/scope.c')
-rw-r--r-- | src/core/scope.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/scope.c b/src/core/scope.c index be2a637023..aa4978de4c 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -51,11 +51,6 @@ static void scope_init(Unit *u) { s->timeout_stop_usec = u->manager->default_timeout_stop_usec; - cgroup_context_init(&s->cgroup_context); - kill_context_init(&s->kill_context); - - unit_cgroup_context_init_defaults(u, &s->cgroup_context); - UNIT(s)->ignore_on_isolate = true; UNIT(s)->ignore_on_snapshot = true; } @@ -65,8 +60,6 @@ static void scope_done(Unit *u) { assert(u); - cgroup_context_done(&s->cgroup_context); - free(s->controller); s->timer_event_source = sd_event_source_unref(s->timer_event_source); @@ -158,7 +151,11 @@ static int scope_load(Unit *u) { if (r < 0) return r; - r = unit_add_default_slice(u); + r = unit_patch_contexts(u); + if (r < 0) + return r; + + r = unit_add_default_slice(u, &s->cgroup_context); if (r < 0) return r; |