SHA256
1
0
forked from pool/powertop
OBS User unknown 2007-05-17 09:52:51 +00:00 committed by Git OBS Bridge
parent f2508e7bbf
commit 3a165a3d7b
7 changed files with 94 additions and 119 deletions

View File

@ -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
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba2ca0c84cba1828de28136ec3be526871bb72f18137c9820aaa7bdedb1b76fc
size 14431

View File

@ -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);

View 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];

View File

@ -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
+

View 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

View File

@ -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.
# This file and all modifications and additions to the pristine
@ -13,13 +13,12 @@
Name: powertop
URL: http://www.linuxpowertop.org
Summary: PowerTOP is a Linux tool to find out what is using power on a laptop
Version: 1.0
Release: 2
Version: 1.2
Release: 1
License: GNU General Public License (GPL)
Group: System/Monitoring
Source0: %{name}-%{version}.tar.gz
Patch0: %{name}-respect-rpm-opt-flags-thoenig-01.patch
Patch1: %{name}-fix-compiler-warnings-thoenig-01.patch
Patch0: %{name}-fix-compiler-warnings-thoenig-02.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Autoreqprov: on
@ -35,28 +34,31 @@ Authors:
Arjan van de Ven <arjan@linux.intel.com>
%prep
cp %{S:0} .
tar xfvz %{name}-%{version}.tar.gz
%patch0 -p0
%patch1 -p0
%setup
%patch0 -p0
%build
cd %{name}
CFLAGS="$RPM_OPT_FLAGS" make
%install
mkdir -p %{buildroot}/%{_sbindir}
install -Dm 755 %{name}/%{name} %{buildroot}/%{_sbindir}/%{name}
mkdir -p %{buildroot}/%{_bindir}
make install DESTDIR=%{buildroot}
%clean
rm -rf %{_buildroot}
%files
%defattr(-,root,root)
%doc %{name}/COPYING
%{_sbindir}/%{name}
%doc COPYING
%{_bindir}/%{name}
%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
- Add patch powertop-fix-compiler-warnings-thoenig-01.patch: Make
compiler warnings about unsued parameters and return values not