|
26 | 26 | package jdk.internal.platform;
|
27 | 27 |
|
28 | 28 | /**
|
29 |
| - * Data structure to hold info from /proc/self/cgroup |
| 29 | + * Data structure to hold info from /proc/self/cgroup, |
| 30 | + * /proc/cgroups and /proc/self/mountinfo |
30 | 31 | *
|
31 | 32 | * man 7 cgroups
|
32 | 33 | *
|
33 | 34 | * @see CgroupSubsystemFactory
|
34 | 35 | */
|
35 |
| -class CgroupInfo { |
| 36 | +public class CgroupInfo { |
36 | 37 |
|
37 | 38 | private final String name;
|
38 | 39 | private final int hierarchyId;
|
39 | 40 | private final boolean enabled;
|
| 41 | + private String mountPoint; |
| 42 | + private String mountRoot; |
| 43 | + private String cgroupPath; |
40 | 44 |
|
41 | 45 | private CgroupInfo(String name, int hierarchyId, boolean enabled) {
|
42 | 46 | this.name = name;
|
43 | 47 | this.hierarchyId = hierarchyId;
|
44 | 48 | this.enabled = enabled;
|
45 | 49 | }
|
46 | 50 |
|
47 |
| - String getName() { |
| 51 | + public String getName() { |
48 | 52 | return name;
|
49 | 53 | }
|
50 | 54 |
|
51 |
| - int getHierarchyId() { |
| 55 | + public int getHierarchyId() { |
52 | 56 | return hierarchyId;
|
53 | 57 | }
|
54 | 58 |
|
55 |
| - boolean isEnabled() { |
| 59 | + public boolean isEnabled() { |
56 | 60 | return enabled;
|
57 | 61 | }
|
58 | 62 |
|
| 63 | + public String getMountPoint() { |
| 64 | + return mountPoint; |
| 65 | + } |
| 66 | + |
| 67 | + public void setMountPoint(String mountPoint) { |
| 68 | + this.mountPoint = mountPoint; |
| 69 | + } |
| 70 | + |
| 71 | + public String getMountRoot() { |
| 72 | + return mountRoot; |
| 73 | + } |
| 74 | + |
| 75 | + public void setMountRoot(String mountRoot) { |
| 76 | + this.mountRoot = mountRoot; |
| 77 | + } |
| 78 | + |
| 79 | + public String getCgroupPath() { |
| 80 | + return cgroupPath; |
| 81 | + } |
| 82 | + |
| 83 | + public void setCgroupPath(String cgroupPath) { |
| 84 | + this.cgroupPath = cgroupPath; |
| 85 | + } |
| 86 | + |
| 87 | + /* |
| 88 | + * Creates a CgroupInfo instance from a line in /proc/cgroups. |
| 89 | + * Comment token (hash) is handled by the caller. |
| 90 | + * |
| 91 | + * Example (annotated): |
| 92 | + * |
| 93 | + * #subsys_name hierarchy num_cgroups enabled |
| 94 | + * cpuset 10 1 1 (a) |
| 95 | + * cpu 7 8 1 (b) |
| 96 | + * [...] |
| 97 | + * |
| 98 | + * Line (a) would yield: |
| 99 | + * info = new CgroupInfo("cpuset", 10, true); |
| 100 | + * return info; |
| 101 | + * Line (b) results in: |
| 102 | + * info = new CgroupInfo("cpu", 7, true); |
| 103 | + * return info; |
| 104 | + * |
| 105 | + * |
| 106 | + * See CgroupSubsystemFactory.determineType() |
| 107 | + * |
| 108 | + */ |
59 | 109 | static CgroupInfo fromCgroupsLine(String line) {
|
60 | 110 | String[] tokens = line.split("\\s+");
|
61 | 111 | if (tokens.length != 4) {
|
|
0 commit comments