From 085afe36cb823e7d5b8c5f3ef21ebb9639bac78b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 24 Feb 2014 23:50:10 +0100 Subject: core: add global settings for enabling CPUAccounting=, MemoryAccounting=, BlockIOAccounting= for all units at once --- src/core/unit.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/core/unit.c') diff --git a/src/core/unit.c b/src/core/unit.c index 1bbcb39d32..9d54147adb 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2777,13 +2777,30 @@ void unit_ref_unset(UnitRef *ref) { ref->unit = NULL; } -int unit_exec_context_defaults(Unit *u, ExecContext *c) { +int unit_cgroup_context_init_defaults(Unit *u, CGroupContext *c) { + assert(u); + assert(c); + + /* Copy in the manager defaults into the cgroup context, + * _before_ the rest of the settings have been initialized */ + + c->cpu_accounting = u->manager->default_cpu_accounting; + c->blockio_accounting = u->manager->default_blockio_accounting; + c->memory_accounting = u->manager->default_memory_accounting; + + return 0; +} + +int unit_exec_context_patch_defaults(Unit *u, ExecContext *c) { unsigned i; int r; assert(u); assert(c); + /* Patch in the manager defaults into the exec context, + * _after_ the rest of the settings have been initialized */ + /* This only copies in the ones that need memory */ for (i = 0; i < RLIMIT_NLIMITS; i++) if (u->manager->rlimit[i] && !c->rlimit[i]) { -- cgit v1.2.3-54-g00ecf