-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: linux control group version 2 API support cgroup v2
- Loading branch information
1 parent
7730b18
commit ea1823a
Showing
10 changed files
with
502 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupSubSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.aws.greengrass.util.platforms.unix.linux; | ||
|
||
public enum CgroupSubSystem { | ||
Memory("memory", ""), CPU("cpu,cpuacct", ""), Freezer("freezer", "freezer"); | ||
|
||
private String osString; | ||
private String mountSrc; | ||
|
||
CgroupSubSystem(String osString, String mountSrc) { | ||
this.osString = osString; | ||
this.mountSrc = mountSrc; | ||
} | ||
|
||
/** | ||
* Get the osString associated with this CgroupSubController. | ||
* | ||
* @return the osString associated with this CgroupSubController. | ||
*/ | ||
public String getOsString() { | ||
return osString; | ||
} | ||
|
||
/** | ||
* Get the mountSrc associated with this CgroupSubController. | ||
* | ||
* @return the mountSrc associated with this CgroupSubController. | ||
*/ | ||
public String getMountSrc() { | ||
return mountSrc; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupSubSystemV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.aws.greengrass.util.platforms.unix.linux; | ||
|
||
public enum CgroupSubSystemV2 { | ||
Memory("", ""), CPU("", ""), Freezer("", ""), | ||
Unified("",""); | ||
|
||
private String osString; | ||
private String mountSrc; | ||
|
||
CgroupSubSystemV2(String osString, String mountSrc) { | ||
this.osString = osString; | ||
this.mountSrc = mountSrc; | ||
} | ||
|
||
/** | ||
* Get the osString associated with this CgroupSubController. | ||
* | ||
* @return the osString associated with this CgroupSubController. | ||
*/ | ||
public String getOsString() { | ||
return osString; | ||
} | ||
|
||
/** | ||
* Get the mountSrc associated with this CgroupSubController. | ||
* | ||
* @return the mountSrc associated with this CgroupSubController. | ||
*/ | ||
public String getMountSrc() { | ||
return mountSrc; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV2FreezerState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.aws.greengrass.util.platforms.unix.linux; | ||
|
||
public enum CgroupV2FreezerState { | ||
THAWED(0), | ||
FROZEN(1); | ||
|
||
private int index; | ||
|
||
CgroupV2FreezerState(int index) { | ||
this.index = index; | ||
} | ||
|
||
/** | ||
* Get the index value associated with this CgroupV2FreezerState. | ||
* | ||
* @return the integer index value associated with this CgroupV2FreezerState. | ||
*/ | ||
public int getIndex() { | ||
return index; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.