From 3bdf315eaec91ee7c41232baf63eaddc43e0a48f Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Mon, 22 Apr 2019 13:12:13 -0700 Subject: [PATCH] libprocessgroup: limit libprocessgroup's VNDK API surface Limit libprocessgroup VNDK API to the minimum set required for task profiles usage. This API allows vendors to use cgroups without accessing cgroup files directly, therefore allowing Android to change cgroup arrangement details without breaking vendor code. Bug: 131098932 Test: build and boot Change-Id: I92463dfb44a108a133bafd2fe52237b6b1d50a69 Signed-off-by: Suren Baghdasaryan --- libprocessgroup/include/processgroup/processgroup.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libprocessgroup/include/processgroup/processgroup.h b/libprocessgroup/include/processgroup/processgroup.h index 8d150adb0..7e6bf45cf 100644 --- a/libprocessgroup/include/processgroup/processgroup.h +++ b/libprocessgroup/include/processgroup/processgroup.h @@ -24,18 +24,21 @@ __BEGIN_DECLS static constexpr const char* CGROUPV2_CONTROLLER_NAME = "cgroup2"; -static constexpr const char* CGROUPS_RC_PATH = "/dev/cgroup_info/cgroup.rc"; bool CgroupGetControllerPath(const std::string& cgroup_name, std::string* path); bool CgroupGetAttributePath(const std::string& attr_name, std::string* path); bool CgroupGetAttributePathForTask(const std::string& attr_name, int tid, std::string* path); -bool UsePerAppMemcg(); - bool SetTaskProfiles(int tid, const std::vector& profiles, bool use_fd_cache = false); bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector& profiles, bool use_fd_cache = false); +#ifndef __ANDROID_VNDK__ + +static constexpr const char* CGROUPS_RC_PATH = "/dev/cgroup_info/cgroup.rc"; + +bool UsePerAppMemcg(); + // Return 0 and removes the cgroup if there are no longer any processes in it. // Returns -1 in the case of an error occurring or if there are processes still running // even after retrying for up to 200ms. @@ -55,4 +58,6 @@ bool setProcessGroupLimit(uid_t uid, int initialPid, int64_t limitInBytes); void removeAllProcessGroups(void); +#endif // __ANDROID_VNDK__ + __END_DECLS