libprocessgroup: Convert CGROUPV2_HIERARCHY_NAME to std::string

Almost everywhere CGROUPV2_HIERARCHY_NAME is used a std::string is
required, so change its type to avoid temporaries.

Change-Id: I4466838c510f2eb8212fc71999cdaa47359ce9c3
This commit is contained in:
T.J. Mercier 2024-08-07 16:35:55 +00:00
parent 9e5f74d4e4
commit b6071f19c3
2 changed files with 2 additions and 2 deletions

View file

@ -26,7 +26,7 @@
__BEGIN_DECLS __BEGIN_DECLS
static constexpr const char* CGROUPV2_HIERARCHY_NAME = "cgroup2"; static constexpr std::string CGROUPV2_HIERARCHY_NAME = "cgroup2";
bool CgroupsAvailable(); bool CgroupsAvailable();
bool CgroupGetControllerPath(const std::string& cgroup_name, std::string* path); bool CgroupGetControllerPath(const std::string& cgroup_name, std::string* path);

View file

@ -222,7 +222,7 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
const CgroupController* controller = descriptor.controller(); const CgroupController* controller = descriptor.controller();
if (controller->version() == 2) { if (controller->version() == 2) {
if (!strcmp(controller->name(), CGROUPV2_HIERARCHY_NAME)) { if (controller->name() == CGROUPV2_HIERARCHY_NAME) {
return MountV2CgroupController(descriptor); return MountV2CgroupController(descriptor);
} else { } else {
return ActivateV2CgroupController(descriptor); return ActivateV2CgroupController(descriptor);