Reapply "libprocessgroup: Combine all 3 ActivateControllers imple..."
This reverts commit 0fa49253a484fc0c99d067ade57a4978059b3a95.
Change-Id: I83121ff295caaabc0a2fd8a606ee2d52dacb0174
diff --git a/libprocessgroup/cgroup_map.cpp b/libprocessgroup/cgroup_map.cpp
index 8180ccf..32bef13 100644
--- a/libprocessgroup/cgroup_map.cpp
+++ b/libprocessgroup/cgroup_map.cpp
@@ -194,24 +194,6 @@
return CgroupControllerWrapper(nullptr);
}
-int CgroupMap::ActivateControllers(const std::string& path) const {
- for (const auto& [name, descriptor] : descriptors_) {
- const uint32_t flags = descriptor.controller()->flags();
- const uint32_t max_activation_depth = descriptor.controller()->max_activation_depth();
- const int depth = GetCgroupDepth(descriptor.controller()->path(), path);
-
- if (flags & CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION && depth < max_activation_depth) {
- std::string str("+");
- str.append(descriptor.controller()->name());
- if (!WriteStringToFile(str, path + "/cgroup.subtree_control")) {
- if (flags & CGROUPRC_CONTROLLER_FLAG_OPTIONAL) {
- PLOG(WARNING) << "Activation of cgroup controller " << str
- << " failed in path " << path;
- } else {
- return -errno;
- }
- }
- }
- }
- return 0;
+bool CgroupMap::ActivateControllers(const std::string& path) const {
+ return ::ActivateControllers(path, descriptors_);
}