From 19e2b417bdbec4719b041f12a66e44a882567378 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Sat, 5 May 2012 20:12:05 +0000 Subject: [PATCH] - up to 1.0.3 Changed files: irqbalance-cputree-parse.patch -> 1.2 irqbalance-opt.patch -> 1.4 irqbalance-pie.patch -> 1.5 irqbalance.spec -> 1.31 --- irqbalance-cputree-parse.patch | 146 --------------------------------- irqbalance-opt.patch | 20 ----- irqbalance-pie.patch | 20 ----- irqbalance.spec | 31 ++++--- 4 files changed, 14 insertions(+), 203 deletions(-) delete mode 100644 irqbalance-cputree-parse.patch delete mode 100644 irqbalance-opt.patch delete mode 100644 irqbalance-pie.patch diff --git a/irqbalance-cputree-parse.patch b/irqbalance-cputree-parse.patch deleted file mode 100644 index 6ae74b7..0000000 --- a/irqbalance-cputree-parse.patch +++ /dev/null @@ -1,146 +0,0 @@ -diff -up irqbalance-0.55/irqbalance-0.55/cputree.c.orig irqbalance-0.55/irqbalance-0.55/cputree.c ---- irqbalance-0.55/irqbalance-0.55/cputree.c.orig 2006-12-10 15:04:59.000000000 -0500 -+++ irqbalance-0.55/irqbalance-0.55/cputree.c 2007-09-28 12:43:35.000000000 -0400 -@@ -26,6 +26,8 @@ - - #define _GNU_SOURCE - -+#include -+#include - #include - #include - #include -@@ -131,34 +133,30 @@ static void fill_cache_domain(void) - } - - --static void do_one_cpu(char *path) -+static void do_one_cpu(int dfd, char *d_name) - { - struct cpu_core *cpu; - FILE *file; - char new_path[PATH_MAX]; - - /* skip offline cpus */ -- snprintf(new_path, PATH_MAX, "%s/online", path); -- file = fopen(new_path, "r"); -- if (file) { -- char *line = NULL; -- size_t size = 0; -- if (getline(&line, &size, file)==0) -+ snprintf(new_path, PATH_MAX, "%s/online", d_name); -+ int fd = openat(dfd, new_path, O_RDONLY); -+ if (fd != -1) { -+ char buf[1]; -+ ssize_t n = read(fd, buf, sizeof(buf)); -+ close(fd); -+ if (n != sizeof(buf)) - return; -- fclose(file); -- if (line && line[0]=='0') { -- free(line); -+ if (buf[0] == '0') - return; -- } -- free(line); - } - -- cpu = malloc(sizeof(struct cpu_core)); -+ cpu = calloc(1, sizeof(struct cpu_core)); - if (!cpu) - return; -- memset(cpu, 0, sizeof(struct cpu_core)); - -- cpu->number = strtoul(&path[27], NULL, 10); -+ cpu->number = strtoul(&d_name[3], NULL, 10); - - cpu_set(cpu->number, cpu->mask); - -@@ -170,43 +168,45 @@ static void do_one_cpu(char *path) - return; - } - -+ char *line = NULL; -+ size_t size = 0; - - /* try to read the package mask; if it doesn't exist assume solitary */ -- snprintf(new_path, PATH_MAX, "%s/topology/core_siblings", path); -- file = fopen(new_path, "r"); -+ snprintf(new_path, PATH_MAX, "%s/topology/core_siblings", d_name); -+ fd = openat(dfd, new_path, O_RDONLY); -+ file = fd == -1 ? NULL : fdopen(fd, "r"); - cpu_set(cpu->number, cpu->package_mask); - if (file) { -- char *line = NULL; -- size_t size = 0; - if (getline(&line, &size, file)) - cpumask_parse_user(line, strlen(line), cpu->package_mask); - fclose(file); -- free(line); -- } -+ } else if (fd != -1) -+ close(fd); - - /* try to read the cache mask; if it doesn't exist assume solitary */ - /* We want the deepest cache level available so try index1 first, then index2 */ - cpu_set(cpu->number, cpu->cache_mask); -- snprintf(new_path, PATH_MAX, "%s/cache/index1/shared_cpu_map", path); -- file = fopen(new_path, "r"); -+ snprintf(new_path, PATH_MAX, "%s/cache/index1/shared_cpu_map", d_name); -+ fd = openat(dfd, new_path, O_RDONLY); -+ file = fd == -1 ? NULL : fdopen(fd, "r"); - if (file) { -- char *line = NULL; -- size_t size = 0; - if (getline(&line, &size, file)) - cpumask_parse_user(line, strlen(line), cpu->cache_mask); - fclose(file); -- free(line); -- } -- snprintf(new_path, PATH_MAX, "%s/cache/index2/shared_cpu_map", path); -- file = fopen(new_path, "r"); -+ } else if (fd != -1) -+ close(fd); -+ -+ snprintf(new_path, PATH_MAX, "%s/cache/index2/shared_cpu_map", d_name); -+ fd = openat(dfd, new_path, O_RDONLY); -+ file = fd == -1 ? NULL : fdopen(fd, "r"); - if (file) { -- char *line = NULL; -- size_t size = 0; - if (getline(&line, &size, file)) - cpumask_parse_user(line, strlen(line), cpu->cache_mask); - fclose(file); -- free(line); -- } -+ } else if (fd != -1) -+ close(fd); -+ -+ free(line); - - /* - blank out the banned cpus from the various masks so that interrupts -@@ -311,18 +311,19 @@ void parse_cpu_tree(void) - { - DIR *dir; - struct dirent *entry; -+ int dfd; - - cpus_complement(unbanned_cpus, banned_cpus); - - dir = opendir("/sys/devices/system/cpu"); - if (!dir) - return; -+ dfd = dirfd(dir); - do { - entry = readdir(dir); -- if (entry && strlen(entry->d_name)>3 && strstr(entry->d_name,"cpu")) { -- char new_path[PATH_MAX]; -- sprintf(new_path, "/sys/devices/system/cpu/%s", entry->d_name); -- do_one_cpu(new_path); -+ if (entry && strlen(entry->d_name)>3 && memcmp(entry->d_name,"cpu",3) == 0 -+ && isdigit(entry->d_name[3])) { -+ do_one_cpu(dfd, entry->d_name); - } - } while (entry); - closedir(dir); diff --git a/irqbalance-opt.patch b/irqbalance-opt.patch deleted file mode 100644 index 3cddfc1..0000000 --- a/irqbalance-opt.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -urN irqbalance-0.55.org/Makefile irqbalance-0.55/Makefile ---- irqbalance-0.55.org/Makefile 2006-12-05 14:15:23.000000000 +0100 -+++ irqbalance-0.55/Makefile 2006-12-13 17:55:44.632291750 +0100 -@@ -1,11 +1,14 @@ --CFLAGS+=-g -Os -D_FORTIFY_SOURCE=2 -Wall -W `pkg-config --cflags glib-2.0` -+ -+OPT=-g -Os -+ -+CFLAGS = $(OPT) -D_FORTIFY_SOURCE=2 -Wall -W `pkg-config --cflags glib-2.0` - - all: irqbalance - - LIBS=bitmap.o irqbalance.o cputree.o procinterrupts.o irqlist.o placement.o activate.o network.o powermode.o numa.o classify.o - - irqbalance: .depend $(LIBS) -- gcc -g -O2 -D_FORTIFY_SOURCE=2 -Wall `pkg-config --libs glib-2.0` $(LIBS) -o irqbalance -+ $(CC) $(CFLAGS) $(LDFLAGS) -D_FORTIFY_SOURCE=2 -Wall $(LIBS) `pkg-config --libs glib-2.0` -o irqbalance - - clean: - rm -f irqbalance *~ *.o .depend diff --git a/irqbalance-pie.patch b/irqbalance-pie.patch deleted file mode 100644 index b157272..0000000 --- a/irqbalance-pie.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -urN irqbalance-0.55.org/Makefile irqbalance-0.55/Makefile ---- irqbalance-0.55.org/Makefile 2006-12-13 18:04:21.688605750 +0100 -+++ irqbalance-0.55/Makefile 2006-12-13 18:04:40.813801000 +0100 -@@ -1,14 +1,14 @@ - - OPT=-g -Os - --CFLAGS = $(OPT) -D_FORTIFY_SOURCE=2 -Wall -W `pkg-config --cflags glib-2.0` -+CFLAGS = $(OPT) -D_FORTIFY_SOURCE=2 -Wall -W `pkg-config --cflags glib-2.0` -pie -fpie - - all: irqbalance - - LIBS=bitmap.o irqbalance.o cputree.o procinterrupts.o irqlist.o placement.o activate.o network.o powermode.o numa.o classify.o - - irqbalance: .depend $(LIBS) -- $(CC) $(CFLAGS) $(LDFLAGS) -D_FORTIFY_SOURCE=2 -Wall $(LIBS) `pkg-config --libs glib-2.0` -o irqbalance -+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,relro,-z,now -pie -fpie -D_FORTIFY_SOURCE=2 -Wall $(LIBS) `pkg-config --libs glib-2.0` -o irqbalance - - clean: - rm -f irqbalance *~ *.o .depend diff --git a/irqbalance.spec b/irqbalance.spec index e76d956..03919b2 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,22 +1,21 @@ Summary: Balancing of IRQs between multiple CPUs Summary(pl.UTF-8): Rozdzielanie IRQ pomiędzy wiele procesorów Name: irqbalance -Version: 0.55 -Release: 6 +Version: 1.0.3 +Release: 1 License: GPL Group: Daemons -Source0: http://www.irqbalance.org/releases/%{name}-%{version}.tar.gz -# Source0-md5: 9f6b314ff1fdc14173abeb40592d4edf +Source0: http://irqbalance.googlecode.com/files/irqbalance-1.0.3.tar.gz +# Source0-md5: 6f246481d6295bcb9a79751c03207c96 Source1: %{name}.init Source2: %{name}.sysconfig Source3: %{name}.service -Patch0: %{name}-opt.patch -Patch1: %{name}-pie.patch -Patch2: %{name}-cputree-parse.patch -URL: http://www.irqbalance.org/ +URL: http://code.google.com/p/irqbalance/ BuildRequires: glib2-devel # due to -fpie BuildRequires: gcc >= 5:3.4 +BuildRequires: libcap-ng-devel +BuildRequires: numactl-devel BuildRequires: pkgconfig BuildRequires: rpmbuild(macros) >= 1.647 BuildRequires: xorg-util-gccmakedep @@ -36,22 +35,19 @@ w celu zwiększenia wydajności systemu. %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p2 %build -%{__make} \ - CC="%{__cc}" \ - OPT="%{rpmcflags}%{?debug: debug.c -DDEBUG}" \ - LDFLAGS="%{rpmldflags}" +%configure \ + --with-libcap-ng=yes %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man1,%{systemdunitdir}} \ +install -d $RPM_BUILD_ROOT%{systemdunitdir} \ $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} -install %{name} $RPM_BUILD_ROOT%{_sbindir} +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir} @@ -83,3 +79,4 @@ fi %attr(754,root,root) /etc/rc.d/init.d/irqbalance %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} %{systemdunitdir}/irqbalance.service +%{_mandir}/man1/irqbalance.1* -- 2.44.0