MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / cgroupsV2Enabled

Function cgroupsV2Enabled

base/base/cgroupsv2.cpp:10–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace fs = std::filesystem;
9
10bool cgroupsV2Enabled()
11{
12#if defined(OS_LINUX)
13 try
14 {
15 /// This file exists iff the host has cgroups v2 enabled.
16 auto controllers_file = default_cgroups_mount / "cgroup.controllers";
17 if (!fs::exists(controllers_file))
18 return false;
19 return true;
20 }
21 catch (const fs::filesystem_error &) /// all "underlying OS API errors", typically: permission denied
22 {
23 return false; /// not logging the exception as most callers fall back to cgroups v1
24 }
25#else
26 return false;
27#endif
28}
29
30fs::path cgroupV2PathOfProcess()
31{

Callers 4

cgroupV2PathOfProcessFunction · 0.85
getCgroupsV2MemoryLimitFunction · 0.85
getCGroupLimitedCPUCoresFunction · 0.85

Calls 1

existsFunction · 0.50

Tested by

no test coverage detected