summaryrefslogtreecommitdiff
path: root/src/core/service.c
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@suse.com>2012-03-21 18:03:40 +0100
committerLennart Poettering <lennart@poettering.net>2012-05-21 21:13:27 +0200
commitc93ff2e913a6da516c83c0d3f8df73004acc6c8b (patch)
treefa28e761da28c82391792ec243f4b55d62219fc0 /src/core/service.c
parent401cc72da8e59a1e49acafee69280f7ebaa52e74 (diff)
main: allow system wide limits for services
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 28049a33c7..2bd29ff7e6 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -110,6 +110,7 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
static void service_init(Unit *u) {
Service *s = SERVICE(u);
+ int i;
assert(u);
assert(u->load_state == UNIT_STUB);
@@ -129,6 +130,9 @@ static void service_init(Unit *u) {
s->guess_main_pid = true;
exec_context_init(&s->exec_context);
+ for (i = 0; i < RLIMIT_NLIMITS; i++)
+ if (UNIT(s)->manager->rlimit[i])
+ s->exec_context.rlimit[i] = newdup(struct rlimit, UNIT(s)->manager->rlimit[i], 1);
RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5);