Loading libprocessgroup/task_profiles.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -288,6 +288,11 @@ bool ApplyProfileAction::ExecuteForTask(int tid) const { return true; } void TaskProfile::MoveTo(TaskProfile* profile) { profile->elements_ = std::move(elements_); profile->res_cached_ = res_cached_; } bool TaskProfile::ExecuteForProcess(uid_t uid, pid_t pid) const { for (const auto& element : elements_) { if (!element->ExecuteForProcess(uid, pid)) { Loading Loading @@ -458,7 +463,15 @@ bool TaskProfiles::Load(const CgroupMap& cg_map, const std::string& file_name) { LOG(WARNING) << "Unknown profile action: " << action_name; } } auto iter = profiles_.find(profile_name); if (iter == profiles_.end()) { profiles_[profile_name] = profile; } else { // Move the content rather that replace the profile because old profile might be // referenced from an aggregate profile if vendor overrides task profiles profile->MoveTo(iter->second.get()); profile.reset(); } } const Json::Value& aggregateprofiles_val = root["AggregateProfiles"]; Loading libprocessgroup/task_profiles.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ class TaskProfile { TaskProfile() : res_cached_(false) {} void Add(std::unique_ptr<ProfileAction> e) { elements_.push_back(std::move(e)); } void MoveTo(TaskProfile* profile); bool ExecuteForProcess(uid_t uid, pid_t pid) const; bool ExecuteForTask(int tid) const; Loading Loading
libprocessgroup/task_profiles.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -288,6 +288,11 @@ bool ApplyProfileAction::ExecuteForTask(int tid) const { return true; } void TaskProfile::MoveTo(TaskProfile* profile) { profile->elements_ = std::move(elements_); profile->res_cached_ = res_cached_; } bool TaskProfile::ExecuteForProcess(uid_t uid, pid_t pid) const { for (const auto& element : elements_) { if (!element->ExecuteForProcess(uid, pid)) { Loading Loading @@ -458,7 +463,15 @@ bool TaskProfiles::Load(const CgroupMap& cg_map, const std::string& file_name) { LOG(WARNING) << "Unknown profile action: " << action_name; } } auto iter = profiles_.find(profile_name); if (iter == profiles_.end()) { profiles_[profile_name] = profile; } else { // Move the content rather that replace the profile because old profile might be // referenced from an aggregate profile if vendor overrides task profiles profile->MoveTo(iter->second.get()); profile.reset(); } } const Json::Value& aggregateprofiles_val = root["AggregateProfiles"]; Loading
libprocessgroup/task_profiles.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ class TaskProfile { TaskProfile() : res_cached_(false) {} void Add(std::unique_ptr<ProfileAction> e) { elements_.push_back(std::move(e)); } void MoveTo(TaskProfile* profile); bool ExecuteForProcess(uid_t uid, pid_t pid) const; bool ExecuteForTask(int tid) const; Loading