Skip Menu |

This queue is for tickets about the Sys-CPU CPAN distribution.

Report information
The Basics
Id: 80633
Status: resolved
Priority: 0/
Queue: Sys-CPU

People
Owner: mzsanford [...] cpan.org
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.52

Attachments
0001-Correct-s390-x-preprocessor-tests.patch
Sys-CPU-0.52-Add-support-for-Linux-on-s390.patch



Subject: cpu_type test fails on s390 architecture
cpu_type test fails on s390 architecture because there is different format of /proc/cpuinfo. Attached patch adds support for this architecture when running Linux.
Subject: Sys-CPU-0.52-Add-support-for-Linux-on-s390.patch
From 2c6e746e5e96f7c6c131db7d8f9366ae002a17cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Mon, 5 Nov 2012 11:26:55 +0100 Subject: [PATCH] Add support for Linux on s390 --- CPU.xs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/CPU.xs b/CPU.xs index b77d0c0..564e855 100644 --- a/CPU.xs +++ b/CPU.xs @@ -269,6 +269,17 @@ int proc_cpuinfo_clock (void) { return (0); } +#ifdef __s390__ || __s390x__ +/* Return machine value from s390 processor line, NULL if not found */ +char *processor_machine_field (char *processor) { + char *machine = NULL; + if (NULL == processor) return NULL; + if (NULL != (machine = strstr(processor, "machine = "))) { + machine += 10; + } + return machine; +} +#endif #endif int get_cpu_count() { @@ -354,11 +365,15 @@ SV * cpu_type() CODE: { - char *value = malloc(MAX_IDENT_SIZE); + char *value = NULL; int retcode = 0; #ifdef __linux__ - value = proc_cpuinfo_field ("model name"); +#ifdef __s390__ || __s390x__ + value = processor_machine_field (proc_cpuinfo_field ("processor") ); +#endif + if (!value) value = proc_cpuinfo_field ("model name"); if (!value) value = proc_cpuinfo_field ("machine"); + if (!value) value = proc_cpuinfo_field ("vendor_id"); #endif #ifdef WINDOWS retcode = GetSysInfoKey("Identifier",value); -- 1.7.11.7
Pushed the fix to a new git repository at https://github.com/mzsanford/perl-sys-cpu. Please clone and test that if you have a moment. I'll work on releasing a new version once I can sort our the PAUSE ownership.
Subject: Re: [rt.cpan.org #80633] cpu_type test fails on s390 architecture
Date: Thu, 8 Nov 2012 09:34:53 +0100
To: Matt Sanford via RT <bug-Sys-CPU [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Wed, Nov 07, 2012 at 03:06:38PM -0500, Matt Sanford via RT wrote: Show quoted text
> Pushed the fix to a new git repository at > https://github.com/mzsanford/perl-sys-cpu. Please clone and test that if you > have a moment. I'll work on releasing a new version once I can sort our the > PAUSE ownership.
I verified it works on s390(x) and other architectures. I spotted a few compiler warnings. Two of them are related to my patch and could cause unintended behaviour: CPU.xs:272:17: warning: extra tokens at end of #ifdef directive [enabled by default] CPU.xs:375:17: warning: extra tokens at end of #ifdef directive [enabled by default] They should be fixed by attached patch. The rest of them will submitted into separate report. -- Petr

Message body is not shown because sender requested not to inline it.

Download (untitled)
application/pgp-signature 230b

Message body not shown because it is not plain text.

Changes all merged into 0.54