summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorHeiko Carstens2016-06-22 09:25:58 +0200
committerKarel Zak2016-06-24 10:54:09 +0200
commit0c28f0c8151a8ac41e12b672643a5beda82f09b4 (patch)
tree06249af8595428b56abb07b3836b10580d6dd5bc /sys-utils/lscpu.c
parentlscpu: show static and dynamic MHz (s390) (diff)
downloadkernel-qcow2-util-linux-0c28f0c8151a8ac41e12b672643a5beda82f09b4.tar.gz
kernel-qcow2-util-linux-0c28f0c8151a8ac41e12b672643a5beda82f09b4.tar.xz
kernel-qcow2-util-linux-0c28f0c8151a8ac41e12b672643a5beda82f09b4.zip
lscpu: show machine type (s390)
Show also the machine type within the lscpu output. With the machine type it is possible to identify the cpu generation and the supported features. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 9b87e0431..883dff68b 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -198,6 +198,7 @@ struct polarization_modes polar_modes[] = {
struct lscpu_desc {
char *arch;
char *vendor;
+ char *machinetype; /* s390 */
char *family;
char *model;
char *modelname;
@@ -581,6 +582,15 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
if (mod->system == SYSTEM_LIVE)
read_physical_info_powerpc(desc);
+
+ if (path_exist(_PATH_PROC_SYSINFO)) {
+ FILE *fd = path_fopen("r", 0, _PATH_PROC_SYSINFO);
+
+ while (fd && fgets(buf, sizeof(buf), fd) != NULL && !desc->machinetype)
+ lookup(buf, "Type", &desc->machinetype);
+ if (fd)
+ fclose(fd);
+ }
}
static int
@@ -1712,6 +1722,8 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
print_n(_("NUMA node(s):"), desc->nnodes);
if (desc->vendor)
print_s(_("Vendor ID:"), desc->vendor);
+ if (desc->machinetype)
+ print_s(_("Machine type:"), desc->machinetype);
if (desc->family)
print_s(_("CPU family:"), desc->family);
if (desc->model || desc->revision)