Skip to content

Commit 84016e1

Browse files
committed
Use simple patterns to parse cgroup files
1 parent 902e5fc commit 84016e1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/java.base/linux/classes/jdk/internal/platform/CgroupInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void setCgroupPath(String cgroupPath) {
107107
*
108108
*/
109109
static CgroupInfo fromCgroupsLine(String line) {
110-
String[] tokens = line.split("\\s+");
110+
String[] tokens = line.split("\t");
111111
if (tokens.length != 4) {
112112
return null;
113113
}

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static long getLongValueMatchingLine(CgroupSubsystemController controller
107107
}
108108

109109
public static long convertHierachicalLimitLine(String line) {
110-
String[] tokens = line.split("\\s");
110+
String[] tokens = line.split(" ");
111111
if (tokens.length == 2) {
112112
String strVal = tokens[1];
113113
return CgroupV1SubsystemController.convertStringToLong(strVal);

src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private long getFromCpuMax(int tokenIdx) {
143143
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
144144
}
145145
// $MAX $PERIOD
146-
String[] tokens = cpuMaxRaw.split("\\s+");
146+
String[] tokens = cpuMaxRaw.split(" ");
147147
if (tokens.length != 2) {
148148
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
149149
}
@@ -359,7 +359,7 @@ private static Long ioStatLineToLong(String line, String[] matchNames) {
359359
if (line == null || EMPTY_STR.equals(line)) {
360360
return Long.valueOf(0);
361361
}
362-
String[] tokens = line.split("\\s+");
362+
String[] tokens = line.split(" ");
363363
long retval = 0;
364364
for (String t: tokens) {
365365
String[] valKeys = t.split("=");

0 commit comments

Comments
 (0)