Add support for s390
This commit is contained in:
parent
300478244f
commit
0a919ed7c2
52
Sys-CPU-0.52-Add-support-for-Linux-on-s390.patch
Normal file
52
Sys-CPU-0.52-Add-support-for-Linux-on-s390.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
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
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
Name: perl-Sys-CPU
|
Name: perl-Sys-CPU
|
||||||
Version: 0.52
|
Version: 0.52
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Getting CPU information
|
Summary: Getting CPU information
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
# Some code was copied from Unix::Processors, which is LGPLv3 or Artistic 2.0
|
# Some code was copied from Unix::Processors, which is LGPLv3 or Artistic 2.0
|
||||||
@ -9,6 +9,8 @@ Group: Development/Libraries
|
|||||||
License: (GPL+ or Artistic) and (LGPLv3 or Artistic 2.0)
|
License: (GPL+ or Artistic) and (LGPLv3 or Artistic 2.0)
|
||||||
URL: http://search.cpan.org/~mkoderer/Sys-CPU/
|
URL: http://search.cpan.org/~mkoderer/Sys-CPU/
|
||||||
Source0: http://search.cpan.org/CPAN/authors/id/M/MK/MKODERER/Sys-CPU-%{version}.tar.gz
|
Source0: http://search.cpan.org/CPAN/authors/id/M/MK/MKODERER/Sys-CPU-%{version}.tar.gz
|
||||||
|
# Support for s390, CPAN RT #80633
|
||||||
|
Patch0: Sys-CPU-0.52-Add-support-for-Linux-on-s390.patch
|
||||||
BuildRequires: perl(ExtUtils::MakeMaker)
|
BuildRequires: perl(ExtUtils::MakeMaker)
|
||||||
# Run-time:
|
# Run-time:
|
||||||
BuildRequires: perl(DynaLoader)
|
BuildRequires: perl(DynaLoader)
|
||||||
@ -23,6 +25,7 @@ Currently only number of CPU's supported.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n Sys-CPU-%{version}
|
%setup -q -n Sys-CPU-%{version}
|
||||||
|
%patch0 -p1
|
||||||
sed -i 's/\r//' Changes README
|
sed -i 's/\r//' Changes README
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -46,6 +49,9 @@ find %{buildroot} -type f -name CPU.bs -exec rm -f {} ';'
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 05 2012 Petr Pisar <ppisar@redhat.com> - 0.52-2
|
||||||
|
- Add support for s390 (CPAN RT #80633)
|
||||||
|
|
||||||
* Fri Nov 02 2012 Petr Pisar <ppisar@redhat.com> - 0.52-1
|
* Fri Nov 02 2012 Petr Pisar <ppisar@redhat.com> - 0.52-1
|
||||||
- 0.52 bump
|
- 0.52 bump
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user