]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: show machine type (s390)
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Wed, 22 Jun 2016 07:25:58 +0000 (09:25 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 24 Jun 2016 08:54:09 +0000 (10:54 +0200)
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>
sys-utils/lscpu.c
tests/expected/lscpu/lscpu-s390-kvm
tests/expected/lscpu/lscpu-s390-lpar
tests/expected/lscpu/lscpu-s390-lpar-drawer
tests/expected/lscpu/lscpu-s390-zvm

index 9b87e0431bac38100b87a222859ba9bbc92f42f4..883dff68bb8547dc9c9a1957f416f91c9bcea1c5 100644 (file)
@@ -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)
index 9632b055aef382f8b74316a0346a65dd3b62e81d..66d1c047c59c577f0f068d5cfdcff37175a81768 100644 (file)
@@ -6,6 +6,7 @@ Core(s) per socket:    1
 Socket(s) per book:    1
 Book(s):               3
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            KVM/Linux
 Hypervisor vendor:     KVM
index a4265667f51d80e44623181e6cc33d3e292e041f..9c8ac2c4f8dd2b2f5e464908c9f51318d9619f78 100644 (file)
@@ -7,6 +7,7 @@ Core(s) per socket:    4
 Socket(s) per book:    6
 Book(s):               4
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            PR/SM
 Hypervisor vendor:     IBM
index 88fe1009ea0a322a2beadc66a34d7d28fbf65a61..587e7a6ed18de664db7ede26e5c81639793702d3 100644 (file)
@@ -8,6 +8,7 @@ Book(s) per drawer:    2
 Drawer(s):             4
 NUMA node(s):          1
 Vendor ID:             IBM/S390
+Machine type:          2964
 Model name:            0
 CPU dynamic MHz:       5000
 CPU static MHz:        5000
index 6cf24bf867c00f63239b5e32039451bfb57b30e4..4cd6b8fa0fc17e521a66f63fc37d74bddf234c69 100644 (file)
@@ -6,6 +6,7 @@ Core(s) per socket:    1
 Socket(s) per book:    1
 Book(s):               4
 Vendor ID:             IBM/S390
+Machine type:          2817
 BogoMIPS:              14367.00
 Hypervisor:            z/VM 6.1.0
 Hypervisor vendor:     IBM