summaryrefslogtreecommitdiff
path: root/src/core/manager.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/manager.c
parent401cc72da8e59a1e49acafee69280f7ebaa52e74 (diff)
main: allow system wide limits for services
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 3ccb392f66..30437425c4 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -476,6 +476,7 @@ static void manager_clear_jobs_and_units(Manager *m) {
void manager_free(Manager *m) {
UnitType c;
+ int i;
assert(m);
@@ -525,6 +526,9 @@ void manager_free(Manager *m) {
free(m->switch_root);
free(m->switch_root_init);
+ for (i = 0; i < RLIMIT_NLIMITS; i++)
+ free(m->rlimit[i]);
+
free(m);
}
@@ -2136,6 +2140,24 @@ int manager_set_default_controllers(Manager *m, char **controllers) {
return 0;
}
+int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit) {
+ int i;
+
+ assert(m);
+
+ for (i = 0; i < RLIMIT_NLIMITS; i++) {
+ if (default_rlimit[i]) {
+ m->rlimit[i] = newdup(struct rlimit, default_rlimit[i], 1);
+
+ if (!m->rlimit[i])
+ return -ENOMEM;
+ }
+ }
+
+ return 0;
+}
+
+
void manager_recheck_journal(Manager *m) {
Unit *u;