Checking same return value twice does not make command any
better. Secondly the program_invocation_short_name is known to
work, so global progname variable does not add anything extra.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Reduce code duplication and print better error message if an
unsupported cpu number was passed.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The current cpulist_parse() function ignores extra non-parsable characters at
the end of the to be parsed cpu list string. E.g. it would accept something
like "0bla" and just set bit 0 in the cpu set. Since such a string is invalid
implement stricter parsing that makes sure that everything of the string has
been succesfully parsed.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
If cpulist_parse() gets passed a cpu list with a stride value of 0 it will be
stuck in an endless loop. E.g. the following cpu list will cause an endless
loop: "0-2:0". Fix this by causing a parse error if the stride value is 0.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The opening and closing braces for two following if statements within
cpulist_parse() are placed in an odd manner.
Just fix this to prevent broken code in the future.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The comments for cpumask_parse() and cpulist_parse() each describe
the wrong function. Just exchange the comments.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Some vendors have several hypervisors. Therefore it makes sense to not only
print out the hypervisor vendor but also the name of the hypervisor.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
lscpu only prints lines for online CPUs. At least for the human readable
list the offline CPUs are of interest as well. In order to distinguish
between online and offline CPUs introduce the "Online" column.
By default the human readable output now displays online and offline CPUs.
The parsable output is not changed. It will print only lines for online
CPUs as it used to do.
[kzak@redhat.com: - minor changes]
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
CPUs may be in a configured or deconfigured state depending if the CPU resource
may be used by the guest. If a CPU is in configured state the guest may use it
(i.e. set it online). It it is in deconfigured state it cannot use it before
changing its state to configured. Display this CPU attribute as well.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Based on patch from Heiko Carstens <heiko.carstens@de.ibm.com>:
lscpu currently only supports a parsable output which contains a row for
each cpu and its attributes. This output contains only comas as separators
and is hard to read for humans.
Therefore add a new option "-e | --extended" which outputs the rows in a
much more readable (and non-parsable) form. Just like for the -p option a
list of columns can be specified that shall be included in the output.
By default this option will print all columns that contain data.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add a --version option like most other tools have it.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
First check path before accessing files to be sure they actually exist. This is
necessary when also informations for offline CPUs will be printed. Since we do
not necessarily know if "cpu is offline" means the same as "path does not
exist" just check for it.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Simplify the logic to "always print a ',' for each cache except if it is the
last one. This is also a preparation patch for printing the cache column for
offline CPUs where it would print one colon too much because of the current
logic.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The extended parsable output prints a colon instead of comma between each
item. The case where a CPU doesn't belong to any cache was not converted.
Just fix this.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fix typo where the comma operator has been introduced.
Use a semicolon instead so we end up with simple assignment expressions.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
We should only include the libintl.h when NLS is requested.
This fixes issue when building util-linux with uClibc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Add support for loop devices to add partitions. For now we make use of the
max_part parameter from the loop kernel module, otherwise the feature is
disabled.
Below an example output:
root@offbook:~/projects/util-linux/partx# ./partx -a -n 1:5 images-pt/dos+bsd.img
root@offbook:~/projects/util-linux/partx# ls /dev/loop0* -ltr
brw-rw---- 1 root disk 7, 0 2011-08-15 00:07 /dev/loop0
brw-rw---- 1 root disk 7, 5 2011-08-15 00:07 /dev/loop0p5
brw-rw---- 1 root disk 7, 2 2011-08-15 00:07 /dev/loop0p2
brw-rw---- 1 root disk 7, 1 2011-08-15 00:07 /dev/loop0p1
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg(1) incorrectly assumes that lines like "<6>\n"
are broken.
* it's more robust to assume the end of the record is "\n<"
* print \n for empty lines
Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit:
docs: remove duplicated text
docs: require kernel support before accepting use of it
docs: note about independent super block structs
docs: add libmount & libblkid debug instructions
Documentation: add debugging doc
arch: start using arch as a usage() example
docs: new file Documentation/release-schedule.txt
docs: move setuid information from reame to hwclock.8
docs: clean up old readme files
docs: copy contributors from legacy files to AUTHORS
docs: new file Documentation/howto-man-page.txt
docs: new file Documentation/source-code-management.txt
docs: new file Documentation/howto-contribute.txt
docs: new file Documentation/howto-compilation.txt
docs: tell what the Documentation/ is about
docs: add usage() howto for contributors
docs: Documentation directory added
docs: remove README.clear
Duplicate text is dealt by referring to license files. The `pg'
command does not need separated license file because the source
file has same text at top of it.
http://www.spinics.net/lists/util-linux-ng/msg05069.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>