From 37e0a0963d4c4171bbb83b7b5a1b8c588a2579c2 Mon Sep 17 00:00:00 2001 From: nhorman Date: Tue, 1 Sep 2009 15:50:39 +0000 Subject: [PATCH] Add autotools scripts to irqbalance Steve Grubb sent this patch as part of issue 3: http://code.google.com/p/irqbalance/issues/detail?id=3 He requested that we add the ability to drop capabilities from irqbalance since it nominally runs as root, and he suggested using the capng library, which makes that process easier. Since capng is a fairly new library, and many distros may not have it, we need to start using a configure script to optionally include it during the build. This patch accomplishes all of that. Signed-off-by: Neil Horman git-svn-id: https://irqbalance.googlecode.com/svn/trunk@21 46b42954-3823-0410-bd82-eb80b452c9b5 --- AUTHORS | 3 +++ ChangeLog | 3 +++ NEWS | 1 + README | 0 activate.c | 1 + bitmap.c | 2 +- classify.c | 1 + cputree.c | 3 +-- irqbalance.c | 12 +++++++++++- irqlist.c | 2 +- network.c | 2 +- numa.c | 2 +- placement.c | 1 + powermode.c | 2 +- procinterrupts.c | 2 +- 15 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 NEWS create mode 100644 README diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..3cbb8a0 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Arjen Van De Ven +Neil Horman + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f5e9428 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3 @@ +This is all tracked in the SVN repo. This file is just here to keep the +autotools from complaining + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..7cc0277 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +No news currently diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/activate.c b/activate.c index d66cf27..68c142c 100644 --- a/activate.c +++ b/activate.c @@ -23,6 +23,7 @@ * This file contains the code to communicate a selected distribution / mapping * of interrupts to the kernel. */ +#include "config.h" #include #include #include diff --git a/bitmap.c b/bitmap.c index 0c57759..1db7fa7 100644 --- a/bitmap.c +++ b/bitmap.c @@ -11,7 +11,7 @@ This file is taken from the Linux kernel and minimally adapted for use in usersp * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ - +#include "config.h" #include #include #include diff --git a/classify.c b/classify.c index 0f60b97..8609c27 100644 --- a/classify.c +++ b/classify.c @@ -1,3 +1,4 @@ +#include "config.h" #include #include #include diff --git a/cputree.c b/cputree.c index 670b1ba..280bbbf 100644 --- a/cputree.c +++ b/cputree.c @@ -24,8 +24,7 @@ * cache domains and processor cores. */ -#define _GNU_SOURCE - +#include "config.h" #include #include #include diff --git a/irqbalance.c b/irqbalance.c index c37d9d4..85866fc 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -18,12 +18,15 @@ * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ +#include "config.h" #include #include #include #include #include - +#ifdef HAVE_LIBCAP_NG +#include +#endif #include "irqbalance.h" int one_shot_mode; @@ -82,6 +85,13 @@ int main(int argc, char** argv) if (daemon(0,0)) exit(EXIT_FAILURE); +#ifdef HAVE_LIBCAP_NG + // Drop capabilities + capng_clear(CAPNG_SELECT_BOTH); + capng_lock(); + capng_apply(CAPNG_SELECT_BOTH); +#endif + parse_proc_interrupts(); sleep(SLEEP_INTERVAL/4); reset_counts(); diff --git a/irqlist.c b/irqlist.c index 7b31d60..83d7aca 100644 --- a/irqlist.c +++ b/irqlist.c @@ -22,7 +22,7 @@ /* * This file has the basic functions to manipulate interrupt metadata */ -#define _GNU_SOURCE +#include "config.h" #include #include #include diff --git a/network.c b/network.c index c2bf543..6c9ff51 100644 --- a/network.c +++ b/network.c @@ -24,7 +24,7 @@ * even though the amount of work is high; this file is there to compensate for this * by adding actual package counts to the calculated amount of work of interrupts */ -#define _GNU_SOURCE +#include "config.h" #include #include #include diff --git a/numa.c b/numa.c index 1efb5b3..453a9bc 100644 --- a/numa.c +++ b/numa.c @@ -24,7 +24,7 @@ * In addition the PCI class information is used to refine the classification * of interrupt sources */ -#define _GNU_SOURCE +#include "config.h" #include #include #include diff --git a/placement.c b/placement.c index d2d30d9..0321226 100644 --- a/placement.c +++ b/placement.c @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ +#include "config.h" #include #include #include diff --git a/powermode.c b/powermode.c index 24a31cc..792003a 100644 --- a/powermode.c +++ b/powermode.c @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE +#include "config.h" #include #include #include diff --git a/procinterrupts.c b/procinterrupts.c index d91b836..e336efe 100644 --- a/procinterrupts.c +++ b/procinterrupts.c @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE +#include "config.h" #include #include #include