forked from pool/powertop
This commit is contained in:
parent
f2508e7bbf
commit
3a165a3d7b
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:1fa5cf41a8333ff9b060f28c1291657d1527b5efc45f951e2600c3175f035922
|
|
||||||
size 11386
|
|
3
powertop-1.2.tar.gz
Normal file
3
powertop-1.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ba2ca0c84cba1828de28136ec3be526871bb72f18137c9820aaa7bdedb1b76fc
|
||||||
|
size 14431
|
@ -1,85 +0,0 @@
|
|||||||
--- powertop/powertop.c 2007-05-11 21:28:43.000000000 +0200
|
|
||||||
+++ powertop/powertop.c 2007-05-13 17:19:00.000000000 +0200
|
|
||||||
@@ -128,7 +128,8 @@
|
|
||||||
int nr = -1;
|
|
||||||
uint64_t count = 0;
|
|
||||||
memset(line,0,sizeof(line));
|
|
||||||
- fgets(line, 1024, file);
|
|
||||||
+ if (fgets(line, 1024, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
c = strchr(line, ':');
|
|
||||||
if (!c)
|
|
||||||
continue;
|
|
||||||
@@ -189,7 +190,8 @@
|
|
||||||
|
|
||||||
while (!feof(file)) {
|
|
||||||
memset(line, 0, 4096);
|
|
||||||
- fgets(line, 4096, file);
|
|
||||||
+ if (fgets(line, 4096, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
c = strstr(line, "age[");
|
|
||||||
if (!c)
|
|
||||||
continue;
|
|
||||||
@@ -294,7 +296,8 @@
|
|
||||||
char line[1024];
|
|
||||||
char *c;
|
|
||||||
int dontcount = 0;
|
|
||||||
- fgets(line, 1024, file);
|
|
||||||
+ if (fgets(line, 1024, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
if (strstr(line, "present:") && strstr(line,"no"))
|
|
||||||
break;
|
|
||||||
|
|
||||||
@@ -320,7 +323,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-int main(int argc, char **argv)
|
|
||||||
+int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
char line[1024];
|
|
||||||
FILE *file = NULL;
|
|
||||||
@@ -392,7 +395,8 @@
|
|
||||||
while (file && !feof(file) && i<190) {
|
|
||||||
char *count, *pid, *process, *func;
|
|
||||||
int cnt;
|
|
||||||
- fgets(line, 1024, file);
|
|
||||||
+ if (fgets(line, 1024, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
if (strstr(line, "total events"))
|
|
||||||
break;
|
|
||||||
c = count = & line[0];
|
|
||||||
--- powertop/config.c 2007-05-11 21:28:39.000000000 +0200
|
|
||||||
+++ powertop/config.c 2007-05-13 17:22:57.000000000 +0200
|
|
||||||
@@ -47,7 +47,8 @@
|
|
||||||
file = popen("zcat /proc/config.gz","r");
|
|
||||||
while (file && !feof(file)) {
|
|
||||||
char line[100];
|
|
||||||
- fgets(line, 100, file);
|
|
||||||
+ if (fgets(line, 100, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
strcpy(configlines[configcount++], line);
|
|
||||||
}
|
|
||||||
pclose(file);
|
|
||||||
@@ -56,7 +57,10 @@
|
|
||||||
file = fopen("/proc/sys/kernel/osrelease","r");
|
|
||||||
if (!file)
|
|
||||||
return;
|
|
||||||
- fgets(version, 100, file);
|
|
||||||
+ if (fgets(version, 100, file) == NULL) {
|
|
||||||
+ fclose(file);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
fclose(file);
|
|
||||||
c = strchr(version, '\n');
|
|
||||||
if (c) *c=0;
|
|
||||||
@@ -66,7 +70,8 @@
|
|
||||||
return;
|
|
||||||
while (!feof(file)) {
|
|
||||||
char line[100];
|
|
||||||
- fgets(line, 100, file);
|
|
||||||
+ if (fgets(line, 100, file) == NULL)
|
|
||||||
+ break;
|
|
||||||
strcpy(configlines[configcount++], line);
|
|
||||||
}
|
|
||||||
fclose(file);
|
|
66
powertop-fix-compiler-warnings-thoenig-02.patch
Normal file
66
powertop-fix-compiler-warnings-thoenig-02.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
--- config.c 2007-05-13 19:22:30.000000000 +0200
|
||||||
|
+++ config.c 2007-05-15 10:16:16.000000000 +0200
|
||||||
|
@@ -47,7 +47,8 @@
|
||||||
|
file = popen("zcat /proc/config.gz", "r");
|
||||||
|
while (file && !feof(file)) {
|
||||||
|
char line[100];
|
||||||
|
- fgets(line, 100, file);
|
||||||
|
+ if (fgets(line, 100, file) == NULL)
|
||||||
|
+ break;
|
||||||
|
strcpy(configlines[configcount++], line);
|
||||||
|
}
|
||||||
|
pclose(file);
|
||||||
|
@@ -56,7 +57,10 @@
|
||||||
|
file = fopen("/proc/sys/kernel/osrelease", "r");
|
||||||
|
if (!file)
|
||||||
|
return;
|
||||||
|
- fgets(version, 100, file);
|
||||||
|
+ if (fgets(version, 100, file) == NULL) {
|
||||||
|
+ fclose(file);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
fclose(file);
|
||||||
|
c = strchr(version, '\n');
|
||||||
|
if (c)
|
||||||
|
@@ -71,7 +75,8 @@
|
||||||
|
return;
|
||||||
|
while (!feof(file)) {
|
||||||
|
char line[100];
|
||||||
|
- fgets(line, 100, file);
|
||||||
|
+ if (fgets(line, 100, file) == NULL)
|
||||||
|
+ break;
|
||||||
|
strcpy(configlines[configcount++], line);
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
--- powertop.c 2007-05-15 01:41:30.000000000 +0200
|
||||||
|
+++ powertop.c 2007-05-15 10:14:48.000000000 +0200
|
||||||
|
@@ -135,7 +135,8 @@
|
||||||
|
int nr = -1;
|
||||||
|
uint64_t count = 0;
|
||||||
|
memset(line, 0, sizeof(line));
|
||||||
|
- fgets(line, 1024, file);
|
||||||
|
+ if (fgets(line, 1024, file) == NULL)
|
||||||
|
+ break;
|
||||||
|
c = strchr(line, ':');
|
||||||
|
if (!c)
|
||||||
|
continue;
|
||||||
|
@@ -199,7 +200,8 @@
|
||||||
|
|
||||||
|
while (!feof(file)) {
|
||||||
|
memset(line, 0, 4096);
|
||||||
|
- fgets(line, 4096, file);
|
||||||
|
+ if (fgets(line, 4096, file) == NULL)
|
||||||
|
+ break;
|
||||||
|
c = strstr(line, "age[");
|
||||||
|
if (!c)
|
||||||
|
continue;
|
||||||
|
@@ -420,7 +422,8 @@
|
||||||
|
while (file && !feof(file)) {
|
||||||
|
char *count, *pid, *process, *func;
|
||||||
|
int cnt;
|
||||||
|
- fgets(line, 1024, file);
|
||||||
|
+ if (fgets(line, 1024, file) == NULL)
|
||||||
|
+ break;
|
||||||
|
if (strstr(line, "total events"))
|
||||||
|
break;
|
||||||
|
c = count = &line[0];
|
@ -1,17 +0,0 @@
|
|||||||
--- powertop/Makefile 2007-05-11 21:27:34.000000000 +0200
|
|
||||||
+++ powertop/Makefile 2007-05-13 14:47:55.000000000 +0200
|
|
||||||
@@ -1,11 +1,11 @@
|
|
||||||
BINDIR=/usr/bin
|
|
||||||
|
|
||||||
powertop: powertop.c config.c Makefile
|
|
||||||
- gcc -Wall -W -O1 -g powertop.c config.c -o powertop
|
|
||||||
+ gcc ${CFLAGS} -Wall -W -O1 -g powertop.c config.c -o powertop
|
|
||||||
|
|
||||||
install: powertop
|
|
||||||
cp powertop ${BINDIR}
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *~ powertop
|
|
||||||
-
|
|
||||||
\ No newline at end of file
|
|
||||||
+
|
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue May 15 10:24:55 CEST 2007 - thoenig@suse.de
|
||||||
|
|
||||||
|
- Update to PowerTOP 1.2 (skipped 1.1)
|
||||||
|
- Fix battery code to work with both, mA and mW
|
||||||
|
- Clean up spec file
|
||||||
|
- Update patch powertop-fix-compiler-warnings-thoenig-02.patch
|
||||||
|
- Drop patch powertop-respect-rpm-opt-flags-thoenig-01.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun May 13 17:09:11 CEST 2007 - thoenig@suse.de
|
Sun May 13 17:09:11 CEST 2007 - thoenig@suse.de
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package powertop (Version 1.0)
|
# spec file for package powertop (Version 1.2)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
# This file and all modifications and additions to the pristine
|
||||||
@ -13,13 +13,12 @@
|
|||||||
Name: powertop
|
Name: powertop
|
||||||
URL: http://www.linuxpowertop.org
|
URL: http://www.linuxpowertop.org
|
||||||
Summary: PowerTOP is a Linux tool to find out what is using power on a laptop
|
Summary: PowerTOP is a Linux tool to find out what is using power on a laptop
|
||||||
Version: 1.0
|
Version: 1.2
|
||||||
Release: 2
|
Release: 1
|
||||||
License: GNU General Public License (GPL)
|
License: GNU General Public License (GPL)
|
||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0: %{name}-respect-rpm-opt-flags-thoenig-01.patch
|
Patch0: %{name}-fix-compiler-warnings-thoenig-02.patch
|
||||||
Patch1: %{name}-fix-compiler-warnings-thoenig-01.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Autoreqprov: on
|
Autoreqprov: on
|
||||||
|
|
||||||
@ -35,28 +34,31 @@ Authors:
|
|||||||
Arjan van de Ven <arjan@linux.intel.com>
|
Arjan van de Ven <arjan@linux.intel.com>
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
cp %{S:0} .
|
%setup
|
||||||
tar xfvz %{name}-%{version}.tar.gz
|
%patch0 -p0
|
||||||
%patch0 -p0
|
|
||||||
%patch1 -p0
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cd %{name}
|
|
||||||
CFLAGS="$RPM_OPT_FLAGS" make
|
CFLAGS="$RPM_OPT_FLAGS" make
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}/%{_sbindir}
|
mkdir -p %{buildroot}/%{_bindir}
|
||||||
install -Dm 755 %{name}/%{name} %{buildroot}/%{_sbindir}/%{name}
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf %{_buildroot}
|
rm -rf %{_buildroot}
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc %{name}/COPYING
|
%doc COPYING
|
||||||
%{_sbindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 15 2007 - thoenig@suse.de
|
||||||
|
- Update to PowerTOP 1.2 (skipped 1.1)
|
||||||
|
- Fix battery code to work with both, mA and mW
|
||||||
|
- Clean up spec file
|
||||||
|
- Update patch powertop-fix-compiler-warnings-thoenig-02.patch
|
||||||
|
- Drop patch powertop-respect-rpm-opt-flags-thoenig-01.patch
|
||||||
* Sun May 13 2007 - thoenig@suse.de
|
* Sun May 13 2007 - thoenig@suse.de
|
||||||
- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make
|
- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make
|
||||||
compiler warnings about unsued parameters and return values not
|
compiler warnings about unsued parameters and return values not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user