mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Use getCurrentCgroup() in getMaxCPU()
This commit is contained in:
parent
03484641a1
commit
bd6ae2f3b9
|
@ -32,11 +32,7 @@ unsigned int getMaxCPU()
|
||||||
auto cgroupFS = getCgroupFS();
|
auto cgroupFS = getCgroupFS();
|
||||||
if (!cgroupFS) return 0;
|
if (!cgroupFS) return 0;
|
||||||
|
|
||||||
auto cgroups = getCgroups("/proc/self/cgroup");
|
auto cpuFile = *cgroupFS + "/" + getCurrentCgroup() + "/cpu.max";
|
||||||
auto cgroup = cgroups[""];
|
|
||||||
if (cgroup == "") return 0;
|
|
||||||
|
|
||||||
auto cpuFile = *cgroupFS + "/" + cgroup + "/cpu.max";
|
|
||||||
|
|
||||||
auto cpuMax = readFile(cpuFile);
|
auto cpuMax = readFile(cpuFile);
|
||||||
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");
|
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");
|
||||||
|
|
Loading…
Reference in a new issue