Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a76780d6 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan
Browse files

Disable SetupCgroup for non-Android targets



Non-android targets should not mount cgroups described in cgroup map
file. When used on non-Android targets SetupCgroup will fail. When
SetupCgroup is called via SetupCgroups a warning will be generated for
each cgroup that fails to mount.

Bug: 111307099
Change-Id: I213a5f9b02f312ba1dd7dc91c89b67334fb939b9
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
parent d54706cf
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ static bool ReadDescriptors(std::map<std::string, CgroupDescriptor>* descriptors
    return true;
}

// To avoid issues in sdk_mac build
#if defined(__ANDROID__)

static bool SetupCgroup(const CgroupDescriptor& descriptor) {
    const CgroupController* controller = descriptor.controller();

@@ -180,6 +183,15 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
    return true;
}

#else

// Stubs for non-Android targets.
static bool SetupCgroup(const CgroupDescriptor&) {
    return false;
}

#endif

static bool WriteRcFile(const std::map<std::string, CgroupDescriptor>& descriptors) {
    std::string cgroup_rc_path = StringPrintf("%s/%s", CGROUPS_RC_DIR, CgroupMap::CGROUPS_RC_FILE);
    unique_fd fd(TEMP_FAILURE_RETRY(open(cgroup_rc_path.c_str(),