Remove ACgroupController_getFlags to fix API breakage

Since ACgroupController_getFlags was introduced after LLNDK freeze it
causes media crashes due to missing symbol. Remove the new function and
re-implement cgroup controller detection to not require flags field but
instead check for its existence on the first access.

Bug: 135049992
Test: libcutils_test with and without CONFIG_CPUSETS enabled
Change-Id: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Merged-In: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan 2019-06-12 06:43:20 -07:00
parent 9b90198887
commit aa1d54f0cc
4 changed files with 3 additions and 17 deletions

View file

@ -70,8 +70,8 @@ bool CgroupController::HasValue() const {
bool CgroupController::IsUsable() const {
if (!HasValue()) return false;
uint32_t flags = ACgroupController_getFlags(controller_);
return (flags & CGROUPRC_CONTROLLER_FLAG_MOUNTED) != 0;
static bool enabled = (access(GetProcsFilePath("", 0, 0).c_str(), F_OK) == 0);
return enabled;
}
std::string CgroupController::GetTasksFilePath(const std::string& rel_path) const {
@ -160,7 +160,6 @@ void CgroupMap::Print() const {
const ACgroupController* controller = ACgroupFile_getController(i);
LOG(INFO) << "\t" << ACgroupController_getName(controller) << " ver "
<< ACgroupController_getVersion(controller) << " path "
<< ACgroupController_getFlags(controller) << " flags "
<< ACgroupController_getPath(controller);
}
}

View file

@ -27,11 +27,6 @@ uint32_t ACgroupController_getVersion(const ACgroupController* controller) {
return controller->version();
}
uint32_t ACgroupController_getFlags(const ACgroupController* controller) {
CHECK(controller != nullptr);
return controller->flags();
}
const char* ACgroupController_getName(const ACgroupController* controller) {
CHECK(controller != nullptr);
return controller->name();

View file

@ -66,17 +66,10 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const
__INTRODUCED_IN(29);
/**
* Flag bitmask used in ACgroupController_getFlags
* Flag bitmask to be used when ACgroupController_getFlags can be exported
*/
#define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1
/**
* Returns the flags bitmask of the given controller.
* If the given controller is null, return 0.
*/
__attribute__((warn_unused_result)) uint32_t ACgroupController_getFlags(const ACgroupController*)
__INTRODUCED_IN(29);
/**
* Returns the name of the given controller.
* If the given controller is null, return nullptr.

View file

@ -4,7 +4,6 @@ LIBCGROUPRC { # introduced=29
ACgroupFile_getControllerCount;
ACgroupFile_getController;
ACgroupController_getVersion;
ACgroupController_getFlags;
ACgroupController_getName;
ACgroupController_getPath;
local: