To enable a controller in a cgroup, its parent's subtree_control file is
read to check if the controller is enabled, if not enabled, parent's
cgroup.controllers is checked for the supported controllers, before
enabling it in the cgroup.subtree_control.
Populate controllers in the root_cgroup.controllers file, to help with
the check for supported controllers, without this
cgroupv2_subtree_control_recursive() will fail, when it is checked for
controller existence.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
f = fopen(tmp_path, "w");
ASSERT_NE(f, nullptr);
fclose(f);
+
+ memset(tmp_path, 0, sizeof(tmp_path));
+ snprintf(tmp_path, FILENAME_MAX - 1,
+ "%s/cgroup.controllers",
+ PARENT_DIR);
+
+ f = fopen(tmp_path, "a");
+ ASSERT_NE(f, nullptr);
+ fprintf(f, "%s ", CONTROLLERS[i]);
+ fclose(f);
break;
default:
/* we shouldn't get here. fail the test */