Merge "Fix cgroup support for recovery mode" am: da20bc763e
am: e95fd681f7
Change-Id: I779c4da2aedddd09f86df570a1636b0854d35bbd
This commit is contained in:
commit
0a613c94df
3 changed files with 37 additions and 14 deletions
|
|
@ -126,22 +126,26 @@ static bool ReadDescriptors(std::map<std::string, CgroupDescriptor>* descriptors
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value cgroups = root["Cgroups"];
|
if (root.isMember("Cgroups")) {
|
||||||
for (Json::Value::ArrayIndex i = 0; i < cgroups.size(); ++i) {
|
const Json::Value& cgroups = root["Cgroups"];
|
||||||
std::string name = cgroups[i]["Controller"].asString();
|
for (Json::Value::ArrayIndex i = 0; i < cgroups.size(); ++i) {
|
||||||
descriptors->emplace(std::make_pair(
|
std::string name = cgroups[i]["Controller"].asString();
|
||||||
name,
|
descriptors->emplace(std::make_pair(
|
||||||
CgroupDescriptor(1, name, cgroups[i]["Path"].asString(),
|
name,
|
||||||
std::strtoul(cgroups[i]["Mode"].asString().c_str(), 0, 8),
|
CgroupDescriptor(1, name, cgroups[i]["Path"].asString(),
|
||||||
cgroups[i]["UID"].asString(), cgroups[i]["GID"].asString())));
|
std::strtoul(cgroups[i]["Mode"].asString().c_str(), 0, 8),
|
||||||
|
cgroups[i]["UID"].asString(), cgroups[i]["GID"].asString())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value cgroups2 = root["Cgroups2"];
|
if (root.isMember("Cgroups2")) {
|
||||||
descriptors->emplace(std::make_pair(
|
const Json::Value& cgroups2 = root["Cgroups2"];
|
||||||
CGROUPV2_CONTROLLER_NAME,
|
descriptors->emplace(std::make_pair(
|
||||||
CgroupDescriptor(2, CGROUPV2_CONTROLLER_NAME, cgroups2["Path"].asString(),
|
CGROUPV2_CONTROLLER_NAME,
|
||||||
std::strtoul(cgroups2["Mode"].asString().c_str(), 0, 8),
|
CgroupDescriptor(2, CGROUPV2_CONTROLLER_NAME, cgroups2["Path"].asString(),
|
||||||
cgroups2["UID"].asString(), cgroups2["GID"].asString())));
|
std::strtoul(cgroups2["Mode"].asString().c_str(), 0, 8),
|
||||||
|
cgroups2["UID"].asString(), cgroups2["GID"].asString())));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,16 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
|
||||||
|
|
||||||
include $(BUILD_PREBUILT)
|
include $(BUILD_PREBUILT)
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# cgroups.json for recovery
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := cgroups.recovery.json
|
||||||
|
LOCAL_SRC_FILES := $(LOCAL_MODULE)
|
||||||
|
LOCAL_MODULE_CLASS := ETC
|
||||||
|
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/etc
|
||||||
|
LOCAL_MODULE_STEM := cgroups.json
|
||||||
|
include $(BUILD_PREBUILT)
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# task_profiles.json
|
# task_profiles.json
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
|
||||||
9
rootdir/cgroups.recovery.json
Normal file
9
rootdir/cgroups.recovery.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"Cgroups": [
|
||||||
|
{
|
||||||
|
"Controller": "cpuacct",
|
||||||
|
"Path": "/acct",
|
||||||
|
"Mode": "0555"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue