mirror of
https://github.com/troglobit/finit.git
synced 2026-11-10 16:31:21 +00:00
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 <troglobit@gmail.com>
This commit is contained in:
1 parent
74a26f559d
commit
ce55f88a00
1 file changed
+3
-4
+3
-4
@@ -26,7 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <lite/lite.h>
|
#include <lite/lite.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h> /* get_nprocs_conf() */
|
||||||
|
|
||||||
#include "finit.h"
|
#include "finit.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -103,22 +103,21 @@ void cgroup_init(void)
|
|||||||
/* Create and mount traditional cgroups v1 hier */
|
/* Create and mount traditional cgroups v1 hier */
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
while (fgets(buf, sizeof(buf), fp)) {
|
||||||
char *cgroup;
|
char *cgroup;
|
||||||
#if 0
|
|
||||||
char rc[80];
|
char rc[80];
|
||||||
#endif
|
|
||||||
|
|
||||||
cgroup = strtok(buf, "\t ");
|
cgroup = strtok(buf, "\t ");
|
||||||
if (!cgroup)
|
if (!cgroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if 0
|
|
||||||
snprintf(rc, sizeof(rc), "/sys/fs/cgroup/%s", cgroup);
|
snprintf(rc, sizeof(rc), "/sys/fs/cgroup/%s", cgroup);
|
||||||
|
#if 0
|
||||||
if (mkdir(rc, 0755) && EEXIST != errno)
|
if (mkdir(rc, 0755) && EEXIST != errno)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mount("cgroup", rc, "cgroup", opts, cgroup))
|
if (mount("cgroup", rc, "cgroup", opts, cgroup))
|
||||||
_d("Failed mounting %s cgroup on %s", cgroup, rc);
|
_d("Failed mounting %s cgroup on %s", cgroup, rc);
|
||||||
#else
|
#else
|
||||||
|
symlink("finit", rc);
|
||||||
append_ctrl(cgroup);
|
append_ctrl(cgroup);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user