From ce55f88a00afe77de21b0608162d92a76b93ae0d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 16 Mar 2021 16:47:08 +0100 Subject: [PATCH] cgroup: add symlinks for traditional split controller world Even systemd have collapsed a few of the cgroup controllers into a semi-unified hierarchy and uses this approach. We just take it to the extreme and have collapsed all of them (like cgroup v2). Signed-off-by: Joachim Wiberg --- src/cgroup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cgroup.c b/src/cgroup.c index 3ec451c6..995fe07a 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include /* get_nprocs_conf() */ #include "finit.h" #include "log.h" @@ -103,22 +103,21 @@ void cgroup_init(void) /* Create and mount traditional cgroups v1 hier */ while (fgets(buf, sizeof(buf), fp)) { char *cgroup; -#if 0 char rc[80]; -#endif cgroup = strtok(buf, "\t "); if (!cgroup) continue; -#if 0 snprintf(rc, sizeof(rc), "/sys/fs/cgroup/%s", cgroup); +#if 0 if (mkdir(rc, 0755) && EEXIST != errno) continue; if (mount("cgroup", rc, "cgroup", opts, cgroup)) _d("Failed mounting %s cgroup on %s", cgroup, rc); #else + symlink("finit", rc); append_ctrl(cgroup); #endif }