summaryrefslogtreecommitdiff
path: root/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-15 06:19:54 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-15 06:20:00 +0200
commit4f2d528d3bb25cebf8d3ebe83d8193ab4016cb90 (patch)
tree96336ea5c252c903ab4666d49714ececf949dfdf /unit.c
parent9e2f7c11fb6ba35ffec2274da3e2d08b10d23965 (diff)
socket: optionally call accept() for incoming connections and spawn one service instance per connection
Diffstat (limited to 'unit.c')
-rw-r--r--unit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/unit.c b/unit.c
index 7f147537e3..872abf3e13 100644
--- a/unit.c
+++ b/unit.c
@@ -1339,13 +1339,22 @@ int unit_add_cgroup(Unit *u, CGroupBonding *b) {
static char *default_cgroup_path(Unit *u) {
char *p;
+ int r;
assert(u);
- if (asprintf(&p, "%s/%s", u->meta.manager->cgroup_hierarchy, u->meta.id) < 0)
- return NULL;
+ if (u->meta.instance) {
+ char *t;
- return p;
+ if (!(t = unit_name_template(u->meta.id)))
+ return NULL;
+
+ r = asprintf(&p, "%s/%s/%s", u->meta.manager->cgroup_hierarchy, t, u->meta.instance);
+ free(t);
+ } else
+ r = asprintf(&p, "%s/%s", u->meta.manager->cgroup_hierarchy, u->meta.id);
+
+ return r < 0 ? NULL : p;
}
int unit_add_cgroup_from_text(Unit *u, const char *name) {