Update to sblim-cmpi-base-1.6.4

This commit is contained in:
Vitezslav Crhonek 2014-10-29 13:14:27 +01:00
parent 84d65d8f93
commit 0a36ad1ddc
5 changed files with 14 additions and 95 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ sblim-cmpi-base-1.5.9.tar.bz2
sblim-cmpi-base-1.6.0.tar.bz2
/sblim-cmpi-base-1.6.1.tar.bz2
/sblim-cmpi-base-1.6.2.tar.bz2
/sblim-cmpi-base-1.6.3.tar.bz2
/sblim-cmpi-base-1.6.4.tar.bz2

View File

@ -1,64 +0,0 @@
diff --git a/OSBase_Processor.c b/OSBase_Processor.c
index 9556a77..bae0e32 100644
--- a/OSBase_Processor.c
+++ b/OSBase_Processor.c
@@ -36,8 +36,9 @@ static int _processor_data( int, struct cim_processor ** );
static unsigned short _processor_family( int );
static unsigned short _processor_load_perc( int );
char * CPUINFO = "/proc/cpuinfo";
+char * CPUMAXFREQ = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq";
//char * CPUINFO = "/home/heidineu/local/sblim/cmpi-base-cpuinfo/x86_ibm_xSeries_2x";
//char * CPUINFO = "/home/heidineu/local/sblim/cmpi-base-cpuinfo/x86_ibm_xSeries_4x";
//char * CPUINFO = "/home/heidineu/local/sblim/cmpi-base-cpuinfo/x86_64_AMD";
@@ -246,8 +247,11 @@ static int _processor_data( int id, struct cim_processor ** sptr ) {
char * ptr = NULL;
int count = 0;
int lines = 0;
int rc = 0;
+ char * maxcpufreq = NULL;
+ unsigned long maxMHz = 0;
+ FILE *fp;
_OSBASE_TRACE(4,("--- _processor_data() called"));
count = id;
@@ -345,8 +349,20 @@ static int _processor_data( int id, struct cim_processor ** sptr ) {
cmd = (char *)malloc((strlen(CPUINFO)+64));
strcpy(cmd, "cat ");
strcat(cmd, CPUINFO);
#if defined (INTEL) || defined (X86_64) || defined (IA64)
+ /* if /sys/devices/system/cpu/cpu(id]/cpufreq/cpuinfo_max_freq exists */
+ /* then calculate MaxClockSpeed from there, otherwise the cpufreq module */
+ /* is not loaded, and /proc/cpuinfo always shows maximum speed */
+ maxcpufreq = malloc((strlen(CPUMAXFREQ)+5));
+ sprintf(maxcpufreq, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", id);
+ if ((fp = fopen(maxcpufreq, "r")) > 0) {
+ if (1 == fscanf(fp, "%lu", &maxMHz)) {
+ maxMHz = maxMHz / 1000;
+ _OSBASE_TRACE(3,("--- _processor_data() maxMHz = %lu", maxMHz));
+ }
+ fclose(fp);
+ }
strcat(cmd, " | grep 'cpu MHz'");
rc = runcommand( cmd, NULL, &hdout, NULL );
#elif defined (S390) || defined (MIPS)
rc = 0; /* clock speed cannot be determined on zSeries or mips */
@@ -379,11 +395,15 @@ static int _processor_data( int id, struct cim_processor ** sptr ) {
ptr = strchr( hdout[id], ':');
#endif
ptr = ptr+1;
(*sptr)->curClockSpeed = atol(ptr);
- (*sptr)->maxClockSpeed = atol(ptr);
+ if (maxMHz > 0)
+ (*sptr)->maxClockSpeed = maxMHz;
+ else
+ (*sptr)->maxClockSpeed = atol(ptr);
}
freeresultbuf(hdout);
+ if (maxcpufreq) free(maxcpufreq);
if(cmd) free(cmd);
_OSBASE_TRACE(4,("--- _processor_data() exited"));
return 0;

View File

@ -1,16 +0,0 @@
diff -up sblim-cmpi-base-1.6.2/OSBase_UnixProcess.c.orig sblim-cmpi-base-1.6.2/OSBase_UnixProcess.c
--- sblim-cmpi-base-1.6.2/OSBase_UnixProcess.c.orig 2013-06-13 14:23:34.386975408 +0200
+++ sblim-cmpi-base-1.6.2/OSBase_UnixProcess.c 2013-06-13 14:24:33.505265610 +0200
@@ -229,9 +229,9 @@ static int _process_data( char * phd , s
strcat( cmd, "/stat");
if ( (fpstat=fopen(cmd,"r")) != NULL ) {
- fscanf(fpstat,"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s "
- "%lld %lld %*s %*s %*s %*s %*s %ld",
- &umtime,&kmtime,&ctime );
+ fscanf(fpstat,"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s "
+ "%lld %lld %*s %*s %*s %*s %*s %*s %ld",
+ &umtime,&kmtime,&ctime );
fclose(fpstat);
(*sptr)->kmtime = kmtime*10;
(*sptr)->umtime = umtime*10;

View File

@ -1,6 +1,6 @@
Name: sblim-cmpi-base
Version: 1.6.2
Release: 10%{?dist}
Version: 1.6.4
Release: 1%{?dist}
Summary: SBLIM CMPI Base Providers
Group: Applications/System
@ -11,14 +11,10 @@ Patch0: sblim-cmpi-base-1.6.0-missing-fclose.patch
Patch1: sblim-cmpi-base-1.6.0-methods-enable.patch
Patch2: sblim-cmpi-base-1.6.0-provider-register-sfcb-init.patch
Patch3: sblim-cmpi-base-1.6.1-double-fclose.patch
# Patch4: already upstream, http://sourceforge.net/p/sblim/bugs/2634/
Patch4: sblim-cmpi-base-1.6.2-max-cpu-frequency.patch
# Patch5: already upstream, http://sourceforge.net/p/sblim/bugs/2644/
Patch5: sblim-cmpi-base-1.6.2-wrong-UserModeTime-and-KernelModeTime.patch
# Patch6: removes version from docdir
Patch6: sblim-cmpi-base-1.6.2-docdir.patch
# Patch7: use Pegasus root/interop instead of root/PG_Interop
Patch7: sblim-cmpi-base-1.6.2-pegasus-interop.patch
# Patch4: removes version from docdir
Patch4: sblim-cmpi-base-1.6.2-docdir.patch
# Patch5: use Pegasus root/interop instead of root/PG_Interop
Patch5: sblim-cmpi-base-1.6.2-pegasus-interop.patch
Requires: cim-server sblim-indication_helper
BuildRequires: sblim-cmpi-devel sblim-indication_helper-devel
BuildRequires: autoconf automake libtool pkgconfig
@ -57,10 +53,8 @@ autoreconf --install --force
%patch1 -p0 -b .methods-enable
%patch2 -p1 -b .provider-register-sfcb-init
%patch3 -p1 -b .double-fclose
%patch4 -p1 -b .cpu-freq
%patch5 -p1 -b .wrong-UserModeTime-and-KernelModeTime
%patch6 -p1 -b .docdir
%patch7 -p1 -b .pegasus-interop
%patch4 -p1 -b .docdir
%patch5 -p1 -b .pegasus-interop
%build
%configure TESTSUITEDIR=%{_datadir}/sblim-testsuite --disable-static
@ -189,6 +183,9 @@ fi
%postun -p /sbin/ldconfig
%changelog
* Wed Oct 29 2014 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.6.4-1
- Update to sblim-cmpi-base-1.6.4
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.2-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

View File

@ -1 +1 @@
b8400a93182d379639d1d552671f24ef sblim-cmpi-base-1.6.2.tar.bz2
3b58e4cba1eb7d3bd691e913f503cd8e sblim-cmpi-base-1.6.4.tar.bz2