Unlimit FDs (by unlimit-fds patch) and dropped the fd-limit-err patch

This commit is contained in:
Jaroslav Škarvada 2013-09-20 10:59:20 +02:00
parent c68c6110a4
commit 3c2a36679c
2 changed files with 7 additions and 42 deletions

View File

@ -1,38 +0,0 @@
diff -up powertop-2.4/src/perf/perf.cpp.orig powertop-2.4/src/perf/perf.cpp
--- powertop-2.4/src/perf/perf.cpp.orig 2013-01-31 16:39:27.000000000 -0500
+++ powertop-2.4/src/perf/perf.cpp 2013-09-19 10:36:02.298839248 -0400
@@ -26,6 +26,7 @@
#include <iostream>
#include <fstream>
+#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -72,6 +73,7 @@ void perf_event::create_perf_event(char
{
struct perf_event_attr attr;
int ret;
+ int err;
struct {
__u64 count;
@@ -107,10 +109,15 @@ void perf_event::create_perf_event(char
perf_fd = sys_perf_event_open(&attr, -1, _cpu, -1, 0);
if (perf_fd < 0) {
+ err = errno;
reset_display();
- fprintf(stderr, _("PowerTOP %s needs the kernel to support the 'perf' subsystem\n"), POWERTOP_VERSION);
- fprintf(stderr, _("as well as support for trace points in the kernel:\n"));
- fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n");
+ if (err == EMFILE)
+ fprintf(stderr, _("Too many open files, please increase the limit of open file descriptors.\n"));
+ else {
+ fprintf(stderr, _("PowerTOP %s needs the kernel to support the 'perf' subsystem\n"), POWERTOP_VERSION);
+ fprintf(stderr, _("as well as support for trace points in the kernel:\n"));
+ fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n");
+ }
exit(EXIT_FAILURE);
}
if (read(perf_fd, &read_data, sizeof(read_data)) == -1) {

View File

@ -1,6 +1,6 @@
Name: powertop
Version: 2.4
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Power consumption monitor
Group: Applications/System
@ -14,8 +14,8 @@ Patch0: powertop-2.3-always-create-params.patch
Patch1: powertop-2.3-man-fix.patch
# Sent upstream (http://github.com/fenrus75/powertop/pull/12)
Patch2: powertop-2.3-ondemand-check.patch
# Sent upstream (http://github.com/fenrus75/powertop/pull/14)
Patch3: powertop-2.4-fd-limit-err.patch
# Accepted upstream
Patch3: powertop-2.4-unlimit-fds.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel
Requires(post): coreutils
@ -29,7 +29,7 @@ computer use more power than necessary while it is idle.
%patch0 -p1 -b .always-create-params
%patch1 -p1 -b .man-fix
%patch2 -p1 -b .ondemand-check
%patch3 -p1 -b .fd-limit-err
%patch3 -p1 -b .unlimit-fds
# remove left over object files
find . -name "*.o" -exec rm {} \;
@ -62,6 +62,9 @@ rm -rf %{buildroot}
%{_mandir}/man8/powertop.8*
%changelog
* Fri Sep 20 2013 Jaroslav Škarvada <jskarvad@redhat.com> - 2.4-4
- Unlimit FDs (by unlimit-fds patch) and dropped the fd-limit-err patch
* Thu Sep 19 2013 Jaroslav Škarvada <jskarvad@redhat.com> - 2.4-3
- Printed friendly error message if the system is running out
of FDs (by fd-limit-err patch)