Since the range of the ino_t data type is platform-specific (depending on
the wordsize), a usage of the fixed format specifier %PRIu64 is not correct
for ino_t on some 32-bit architectures, eg. ARM (Raspberry Pi 1). This issue
may lead to undefinied output and is not reported by gcc (in version 10.2.0
and 8.3.0-6+rpi1) even though -Wformat is enabled by -Wall. Therefore it is
most likely that it seems to be a false negative error in gcc's format
specifier check, so that this issue was never detected before.
This change fixes the issue by the use of a cast, since there is no
platform-independent format specifier for ino_t available. The wrong format
specifier %PRIu64 is replaced by %ju, where its corresponding variable of
type ino_t is casted to uintmax_t. The type uintmax_t represents the largest
platform-specific unsigned integer, so that all integer values are preserved
for a platform-independent printing.
Fixes: https://github.com/karelzak/util-linux/issues/1211
Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
The shells are very restrictive about variable names, only [:alnum:]
chars are allowed (and alphabetic chars as the first char). The
library will replace "bad" chars with "_". The char '%' at the end is
replaced by _PCT.
Addresses: https://github.com/karelzak/util-linux/issues/1201
Signed-off-by: Karel Zak <kzak@redhat.com>
The initial change to lib/caputils that allowed this was commit
5d95818757, which made it possible to
trust the value returned by cap_last_cap().
The error message was also somewhat misleading, since cap_last_cap()
being smaller than CAP_LAST_CAP happens when setpriv itself is built
with kernel headers older than the currently running kernel, not due to
libcap-ng.
- Add _() calls for some strings which were missing it.
- In print_caps(), use the same error checking done in
list_known_caps(); it is expected that libcap-ng will always return a
string, even if it's only "cap_%d".
* w45:
fdformat: remove command from default build
more: improve error messaging when input file is directory
ul: make set_column() zero check more obvious
colrm: fix argument parsing
rfkill: stop execution when rfkill device cannot be opened
cifuzz: reindent yaml file
man: make tilde and caret characters to render correctly
Show the number of the number of physical socket even if the sysfs doesn't
have the physical socket information.
Note, lscpu shows the number of physical socket as 'Socket(s):' only if
root user runs it because accessing the DMI table requires root
privilege.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Add a helper function, get_number_of_physical_sockets_from_dmi(),
to get physical sockets from DMI table in case of the sysfs for
cpu topology doesn't have the physical socket information.
get_number_of_physical_sockets_from_dmi() parse the DMI table
and counts the number of SMBIOS Processor Information (Type04)
structure.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
lscpu may show the wrong number of sockets if the machine is aarch64 and
doesn't have ACPI PPTT.
That's because lscpu shows the number of sockets by using a sysfs entry
(cpu/cpuX/topology/core_siblings). The sysfs entry is set by MPIDR_EL1
register if the machine doesn't have ACPI PPTT. MPIDR_EL1 doesn't show
the physical socket information directly. It shows the affinity level.
According to linux/arch/arm64/kernel/topology.c:store_cpu_topology(),
the top level of affinity is called as 'Cluster'.
Use Cluster instead of Socket on the machine which doesn't have ACPI PPTT.
This patch is useful for aarch64 machine which is based on ARM
SBBR v1.0 and v1.1, the specs don't require ACPI PPTT. ARM SBBR v1.2
requires ACPI PPTT.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
It seems better to ignore this option than drop-permissions and later
exit with EPERMs. This change makes umount(8) more compatible with
fuser user umounts by systemd where -c is used to reduce overhead etc.
Addresses: https://github.com/karelzak/util-linux/issues/1192
Signed-off-by: Karel Zak <kzak@redhat.com>
Without this two error messages are printed when rfkill device
cannot be opened.
$ rfkill
rfkill: cannot open /dev/rfkill: No such file or directory
rfkill: cannot read /dev/rfkill: Bad file descriptor
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
As mentioned in 'Generating optimal glyphs' title in the manual page
mentioned in reference:
Where a proper caret (^) that renders well in both a terminal and PDF is
required, use "\(ha".
Using a naked "~" character results in a poor rendering in PDF. Instead
use "\(ti".
Reference: https://man7.org/linux/man-pages/man7/man-pages.7.html#STYLE_GUIDE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
After commit: 367c85c47 ("lscpu: use SMBIOS tables on ARM for lscpu"),
Model name for A64FX shows like as:
Model name: 461F0010
That's because 367c85c47 changes to get the modelname from Processor
Version of SMBIOS.
To fix that, use the hard corded table to show the "Model name" and
add two new lines; "BIOS Vendor ID" and "BIOS Model name" to show the
SMBIOS information.
lscpu shows the SMBIOS information when root user runs it because
accessing the SMBIOS information requires root privilege.
[kzak@redhat.com: - port the patch to new lscpu code]
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Over the past two years Arm has published further MIDR/part numbers
on https://developer.arm.com/ip-products/processors/cortex-a.
Lets sync the arm_part structure for A65, A76AE, A77 and A78*.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Port commit
commit 6cb8af7be2
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date: Sat Mar 28 12:19:42 2020 +0800
to new lscpu code.
References: 6cb8af7be2
Signed-off-by: Karel Zak <kzak@redhat.com>
Port commit
commit 318542e060
Author: Sumanth Korikkar <sumanthk@linux.ibm.com>
Date: Fri Jun 5 18:15:10 2020 +0200
to new lscpu code.
References: 318542e060
Signed-off-by: Karel Zak <kzak@redhat.com>
ntypes greater than 1 is valid in some hardware configurations, and an assert()
on the value isn't necessary or very future proof
[kzak@redhat.com: - port this patch to new code]
Signed-off-by: Karel Zak <kzak@redhat.com>
* keep global (cputype) bogomips
* add per-CPU bogomips
* use bogomips from the first CPU as global (for cputype) if /proc/cpuinfo does not provide global bogomips
* add BOGOMIPS column for to -e/-p output
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's make it more robust and readable. The sysinfo file on s390 may
contain zeros, so we need to check the values and fallback to data
from shared maps if necessary.
Signed-off-by: Karel Zak <kzak@redhat.com>
Note that cxt->ncaches is number of all instances, but we split
output according to split output according to caches names.
Signed-off-by: Karel Zak <kzak@redhat.com>
The file /sys/devices/system/cpu/cpu*/cache/index*/id is not available
in old kernels. This patch add code to generate IDs according to cache
type and level.
Signed-off-by: Karel Zak <kzak@redhat.com>
* keep one sharedmap per cache instance
* initialize topology IDs to -1
* rewrite -e code to use a new data structs
Signed-off-by: Karel Zak <kzak@redhat.com>
The Dynamic and Static MHz are /proc/cpuinfo s390 per-CPU fields, but
we display it as a single value according the first parsed CPU. For
this purpose we store the values from the first CPU in lscpu_cputype.
For -p and -e outputs we will print per CPU values.
Signed-off-by: Karel Zak <kzak@redhat.com>