Loading libprocessgroup/cgrouprc/include/android/cgrouprc.h +1 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const */ #define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1 #define CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION 0x2 #define CGROUPRC_CONTROLLER_FLAG_OPTIONAL 0x4 /** * Returns the flags bitmask of the given controller. Loading libprocessgroup/profiles/cgroups.json +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ "Path": "/dev/memcg", "Mode": "0700", "UID": "root", "GID": "system" "GID": "system", "Optional": true } ], "Cgroups2": { Loading libprocessgroup/profiles/cgroups.proto +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ message Cgroups { Cgroups2 cgroups2 = 2 [json_name = "Cgroups2"]; } // Next: 7 // Next: 8 message Cgroup { string controller = 1 [json_name = "Controller"]; string path = 2 [json_name = "Path"]; Loading @@ -35,6 +35,7 @@ message Cgroup { // when a boolean is specified as false, so leave unspecified in that case // https://developers.google.com/protocol-buffers/docs/proto3#default bool needs_activation = 6 [json_name = "NeedsActivation"]; bool is_optional = 7 [json_name = "Optional"]; } // Next: 6 Loading libprocessgroup/profiles/cgroups_30.json +2 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ "Path": "/dev/stune", "Mode": "0755", "UID": "system", "GID": "system" "GID": "system", "Optional": true } ] } libprocessgroup/setup/cgroup_map_write.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -161,6 +161,10 @@ static void MergeCgroupToDescriptors(std::map<std::string, CgroupDescriptor>* de controller_flags |= CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION; } if (cgroup["Optional"].isBool() && cgroup["Optional"].asBool()) { controller_flags |= CGROUPRC_CONTROLLER_FLAG_OPTIONAL; } CgroupDescriptor descriptor( cgroups_version, name, path, std::strtoul(cgroup["Mode"].asString().c_str(), 0, 8), cgroup["UID"].asString(), cgroup["GID"].asString(), controller_flags); Loading Loading @@ -308,9 +312,16 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) { } if (result < 0) { bool optional = controller->flags() & CGROUPRC_CONTROLLER_FLAG_OPTIONAL; if (optional && errno == EINVAL) { // Optional controllers are allowed to fail to mount if kernel does not support them LOG(INFO) << "Optional " << controller->name() << " cgroup controller is not mounted"; } else { PLOG(ERROR) << "Failed to mount " << controller->name() << " cgroup"; return false; } } return true; } Loading Loading
libprocessgroup/cgrouprc/include/android/cgrouprc.h +1 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const */ #define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1 #define CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION 0x2 #define CGROUPRC_CONTROLLER_FLAG_OPTIONAL 0x4 /** * Returns the flags bitmask of the given controller. Loading
libprocessgroup/profiles/cgroups.json +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ "Path": "/dev/memcg", "Mode": "0700", "UID": "root", "GID": "system" "GID": "system", "Optional": true } ], "Cgroups2": { Loading
libprocessgroup/profiles/cgroups.proto +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ message Cgroups { Cgroups2 cgroups2 = 2 [json_name = "Cgroups2"]; } // Next: 7 // Next: 8 message Cgroup { string controller = 1 [json_name = "Controller"]; string path = 2 [json_name = "Path"]; Loading @@ -35,6 +35,7 @@ message Cgroup { // when a boolean is specified as false, so leave unspecified in that case // https://developers.google.com/protocol-buffers/docs/proto3#default bool needs_activation = 6 [json_name = "NeedsActivation"]; bool is_optional = 7 [json_name = "Optional"]; } // Next: 6 Loading
libprocessgroup/profiles/cgroups_30.json +2 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ "Path": "/dev/stune", "Mode": "0755", "UID": "system", "GID": "system" "GID": "system", "Optional": true } ] }
libprocessgroup/setup/cgroup_map_write.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -161,6 +161,10 @@ static void MergeCgroupToDescriptors(std::map<std::string, CgroupDescriptor>* de controller_flags |= CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION; } if (cgroup["Optional"].isBool() && cgroup["Optional"].asBool()) { controller_flags |= CGROUPRC_CONTROLLER_FLAG_OPTIONAL; } CgroupDescriptor descriptor( cgroups_version, name, path, std::strtoul(cgroup["Mode"].asString().c_str(), 0, 8), cgroup["UID"].asString(), cgroup["GID"].asString(), controller_flags); Loading Loading @@ -308,9 +312,16 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) { } if (result < 0) { bool optional = controller->flags() & CGROUPRC_CONTROLLER_FLAG_OPTIONAL; if (optional && errno == EINVAL) { // Optional controllers are allowed to fail to mount if kernel does not support them LOG(INFO) << "Optional " << controller->name() << " cgroup controller is not mounted"; } else { PLOG(ERROR) << "Failed to mount " << controller->name() << " cgroup"; return false; } } return true; } Loading