libprocessgroup: Use pid_t consistently for TIDs
Test: m
Change-Id: I6e95870e6c5855bfe03be3be8f7a8884147bc15d
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index facfb5e..94d9502 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -147,7 +147,7 @@
return true;
}
-bool CgroupGetAttributePathForTask(const std::string& attr_name, int tid, std::string* path) {
+bool CgroupGetAttributePathForTask(const std::string& attr_name, pid_t tid, std::string* path) {
const TaskProfiles& tp = TaskProfiles::GetInstance();
const IProfileAttribute* attr = tp.GetAttribute(attr_name);
@@ -198,17 +198,18 @@
uid, pid, std::span<const std::string>(profiles), true);
}
-bool SetTaskProfiles(int tid, const std::vector<std::string>& profiles, bool use_fd_cache) {
+bool SetTaskProfiles(pid_t tid, const std::vector<std::string>& profiles, bool use_fd_cache) {
return TaskProfiles::GetInstance().SetTaskProfiles(tid, std::span<const std::string>(profiles),
use_fd_cache);
}
-bool SetTaskProfiles(int tid, std::initializer_list<std::string_view> profiles, bool use_fd_cache) {
+bool SetTaskProfiles(pid_t tid, std::initializer_list<std::string_view> profiles,
+ bool use_fd_cache) {
return TaskProfiles::GetInstance().SetTaskProfiles(
tid, std::span<const std::string_view>(profiles), use_fd_cache);
}
-bool SetTaskProfiles(int tid, std::span<const std::string_view> profiles, bool use_fd_cache) {
+bool SetTaskProfiles(pid_t tid, std::span<const std::string_view> profiles, bool use_fd_cache) {
return TaskProfiles::GetInstance().SetTaskProfiles(tid, profiles, use_fd_cache);
}
@@ -712,7 +713,7 @@
return createProcessGroupInternal(uid, initialPid, cgroup, true);
}
-static bool SetProcessGroupValue(int tid, const std::string& attr_name, int64_t value) {
+static bool SetProcessGroupValue(pid_t tid, const std::string& attr_name, int64_t value) {
if (!isMemoryCgroupSupported()) {
LOG(ERROR) << "Memcg is not mounted.";
return false;
@@ -743,7 +744,7 @@
return SetProcessGroupValue(pid, "MemLimit", limit_in_bytes);
}
-bool getAttributePathForTask(const std::string& attr_name, int tid, std::string* path) {
+bool getAttributePathForTask(const std::string& attr_name, pid_t tid, std::string* path) {
return CgroupGetAttributePathForTask(attr_name, tid, path);
}