xinyiZzz commented on code in PR #39256:
URL: https://github.com/apache/doris/pull/39256#discussion_r1715145558


##########
be/src/util/cgroup_util.cpp:
##########
@@ -40,14 +37,32 @@ using std::pair;
 
 namespace doris {
 
-Status CGroupUtil::find_global_cgroup(const string& subsystem, string* path) {
+bool CGroupUtil::cgroupsv1_enable() {
+    bool exists = true;
+    Status st = io::global_local_filesystem()->exists("/proc/cgroups", 
&exists);
+    return st.ok() && exists;
+}
+
+bool CGroupUtil::cgroupsv2_enable() {
+#if defined(OS_LINUX)
+    // This file exists iff the host has cgroups v2 enabled.
+    auto controllers_file = default_cgroups_mount / "cgroup.controllers";
+    bool exists = true;
+    Status st = io::global_local_filesystem()->exists(controllers_file, 
&exists);
+    return st.ok() && exists;
+#else
+    return false;
+#endif
+}
+
+Status CGroupUtil::find_global_cgroupv1(const string& subsystem, string* path) 
{
     std::ifstream proc_cgroups("/proc/self/cgroup", std::ios::in);
     string line;
     while (true) {
         if (proc_cgroups.fail()) {
-            return Status::IOError("Error reading /proc/self/cgroup: {}", 
get_str_err_msg());
+            return Status::EndOfFile("Error reading /proc/self/cgroup: {}", 
get_str_err_msg());

Review Comment:
   好的
   因为不想打印stacktrace,EndOfFile 不会打。。。



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to