diff options
author | Heiko Carstens | 2011-09-06 02:53:00 +0200 |
---|---|---|
committer | Karel Zak | 2011-09-09 23:50:01 +0200 |
commit | 0ad29ff6b0f616450178a891f010c6b3c80ecb58 (patch) | |
tree | 5c96e40038ae92dcc74411e0899a3428deade579 /sys-utils | |
parent | lscpu: add online state to output (diff) | |
download | kernel-qcow2-util-linux-0ad29ff6b0f616450178a891f010c6b3c80ecb58.tar.gz kernel-qcow2-util-linux-0ad29ff6b0f616450178a891f010c6b3c80ecb58.tar.xz kernel-qcow2-util-linux-0ad29ff6b0f616450178a891f010c6b3c80ecb58.zip |
lscpu: add --all option
The parsable output includes only lines of online CPUs. To also include
lines for all offline CPUs the "--all" option can be specified.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/lscpu.1 | 4 | ||||
-rw-r--r-- | sys-utils/lscpu.c | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/sys-utils/lscpu.1 b/sys-utils/lscpu.1 index 68a70f936..cf6e53c53 100644 --- a/sys-utils/lscpu.1 +++ b/sys-utils/lscpu.1 @@ -6,7 +6,7 @@ lscpu \- display information on CPU architecture .SH SYNOPSIS .B lscpu -.RB [ \-ehpxV ] +.RB [ \-aehpxV ] .RB [ \-s .IR directory ] .SH DESCRIPTION @@ -27,6 +27,8 @@ the defined order. .SH OPTIONS .TP +.BR \-a , " \-\-all" +Include online and offline CPUs in output. .TP .BR \-e , " \-\-extended " \fI[=list]\fP Print CPU list out in human-readable format. diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 490c0f4eb..76b2dda1b 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -1305,12 +1305,13 @@ static void __attribute__((__noreturn__)) usage(FILE *out) _(" %s [options]\n"), program_invocation_short_name); fputs(_("\nOptions:\n"), out); - fputs(_(" -h, --help print this help\n" - " -p, --parse[=<list>] print out a parsable format\n" + fputs(_(" -a, --all print online and offline CPUs\n" " -e, --extended[=<list>] print out a extended readable format\n" + " -h, --help print this help\n" + " -p, --parse[=<list>] print out a parsable format\n" " -s, --sysroot <dir> use directory DIR as system root\n" - " -x, --hex print hexadecimal masks rather than lists of CPUs\n" - " -V, --version print version information and exit\n\n"), out); + " -V, --version print version information and exit\n" + " -x, --hex print hexadecimal masks rather than lists of CPUs\n\n"), out); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -1323,6 +1324,7 @@ int main(int argc, char *argv[]) int columns[ARRAY_SIZE(colnames)], ncolumns = 0; static const struct option longopts[] = { + { "all", no_argument, 0, 'a' }, { "help", no_argument, 0, 'h' }, { "extended", optional_argument, 0, 'e' }, { "parse", optional_argument, 0, 'p' }, @@ -1336,13 +1338,16 @@ int main(int argc, char *argv[]) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((c = getopt_long(argc, argv, "e::hp::s:xV", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "ae::hp::s:xV", longopts, NULL)) != -1) { if (mod->mode != OUTPUT_SUMMARY && strchr("ep", c)) errx(EXIT_FAILURE, _("extended and parsable are mutually exclusive")); switch (c) { + case 'a': + mod->allcpus = 1; + break; case 'h': usage(stdout); case 'p': |