From 0c28f0c8151a8ac41e12b672643a5beda82f09b4 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Wed, 22 Jun 2016 09:25:58 +0200 Subject: 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 --- sys-utils/lscpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys-utils/lscpu.c') 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) -- cgit v1.2.3-55-g7522