Extend the syntax parsed by make_cpuset() so that "a" or "all" is an alias for all CPUs in the system. Signed-off-by: Petr Tesarik <ptesarik@xxxxxxx> --- help.c | 3 ++- tools.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-)
[PATCH 5/11] Recognize "a" and "all" as CPU specifiers Extend the syntax parsed by make_cpuset() so that "a" or "all" is an alias for all CPUs in the system. Signed-off-by: Petr Tesarik <ptesarik@xxxxxxx> --- help.c | 3 ++- tools.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) --- a/tools.c +++ b/tools.c @@ -5518,14 +5518,20 @@ make_cpumask(char *s, ulong *mask, int f p = strtok(s, ","); while (p) { s = strtok(NULL, ""); - start = end = -1; - q = strtok(p, "-"); - start = dtoi(q, flags, errptr); - if ((q = strtok(NULL, "-"))) - end = dtoi(q, flags, errptr); - if (end == -1) - end = start; + if (STREQ(p, "a") || STREQ(p, "all")) { + start = 0; + end = kt->cpus - 1; + } else { + start = end = -1; + q = strtok(p, "-"); + start = dtoi(q, flags, errptr); + if ((q = strtok(NULL, "-"))) + end = dtoi(q, flags, errptr); + + if (end == -1) + end = start; + } for (i = start; i <= end; i++) SET_BIT(mask, i); --- a/help.c +++ b/help.c @@ -1089,6 +1089,7 @@ char *help_p[] = { " expression The expression to be evaluated.", " cpuspec CPU specification for per-cpu variables:", " : CPU of the currently selected task.", +" :a[ll] all CPUs.", " :#[-#][,...] CPU list(s), e.g. \"1,3,5\", \"1-3\",", " or \"1,3,5-7,10\".", " -x override default output format with hexadecimal format.", @@ -2852,7 +2853,7 @@ char *help_irq[] = { " irq stats of all cpus will be displayed.", " -c cpu only usable with the -s option, dump the irq stats of the ", " specified cpu[s]; cpu can be specified as \"1,3,5\", \"1-3\",", -" or \"1,3,5-7,10\".", +" \"1,3,5-7,10\", \"all\", or \"a\" (shortcut for \"all\").", "\nEXAMPLES", " Display the relevant data for IRQ 18 from a pre-2.6.37 kernel:\n", " %s> irq 18",
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility