diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-15 06:19:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-15 06:20:00 +0200 |
commit | 4f2d528d3bb25cebf8d3ebe83d8193ab4016cb90 (patch) | |
tree | 96336ea5c252c903ab4666d49714ececf949dfdf /unit.c | |
parent | 9e2f7c11fb6ba35ffec2274da3e2d08b10d23965 (diff) |
socket: optionally call accept() for incoming connections and spawn one service instance per connection
Diffstat (limited to 'unit.c')
-rw-r--r-- | unit.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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) { |