Skip to content

Commit

Permalink
feat: linux control group version 2 API support cgroup v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangxinDong committed Oct 10, 2022
1 parent 58f35a4 commit 1cdf1f8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@

import com.aws.greengrass.util.platforms.SystemResourceController;
import com.aws.greengrass.util.platforms.unix.UnixPlatform;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME",
justification = "Cgroup Controller virtual filesystem path cannot be relative")
public class LinuxPlatform extends UnixPlatform {
private static final String CGROUP_CONTROLLERS = "/sys/fs/cgroup/cgroup.controllers";
private static final String CGROUP_ROOT = "/sys/fs/cgroup";
private static final String CGROUP_CONTROLLERS = "cgroup.controllers";

SystemResourceController systemResourceController;

Expand All @@ -30,6 +34,6 @@ public SystemResourceController getSystemResourceController() {
}

private Path getControllersRootPath() {
return Paths.get(CGROUP_CONTROLLERS);
return Paths.get(CGROUP_ROOT).resolve(CGROUP_CONTROLLERS);
}
}

0 comments on commit 1cdf1f8

Please sign in to comment.