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


##########
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:
   搞一个新的ERRORCODE,CGROUP_ERROR, 别用EOF 这个,EOF 在大多数时候都是正确的



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to