aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2014-01-28 22:26:14 -0500
committerSteve Vinoski <[email protected]>2014-02-17 22:10:27 -0500
commit57573ab98e88ede4b6bca07574e537b6e4f82027 (patch)
tree481b457fba35d2df29c6e8c37b19f89cc2294847 /erts
parent6c9002f9174d40b69b3a5bcd5ef219ce4ceb3622 (diff)
downloadotp-57573ab98e88ede4b6bca07574e537b6e4f82027.tar.gz
otp-57573ab98e88ede4b6bca07574e537b6e4f82027.tar.bz2
otp-57573ab98e88ede4b6bca07574e537b6e4f82027.zip
allow optional whitespace in dirty scheduler erl options
The +SDcpu, +SDPcpu, and +SDio options did not properly handle having their arguments immediately following them without intervening whitespace, e.g. +SDio20 was treated as an error. Fix all the dirty scheduler command line options so they handle optional whitespace between them and their associated arguments.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_init.c6
-rw-r--r--erts/etc/common/erlexec.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index c17256f466..e6c05adec1 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -835,7 +835,7 @@ early_init(int *argc, char **argv) /*
else if (argv[i][2] == 'D') {
char *arg;
char *type = argv[i]+3;
- if (strcmp(type, "Pcpu") == 0) {
+ if (strncmp(type, "Pcpu", 4) == 0) {
int ptot, ponln;
arg = get_arg(argv[i]+7, argv[i+1], &i);
switch (sscanf(arg, "%d:%d", &ptot, &ponln)) {
@@ -872,7 +872,7 @@ early_init(int *argc, char **argv) /*
VERBOSE(DEBUG_SYSTEM,
("using %d:%d dirty CPU scheduler percentages\n",
dirty_cpu_scheds_pctg, dirty_cpu_scheds_onln_pctg));
- } else if (strcmp(type, "cpu") == 0) {
+ } else if (strncmp(type, "cpu", 3) == 0) {
int tot, onln;
arg = get_arg(argv[i]+6, argv[i+1], &i);
switch (sscanf(arg, "%d:%d", &tot, &onln)) {
@@ -923,7 +923,7 @@ early_init(int *argc, char **argv) /*
}
VERBOSE(DEBUG_SYSTEM,
("using %d:%d dirty CPU scheduler(s)\n", tot, onln));
- } else if (strcmp(type, "io") == 0) {
+ } else if (strncmp(type, "io", 2) == 0) {
arg = get_arg(argv[i]+5, argv[i+1], &i);
dirty_io_scheds = atoi(arg);
if (dirty_io_scheds < 0 ||
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index 2cf7280ebc..709c6f02d1 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -833,9 +833,13 @@ int main(int argc, char **argv)
#ifdef ERTS_DIRTY_SCHEDULERS
else if (argv[i][2] == 'D') {
char* type = argv[i]+3;
- if (strcmp(type, "cpu") != 0 &&
- strcmp(type, "Pcpu") != 0 &&
- strcmp(type, "io") != 0)
+ if (strncmp(type, "cpu", 3) != 0 &&
+ strncmp(type, "Pcpu", 4) != 0 &&
+ strncmp(type, "io", 2) != 0)
+ usage(argv[i]);
+ if ((argv[i][3] == 'c' && argv[i][6] != '\0') ||
+ (argv[i][3] == 'P' && argv[i][7] != '\0') ||
+ (argv[i][3] == 'i' && argv[i][5] != '\0'))
goto the_default;
}
#endif