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: Suren Baghdasaryan <surenb@google.com>
diff --git a/libprocessgroup/cgroup_map.cpp b/libprocessgroup/cgroup_map.cpp
index 1b5f217..12cfb7e 100644
--- a/libprocessgroup/cgroup_map.cpp
+++ b/libprocessgroup/cgroup_map.cpp
@@ -142,6 +142,9 @@
     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 @@
     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(),