DevinLeamy commented on code in PR #532:
URL: https://github.com/apache/mesos/pull/532#discussion_r1536002096


##########
src/linux/cgroups2.cpp:
##########
@@ -350,6 +350,47 @@ Try<string> cgroup(pid_t pid)
 }
 
 
+Try<set<pid_t>> processes(const string& cgroup)
+{
+  if (!cgroups2::exists(cgroup)) {
+    return Error("Cgroup '" + cgroup + "' does not exist");
+  }
+
+  Try<string> contents = cgroups2::read<string>(cgroup, control::PROCESSES);
+  if (contents.isError()) {
+    return Error(
+        "Failed to read cgroup.procs in '" + cgroup + "': " + 
contents.error());
+  }
+
+  string trimmed = strings::trim(*contents);
+  if (trimmed.empty()) {
+    return set<pid_t>();
+  }
+
+  set<pid_t> pids;
+  foreach (const string& _pid, strings::split(strings::trim(*contents), "\n")) 
{
+    Try<pid_t> pid = numify<pid_t>(strings::trim(_pid));

Review Comment:
   Was doing it to be "safe". Removed. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to