Lee removed trailing spaces from:
1 libnuma.c
2 numa.3
3 numa.h

---
 bitops.c       |    6 -
 bitops.h       |    2 
 distance.c     |   58 ++++++-------
 int.h          |    2 
 libnuma.c      |  234 ++++++++++++++++++++++++++++----------------------------
 memhog.c       |   76 +++++++++---------
 migratepages.c |    2 
 mt.c           |    6 -
 numa.h         |   24 ++---
 numactl.c      |  128 +++++++++++++++---------------
 numademo.c     |  238 ++++++++++++++++++++++++++++-----------------------------
 numaif.h       |    8 -
 numaint.h      |    4 
 numamon.c      |  232 +++++++++++++++++++++++++++----------------------------
 shm.c          |  130 +++++++++++++++----------------
 stream_lib.c   |   22 ++---
 stream_lib.h   |    2 
 stream_main.c  |   10 +-
 syscall.c      |   38 ++++-----
 threadtest.c   |    4 
 util.c         |   86 ++++++++++----------
 21 files changed, 656 insertions(+), 656 deletions(-)

Index: numactl-dev/bitops.c
===================================================================
--- numactl-dev.orig/bitops.c
+++ numactl-dev/bitops.c
@@ -1,8 +1,8 @@
 #include "bitops.h"
 
 /* extremly dumb */
-int find_first_bit(void *m, int max) 
-{ 
+int find_first_bit(void *m, int max)
+{
 	unsigned long *mask = m;
 	int i;
 	for (i = 0; i < max; i++) {
@@ -10,4 +10,4 @@ int find_first_bit(void *m, int max)
 			break;			
 	}
 	return i;
-} 
+}
Index: numactl-dev/bitops.h
===================================================================
--- numactl-dev.orig/bitops.h
+++ numactl-dev/bitops.h
@@ -2,7 +2,7 @@
 #define BITOPS_H 1
 
 #define BITS_PER_LONG (sizeof(unsigned long) * 8)
-#define BYTES_PER_LONG (sizeof(long)) 
+#define BYTES_PER_LONG (sizeof(long))
 
 #define test_bit(i,p)  ((p)[(i) / BITS_PER_LONG] &   (1UL << ((i)%BITS_PER_LONG)))
 #define set_bit(i,p)   ((p)[(i) / BITS_PER_LONG] |=  (1UL << ((i)%BITS_PER_LONG)))
Index: numactl-dev/distance.c
===================================================================
--- numactl-dev.orig/distance.c
+++ numactl-dev/distance.c
@@ -12,8 +12,8 @@
    Lesser General Public License for more details.
 
    You should find a copy of v2.1 of the GNU Lesser General Public License
-   somewhere on your Linux system; if not, write to the Free Software 
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+   somewhere on your Linux system; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
    All calls are undefined when numa_available returns an error. */
 #define _GNU_SOURCE 1
@@ -24,13 +24,13 @@
 #include "numaint.h"
 
 static int distance_numnodes;
-static int *distance_table; 
+static int *distance_table;
 
 static void parse_numbers(char *s, int *iptr, int n)
 {
 	int i, d, j;
 	char *end;
-	for (i = 0, j = 0; i < n; i++, j++) { 
+	for (i = 0, j = 0; i < n; i++, j++) {
 		d = strtoul(s, &end, 0);
 		/* Skip unavailable nodes */
 		while (j<n &&  !numa_bitmask_isbitset(numa_all_nodes_ptr, j))
@@ -38,25 +38,25 @@ static void parse_numbers(char *s, int *
 		*(iptr+j) = d;
 		if (s == end)
 			break;
-		s = end; 
-	} 
+		s = end;
+	}
 }
 
-static int read_distance_table(void) 
-{ 
-	int nd, len; 
+static int read_distance_table(void)
+{
+	int nd, len;
 	char *line = NULL;
-	size_t linelen = 0; 
-	int numnodes = 0; 
-	int *table = NULL; 
+	size_t linelen = 0;
+	int numnodes = 0;
+	int *table = NULL;
 	int err = -1;
 	
-	for (nd = 0;; nd++) { 
-		char fn[100]; 
+	for (nd = 0;; nd++) {
+		char fn[100];
 		FILE *dfh;
 		sprintf(fn, "/sys/devices/system/node/node%d/distance", nd);
-		dfh = fopen(fn, "r"); 
-		if (!dfh) { 
+		dfh = fopen(fn, "r");
+		if (!dfh) {
 			if (errno == ENOENT && nd > 0)
 				err = 0;
 			if (!err && nd<numa_num_configured_nodes())
@@ -69,44 +69,44 @@ static int read_distance_table(void)
 		if (len <= 0)
 			break;
 
-		if (!table) { 
+		if (!table) {
 			numnodes = numa_num_configured_nodes();
-			table = calloc(numnodes * numnodes, sizeof(int)); 
+			table = calloc(numnodes * numnodes, sizeof(int));
 			if (!table) {
-				errno = ENOMEM; 
+				errno = ENOMEM;
 				break;
 			}
-		} 
+		}
 
 		parse_numbers(line, table + nd * numnodes, numnodes);
 	}
-	free(line); 
-	if (err)  { 
+	free(line);
+	if (err)  {
 		numa_warn(W_distance,
 			  "Cannot parse distance information in sysfs: %s",
 			  strerror(errno));
-		free(table); 
+		free(table);
 		return err;
 	}
 	/* Update the global table pointer.  Race window here with
 	   other threads, but in the worst case we leak one distance
 	   array one time, which is tolerable. This avoids a
 	   dependency on pthreads. */
-	if (distance_table) { 
+	if (distance_table) {
 		free(table);
 		return 0;
 	}
 	distance_numnodes = numnodes;
 	distance_table = table;
 	return 0;		
-}  
+}
 
-int numa_distance(int a, int b) 
-{ 
-	if (!distance_table) { 
+int numa_distance(int a, int b)
+{
+	if (!distance_table) {
 		int err = read_distance_table();
 		if (err < 0)
 			return 0;
 	}
 	return distance_table[a * distance_numnodes + b];
-} 
+}
Index: numactl-dev/int.h
===================================================================
--- numactl-dev.orig/int.h
+++ numactl-dev/int.h
@@ -1,3 +1,3 @@
 extern int numa_sched_setaffinity_int(pid_t pid, unsigned len, unsigned long *mask);
 extern int numa_sched_getaffinity_int(pid_t pid, unsigned len, unsigned long *mask);
-extern long get_mempolicy_int(int *policy, unsigned long *nmask, unsigned long maxnode, 
+extern long get_mempolicy_int(int *policy, unsigned long *nmask, unsigned long maxnode,
Index: numactl-dev/memhog.c
===================================================================
--- numactl-dev.orig/memhog.c
+++ numactl-dev/memhog.c
@@ -12,7 +12,7 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
+   on your Linux system; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 
 #include <stdlib.h>
@@ -21,76 +21,76 @@
 #include <sys/fcntl.h>
 #include <string.h>
 #include "numa.h"
-#include "numaif.h" 
+#include "numaif.h"
 #include "util.h"
 
 #define terr(x) perror(x)
 
-enum { 
+enum {
 	UNIT = 10*1024*1024,
-}; 
+};
 
 
 int repeat = 1;
 
 void usage(void)
-{ 
+{
 	printf("memhog [-rNUM] size[kmg] [policy [nodeset]]\n");
 	printf("-rNUM repeat memset NUM times\n");
-	print_policies(); 
-	exit(1); 
-} 
+	print_policies();
+	exit(1);
+}
 
-long length; 
+long length;
 
-void hog(void *map) 
-{ 
+void hog(void *map)
+{
 	long i;
-	for (i = 0;  i < length; i += UNIT) { 
-		long left = length - i; 
-		if (left > UNIT) 
-			left = UNIT; 
-		putchar('.'); 
-		fflush(stdout); 
-		memset(map + i, 0xff, left); 
-	} 
+	for (i = 0;  i < length; i += UNIT) {
+		long left = length - i;
+		if (left > UNIT)
+			left = UNIT;
+		putchar('.');
+		fflush(stdout);
+		memset(map + i, 0xff, left);
+	}
 	putchar('\n');
 }
 
-int main(int ac, char **av) 
-{ 
-	char *map; 
+int main(int ac, char **av)
+{
+	char *map;
 	struct bitmask *nodes, *gnodes;
 	int policy, gpolicy;
 	int ret = 0;
-	int loose = 0; 
+	int loose = 0;
 	int i;
-	int fd = -1; 
+	int fd = -1;
 
 	nodes = numa_allocate_nodemask();
 	gnodes = numa_allocate_nodemask();
 
-	while (av[1] && av[1][0] == '-') { 
-		switch (av[1][1]) { 
-		case 'f': 
+	while (av[1] && av[1][0] == '-') {
+		switch (av[1][1]) {
+		case 'f':
 			fd = open(av[1]+2, O_RDWR);
-			if (fd < 0) 
-				perror(av[1]+2); 
+			if (fd < 0)
+				perror(av[1]+2);
 			break;	
 		case 'r':
-			repeat = atoi(av[1] + 2); 
+			repeat = atoi(av[1] + 2);
 			break;
 		default:	
 			usage();
 		}
 		av++;		
-	} 
+	}
 	
 	if (!av[1]) usage();
 
 	length = memsize(av[1]);
 	if (av[2] && numa_available() < 0) {
-		printf("Kernel doesn't support NUMA policy\n"); 
+		printf("Kernel doesn't support NUMA policy\n");
 		exit(1);
 	} else
 		loose = 1;
@@ -103,23 +103,23 @@ int main(int ac, char **av)
 	}
 	
 	if (fd >= 0)
-		map = mmap(NULL,length,PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); 
+		map = mmap(NULL,length,PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
 	else	
-		map = mmap(NULL, length, PROT_READ|PROT_WRITE, 
+		map = mmap(NULL, length, PROT_READ|PROT_WRITE,
 				   MAP_PRIVATE|MAP_ANONYMOUS,
 				   0, 0);
-	if (map == (char*)-1) 
+	if (map == (char*)-1)
 		err("mmap");
 	
 	if (mbind(map, length, policy, nodes->maskp, nodes->size, 0) < 0)
 		terr("mbind");
 	
-	gpolicy = -1; 
+	gpolicy = -1;
 	if (get_mempolicy(&gpolicy, gnodes->maskp, gnodes->size, map, MPOL_F_ADDR) < 0)
 		terr("get_mempolicy");
 	if (!loose && policy != gpolicy) {
 		ret = 1;
-		printf("policy %d gpolicy %d\n", policy, gpolicy); 
+		printf("policy %d gpolicy %d\n", policy, gpolicy);
 	}
 	if (!loose && !numa_bitmask_equal(gnodes, nodes)) {
 		printf("nodes differ %lx, %lx!\n",
@@ -128,6 +128,6 @@ int main(int ac, char **av)
 	}
 
 	for (i = 0; i < repeat; i++)
-		hog(map); 
+		hog(map);
 	exit(ret);
 }
Index: numactl-dev/migratepages.c
===================================================================
--- numactl-dev.orig/migratepages.c
+++ numactl-dev/migratepages.c
@@ -21,7 +21,7 @@
 #define _GNU_SOURCE
 #include <getopt.h>
 #include <errno.h>
-#include <stdio.h> 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
Index: numactl-dev/mt.c
===================================================================
--- numactl-dev.orig/mt.c
+++ numactl-dev/mt.c
@@ -1,4 +1,4 @@
-/* Mersenne twister implementation from Michael Brundage. Public Domain. 
+/* Mersenne twister implementation from Michael Brundage. Public Domain.
    MT is a very fast pseudo random number generator. This version works
    on 32bit words.  Changes by AK. */
 #include <stdlib.h>
@@ -7,7 +7,7 @@
 int mt_index;
 unsigned int mt_buffer[MT_LEN];
 
-void mt_init(void) 
+void mt_init(void)
 {
     int i;
     srand(1);
@@ -40,7 +40,7 @@ void mt_refill(void)
             s = TWIST(b, i, i+1);
             b[i] = b[i - MT_IB] ^ (s >> 1) ^ MAGIC(s);
         }
-        
+
         s = TWIST(b, MT_LEN-1, 0);
         b[MT_LEN-1] = b[MT_IA-1] ^ (s >> 1) ^ MAGIC(s);
 }
Index: numactl-dev/numactl.c
===================================================================
--- numactl-dev.orig/numactl.c
+++ numactl-dev/numactl.c
@@ -12,12 +12,12 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
+   on your Linux system; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 #define _GNU_SOURCE
 #include <getopt.h>
 #include <errno.h>
-#include <stdio.h> 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -31,14 +31,14 @@
 
 int exitcode;
 
-struct option opts[] = { 
+struct option opts[] = {
 	{"interleave", 1, 0, 'i' },
 	{"preferred", 1, 0, 'p' },
-	{"cpubind", 1, 0, 'c' }, 
-	{"cpunodebind", 1, 0, 'N' }, 
-	{"physcpubind", 1, 0, 'C' }, 
+	{"cpubind", 1, 0, 'c' },
+	{"cpunodebind", 1, 0, 'N' },
+	{"physcpubind", 1, 0, 'C' },
 	{"membind", 1, 0, 'm'},
-	{"show", 0, 0, 's' }, 
+	{"show", 0, 0, 's' },
 	{"localalloc", 0,0, 'l'},
 	{"hardware", 0,0,'H' },
 
@@ -80,30 +80,30 @@ void usage(void)
 		"use --cpunodebind or --physcpubind instead\n"
 		"length can have g (GB), m (MB) or k (KB) suffixes\n");
 	exit(1);
-} 
+}
 
-void usage_msg(char *msg, ...) 
-{ 
+void usage_msg(char *msg, ...)
+{
 	va_list ap;
 	va_start(ap,msg);
-	fprintf(stderr, "numactl: "); 
+	fprintf(stderr, "numactl: ");
 	vfprintf(stderr, msg, ap);
 	putchar('\n');
 	usage();
-} 
+}
 
 void show_physcpubind(void)
 {
 	int ncpus = numa_num_configured_cpus();
 	
-	for (;;) { 
+	for (;;) {
 		struct bitmask *cpubuf;
 
 		cpubuf = numa_bitmask_alloc(ncpus);
 
 		if (numa_sched_getaffinity(0, cpubuf) < 0) {
 			if (errno == EINVAL && ncpus < 1024*1024) {
-				ncpus *= 2; 
+				ncpus *= 2;
 				continue;
 			}
 			err("sched_get_affinity");
@@ -121,7 +121,7 @@ void show(void)
 	int policy;
 	int numa_num_nodes = numa_num_possible_nodes();
 	
-	if (numa_available() < 0) { 
+	if (numa_available() < 0) {
 		show_physcpubind();
 		printf("No NUMA support available on this system.\n");
 		exit(1);
@@ -135,15 +135,15 @@ void show(void)
 	cur = numa_get_interleave_node();
 
 	policy = 0;
-	if (get_mempolicy(&policy, NULL, 0, 0, 0) < 0) 
-		perror("get_mempolicy"); 
-	 
+	if (get_mempolicy(&policy, NULL, 0, 0, 0) < 0)
+		perror("get_mempolicy");
+
 	printf("policy: %s\n", policy_name(policy));
 		
 	printf("preferred node: ");
-	switch (policy) { 
+	switch (policy) {
 	case MPOL_PREFERRED:
-		if (prefnode != -1) { 
+		if (prefnode != -1) {
 			printf("%ld\n", prefnode);
 			break;
 		}
@@ -152,15 +152,15 @@ void show(void)
 		printf("current\n");
 		break;
 	case MPOL_INTERLEAVE:
-		printf("%ld (interleave next)\n",cur); 
-		break; 
+		printf("%ld (interleave next)\n",cur);
+		break;
 	case MPOL_BIND:
 		printf("%d\n", find_first_bit(&membind, numa_num_nodes));
 		break;
-	} 
+	}
 	if (policy == MPOL_INTERLEAVE) {
 		printmask("interleavemask", interleave);
-		printf("interleavenode: %ld\n", cur); 
+		printf("interleavenode: %ld\n", cur);
 	}
 	show_physcpubind();
 	printmask("cpubind", cpubind);  // for compatibility
@@ -168,14 +168,14 @@ void show(void)
 	printmask("membind", membind);
 }
 
-char *fmt_mem(unsigned long long mem, char *buf) 
-{ 
+char *fmt_mem(unsigned long long mem, char *buf)
+{
 	if (mem == -1L)
-		sprintf(buf, "<not available>"); 
+		sprintf(buf, "<not available>");
 	else
-		sprintf(buf, "%Lu MB", mem >> 20); 
+		sprintf(buf, "%Lu MB", mem >> 20);
 	return buf;
-} 
+}
 
 static void print_distances(int maxnode)
 {
@@ -185,15 +185,15 @@ static void print_distances(int maxnode)
 		printf("No distance information available.\n");
 		return;
 	}
-	printf("node distances:\n"); 
+	printf("node distances:\n");
 	printf("node ");
-	for (i = 0; i <= maxnode; i++) 
+	for (i = 0; i <= maxnode; i++)
 		printf("% 3d ", i);
 	printf("\n");
 	for (i = 0; i <= maxnode; i++) {
 		printf("% 3d: ", i);
-		for (k = 0; k <= maxnode; k++) 
-			printf("% 3d ", numa_distance(i,k)); 
+		for (k = 0; k <= maxnode; k++)
+			printf("% 3d ", numa_distance(i,k));
 		printf("\n");
 	}			
 }
@@ -205,15 +205,15 @@ void print_node_cpus(int node)
 
 	cpus = numa_allocate_cpumask();
 	err = numa_node_to_cpus(node, cpus);
-	if (err >= 0) 
-		for (i = 0; i < cpus->size; i++) 
+	if (err >= 0)
+		for (i = 0; i < cpus->size; i++)
 			if (numa_bitmask_isbitset(cpus, i))
 				printf(" %d", i);
 	putchar('\n');
 }
 
 void hardware(void)
-{ 
+{
 	int i, numconfigurednodes=0;
 	int maxnode = numa_num_configured_nodes()-1;
 
@@ -226,10 +226,10 @@ void hardware(void)
 	else
 		printf("available: %d nodes (0-%d)\n", maxnode+1, maxnode); 	
 		
-	for (i = 0; i <= maxnode; i++) { 
+	for (i = 0; i <= maxnode; i++) {
 		char buf[64];
 		long long fr;
-		unsigned long long sz = numa_node_size64(i, &fr); 
+		unsigned long long sz = numa_node_size64(i, &fr);
 		if (!numa_bitmask_isbitset(numa_all_nodes_ptr, i))
 			continue;
 
@@ -239,7 +239,7 @@ void hardware(void)
 		printf("node %d free: %s\n", i, fmt_mem(fr, buf));
 	}
 	print_distances(maxnode);
-} 
+}
 
 void checkerror(char *s)
 {
@@ -247,17 +247,17 @@ void checkerror(char *s)
 		perror(s);
 		exit(1);
 	}
-} 
+}
 
 void checknuma(void)
-{ 
+{
 	static int numa = -1;
 	if (numa < 0) {
 		if (numa_available() < 0)
 			complain("This system does not support NUMA policy");
 	}
 	numa = 0;
-} 
+}
 
 int set_policy = -1;
 
@@ -269,10 +269,10 @@ void setpolicy(int pol)
 }
 
 void nopolicy(void)
-{ 
+{
 	if (set_policy >= 0)
 		usage_msg("specify policy after --shm/--file");
-} 
+}
 
 int did_cpubind = 0;
 int did_strict = 0;
@@ -288,31 +288,31 @@ void check_cpubind(int flag)
 }
 
 void noshm(char *opt)
-{ 
+{
 	if (shmattached)
 		usage_msg("%s must be before shared memory specification", opt);
 	shmoption = opt;		
-} 
+}
 
-void dontshm(char *opt) 
+void dontshm(char *opt)
 {
 	if (shmoption)
 		usage_msg("%s shm option is not allowed before %s", shmoption, opt);
 }
 
 void needshm(char *opt)
-{ 
+{
 	if (!shmattached)
 		usage_msg("%s must be after shared memory specification", opt);
-} 
+}
 
 void get_short_opts(struct option *o, char *s)
 {
 	*s++ = '+';
-	while (o->name) { 
+	while (o->name) {
 		if (isprint(o->val)) {
 			*s++ = o->val;
-			if (o->has_arg) 
+			if (o->has_arg)
 				*s++ = ':';
 		}
 		o++;
@@ -333,7 +333,7 @@ int main(int ac, char **av)
 		switch (c) {
 		case 's': /* --show */
 			show();
-			exit(0);  
+			exit(0);
 		case 'H': /* --hardware */
 			nopolicy();
 			hardware();
@@ -396,7 +396,7 @@ int main(int ac, char **av)
 			}
 			errno = 0;
 			numa_set_bind_policy(1);
-			if (shmfd >= 0) { 
+			if (shmfd >= 0) {
 				numa_tonodemask_memory(shmptr, shmlen, mask);
 			} else {
 				numa_set_membind(mask);
@@ -423,7 +423,7 @@ int main(int ac, char **av)
 			numa_bitmask_free(mask);
 			errno = 0;
 			numa_set_bind_policy(0);
-			if (shmfd >= 0) 
+			if (shmfd >= 0)
 				numa_tonode_memory(shmptr, shmlen, node);
 			else
 				numa_set_preferred(node);
@@ -433,7 +433,7 @@ int main(int ac, char **av)
 			checknuma();
 			setpolicy(MPOL_DEFAULT);
 			errno = 0;
-			if (shmfd >= 0) 
+			if (shmfd >= 0)
 				numa_setlocal_memory(shmptr, shmlen);
 			else
 				numa_set_localalloc();
@@ -442,7 +442,7 @@ int main(int ac, char **av)
 		case 'S': /* --shm */
 			check_cpubind(did_cpubind);
 			nopolicy();
-			attach_sysvshm(optarg); 
+			attach_sysvshm(optarg);
 			shmattached = 1;
 			break;
 		case 'f': /* --file */
@@ -458,7 +458,7 @@ int main(int ac, char **av)
 		case 'M': /* --shmmode */
 			noshm("--shmmode");
 			shmmode = strtoul(optarg, &end, 8);
-			if (end == optarg || *end) 
+			if (end == optarg || *end)
 				usage();
 			break;
 		case 'd': /* --dump */
@@ -481,7 +481,7 @@ int main(int ac, char **av)
 			break;
 		case 'I': /* --shmid */
 			shmid = strtoul(optarg, &end, 0);
-			if (end == optarg || *end) 
+			if (end == optarg || *end)
 				usage();
 			break;
 
@@ -502,9 +502,9 @@ int main(int ac, char **av)
 
 		case 'V': /* --verify */
 			needshm("--verify");
-			if (set_policy < 0) 
+			if (set_policy < 0)
 				complain("Need a policy first to verify");
-			numa_police_memory(shmptr, shmlen); 
+			numa_police_memory(shmptr, shmlen);
 			if (!mask)
 				complain("Need a mask to verify");
 			else
@@ -513,13 +513,13 @@ int main(int ac, char **av)
 
 		default:
 			usage();
-		} 
+		}
 	}
 	
 	av += optind;
-	ac -= optind; 
+	ac -= optind;
 
-	if (shmfd >= 0) { 
+	if (shmfd >= 0) {
 		if (*av)
 			usage();
 		exit(exitcode);
@@ -538,6 +538,6 @@ int main(int ac, char **av)
 	if (*av == NULL)
 		usage();
 	execvp(*av, av);
-	complain("execution of `%s': %s\n", av[0], strerror(errno)); 
+	complain("execution of `%s': %s\n", av[0], strerror(errno));
 	return 0; /* not reached */
 }
Index: numactl-dev/numademo.c
===================================================================
--- numactl-dev.orig/numademo.c
+++ numactl-dev/numademo.c
@@ -1,6 +1,6 @@
 /* Copyright (C) 2003,2004 Andi Kleen, SuSE Labs.
    Test/demo program for libnuma. This is also a more or less useful benchmark
-   of the NUMA characteristics of your machine. It benchmarks most possible 
+   of the NUMA characteristics of your machine. It benchmarks most possible
    NUMA policy memory configurations with various benchmarks.
    Compile standalone with cc -O2 numademo.c -o numademo -lnuma -lm
 
@@ -15,7 +15,7 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
+   on your Linux system; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 #define _GNU_SOURCE 1
 #include <stdio.h>
@@ -39,14 +39,14 @@ static inline void clearcache(void *a, u
 #define FRACT_MASKS 32
 int fract_nodes;
 
-unsigned long msize; 
+unsigned long msize;
 
 /* Should get this from cpuinfo, but on !x86 it's not there */
-enum { 
+enum {
 	CACHELINESIZE = 64,
-}; 
+};
 
-enum test { 
+enum test {
 	MEMSET = 0,
 	MEMCPY,
 	FORWARD,
@@ -60,7 +60,7 @@ char *delim = " ";
 int force;
 int regression_testing=0;
 
-char *testname[] = { 
+char *testname[] = {
 	"memset",
 	"memcpy",
 	"forward",
@@ -73,14 +73,14 @@ char *testname[] = {
 #endif
 	"ptrchase",
 	NULL,
-}; 
+};
 
 void output(char *title, char *result)
 {
 	if (!isspace(delim[0]))
-		printf("%s%s%s\n", title,delim, result); 
+		printf("%s%s%s\n", title,delim, result);
 	else
-		printf("%-42s%s\n", title, result); 
+		printf("%-42s%s\n", title, result);
 }
 
 
@@ -92,14 +92,14 @@ void do_stream(char *name, unsigned char
 	double res[STREAM_NRESULTS];
 	stream_verbose = 0;
 	clearcache(mem, msize);
-	stream_init(mem); 
+	stream_init(mem);
 	stream_test(res);
 	sprintf(title, "%s%s%s", name, delim, "STREAM");
 	buf[0] = '\0';
-	for (i = 0; i < STREAM_NRESULTS; i++) { 
+	for (i = 0; i < STREAM_NRESULTS; i++) {
 		if (buf[0])
 			strcat(buf,delim);
-		sprintf(buf+strlen(buf), "%s%s%.2f%sMB/s", 
+		sprintf(buf+strlen(buf), "%s%s%.2f%sMB/s",
 			stream_names[i], delim, res[i], delim);
 	}
 	output(title, buf);
@@ -149,22 +149,22 @@ static inline unsigned long long timerfo
 #define LOOPS 10
 
 void memtest(char *name, unsigned char *mem)
-{ 
+{
 	long k;
 	struct timeval start, end, res;
-	unsigned long long max, min, sum, r; 
+	unsigned long long max, min, sum, r;
 	int i;
 	char title[128], result[128];
 
 #ifdef HAVE_STREAM_LIB
-	if (thistest == STREAM) { 
+	if (thistest == STREAM) {
 		do_stream(name, mem);
 		goto out;
 	}
 #endif
 	
-	max = 0; 
-	min = ~0UL; 
+	max = 0;
+	min = ~0UL;
 	sum = 0;
 
 	/*
@@ -172,7 +172,7 @@ void memtest(char *name, unsigned char *
 	 */
 	for (i = 0; i < LOOPS+1; i++) {
 		clearcache(mem, msize);
-		switch (thistest) { 
+		switch (thistest) {
 		case PTRCHASE:
 		{
 			void **ptr;
@@ -188,28 +188,28 @@ void memtest(char *name, unsigned char *
 
 		case MEMSET:
 			gettimeofday(&start,NULL);
-			memset(mem, 0xff, msize); 
+			memset(mem, 0xff, msize);
 			gettimeofday(&end,NULL);
 			break;
 
-		case MEMCPY: 
+		case MEMCPY:
 			gettimeofday(&start,NULL);
-			memcpy(mem, mem + msize/2, msize/2); 
+			memcpy(mem, mem + msize/2, msize/2);
 			gettimeofday(&end,NULL);
 			break;
 
-		case FORWARD: 
-			/* simple kernel to just fetch cachelines and write them back. 
-			   will trigger hardware prefetch */ 
+		case FORWARD:
+			/* simple kernel to just fetch cachelines and write them back.
+			   will trigger hardware prefetch */
 			gettimeofday(&start,NULL);
-			for (k = 0; k < msize; k+=CACHELINESIZE) 
+			for (k = 0; k < msize; k+=CACHELINESIZE)
 				mem[k]++;
 			gettimeofday(&end,NULL);
 			break;
 
-		case BACKWARD: 
+		case BACKWARD:
 			gettimeofday(&start,NULL);
-			for (k = msize-5; k > 0; k-=CACHELINESIZE) 
+			for (k = msize-5; k > 0; k-=CACHELINESIZE)
 				mem[k]--;
 			gettimeofday(&end,NULL);
 			break;
@@ -221,7 +221,7 @@ void memtest(char *name, unsigned char *
 			unsigned max = msize / sizeof(unsigned);
 			unsigned mask;
 
-			mt_init(); 
+			mt_init();
 			mask = 1;
 			while (mask < max)
 				mask = (mask << 1) | 1;
@@ -243,25 +243,25 @@ void memtest(char *name, unsigned char *
 #endif
 		default:
 			break;
-		} 
+		}
 
 		if (!i)
 			continue;  /* don't count allocation pass */
 
 		timersub(&end, &start, &res);
-		r = timerfold(&res); 
+		r = timerfold(&res);
 		if (r > max) max = r;
 		if (r < min) min = r;
-		sum += r; 
-	} 
-	sprintf(title, "%s%s%s", name, delim, testname[thistest]); 
+		sum += r;
+	}
+	sprintf(title, "%s%s%s", name, delim, testname[thistest]);
 #define H(t) (((double)msize) / ((double)t))
 #define D3 delim,delim,delim
 	sprintf(result, "Avg%s%.2f%sMB/s%sMax%s%.2f%sMB/s%sMin%s%.2f%sMB/s",
 		delim,
-		H(sum/LOOPS), 
+		H(sum/LOOPS),
 		D3,
-		H(min), 
+		H(min),
 		D3,
 		H(max),
 		delim);
@@ -276,31 +276,31 @@ void memtest(char *name, unsigned char *
 	   doesn't still keep it around. */
 	clearcache(mem, msize);
 
-	numa_free(mem, msize); 
-} 
+	numa_free(mem, msize);
+}
 
 int popcnt(unsigned long val)
-{ 
+{
 	int i = 0, cnt = 0;
-	while (val >> i) { 
-		if ((1UL << i) & val) 
-			cnt++; 
+	while (val >> i) {
+		if ((1UL << i) & val)
+			cnt++;
 		i++;
-	} 
+	}
 	return cnt;
-} 
+}
 
 int max_node;
 
 void test(enum test type)
-{ 
+{
 	unsigned long mask;
 	int i, k;
 	char buf[512];
 	struct bitmask *nodes;
 
 	nodes = numa_allocate_nodemask();
-	thistest = type; 
+	thistest = type;
 
 	if (regression_testing) {
 		printf("\nTest %s doing 1 of %d nodes and 1 of %d masks.\n",
@@ -310,20 +310,20 @@ void test(enum test type)
 	memtest("memory with no policy", numa_alloc(msize));
 	memtest("local memory", numa_alloc_local(msize));
 
-	memtest("memory interleaved on all nodes", numa_alloc_interleaved(msize)); 
-	for (i = 0; i <= max_node; i++) { 
+	memtest("memory interleaved on all nodes", numa_alloc_interleaved(msize));
+	for (i = 0; i <= max_node; i++) {
 		if (regression_testing && (i % fract_nodes)) {
 		/* for regression testing (-t) do only every eighth node */
 			continue;
 		}
-		sprintf(buf, "memory on node %d", i); 
-		memtest(buf, numa_alloc_onnode(msize, i)); 
-	} 
+		sprintf(buf, "memory on node %d", i);
+		memtest(buf, numa_alloc_onnode(msize, i));
+	}
 	
 	for (mask = 1, i = 0; mask < (1UL<<(max_node+1)); mask++, i++) {
 		int w;
 		char buf2[10];
-		if (popcnt(mask) == 1) 
+		if (popcnt(mask) == 1)
 			continue;
 		if (regression_testing && (i > 50)) {
 			break;
@@ -334,13 +334,13 @@ void test(enum test type)
 			continue;
 		}
 		numa_bitmask_clearall(nodes);
-		for (w = 0; mask >> w; w++) { 
+		for (w = 0; mask >> w; w++) {
 			if ((mask >> w) & 1)
 				numa_bitmask_setbit(nodes, w);
-		} 
+		}
 
-		sprintf(buf, "memory interleaved on"); 
-		for (k = 0; k <= max_node; k++) 
+		sprintf(buf, "memory interleaved on");
+		for (k = 0; k <= max_node; k++)
 			if ((1UL<<k) & mask) {
 				sprintf(buf2, " %d", k);
 				strcat(buf, buf2);
@@ -348,57 +348,57 @@ void test(enum test type)
 		memtest(buf, numa_alloc_interleaved_subset(msize, nodes));
 	}
 
-	for (i = 0; i <= max_node; i++) { 
+	for (i = 0; i <= max_node; i++) {
 		if (regression_testing && (i % fract_nodes)) {
 		/* for regression testing (-t) do only every eighth node */
 			continue;
 		}
 		printf("setting preferred node to %d\n", i);
-		numa_set_preferred(i); 
-		memtest("memory without policy", numa_alloc(msize)); 
-	} 
+		numa_set_preferred(i);
+		memtest("memory without policy", numa_alloc(msize));
+	}
 
 	numa_set_interleave_mask(numa_all_nodes_ptr);
-	memtest("manual interleaving to all nodes", numa_alloc(msize)); 
+	memtest("manual interleaving to all nodes", numa_alloc(msize));
 
-	if (max_node > 0) { 
+	if (max_node > 0) {
 		numa_bitmask_clearall(nodes);
 		numa_bitmask_setbit(nodes, 0);
 		numa_bitmask_setbit(nodes, 1);
 		numa_set_interleave_mask(nodes);
-		memtest("manual interleaving on node 0/1", numa_alloc(msize)); 
-		printf("current interleave node %d\n", numa_get_interleave_node()); 
-	} 
+		memtest("manual interleaving on node 0/1", numa_alloc(msize));
+		printf("current interleave node %d\n", numa_get_interleave_node());
+	}
 
 	numa_set_interleave_mask(numa_no_nodes_ptr);
 
 	nodes = numa_allocate_nodemask();
 
-	for (i = 0; i <= max_node; i++) { 
+	for (i = 0; i <= max_node; i++) {
 		int oldhn = numa_preferred();
 
 		if (regression_testing && (i % fract_nodes)) {
 		/* for regression testing (-t) do only every eighth node */
 			continue;
 		}
-		numa_run_on_node(i); 
+		numa_run_on_node(i);
 		printf("running on node %d, preferred node %d\n",i, oldhn);
 
 		memtest("local memory", numa_alloc_local(msize));
 
-		memtest("memory interleaved on all nodes", 
-			numa_alloc_interleaved(msize)); 
+		memtest("memory interleaved on all nodes",
+			numa_alloc_interleaved(msize));
 
-		if (max_node >= 1) { 
+		if (max_node >= 1) {
 			numa_bitmask_clearall(nodes);
 			numa_bitmask_setbit(nodes, 0);
 			numa_bitmask_setbit(nodes, 1);
-			memtest("memory interleaved on node 0/1", 
+			memtest("memory interleaved on node 0/1",
 				numa_alloc_interleaved_subset(msize, nodes));
-		} 
+		}
 
-		for (k = 0; k <= max_node; k++) { 
-			if (k == i) 
+		for (k = 0; k <= max_node; k++) {
+			if (k == i)
 				continue;
 			if (regression_testing && (k % fract_nodes)) {
 			/* for regression testing (-t)
@@ -413,20 +413,20 @@ void test(enum test type)
 			numa_set_membind(numa_all_nodes_ptr);
 		}
 		
-		numa_set_localalloc(); 
-		memtest("local allocation", numa_alloc(msize)); 
+		numa_set_localalloc();
+		memtest("local allocation", numa_alloc(msize));
 
-		numa_set_preferred((i+1) % (1+max_node)); 
-		memtest("setting wrong preferred node", numa_alloc(msize)); 
-		numa_set_preferred(i); 
-		memtest("setting correct preferred node", numa_alloc(msize)); 
-		numa_set_preferred(-1); 
+		numa_set_preferred((i+1) % (1+max_node));
+		memtest("setting wrong preferred node", numa_alloc(msize));
+		numa_set_preferred(i);
+		memtest("setting correct preferred node", numa_alloc(msize));
+		numa_set_preferred(-1);
 		if (!delim[0])
-			printf("\n\n\n"); 
-	} 
+			printf("\n\n\n");
+	}
 
 	/* numa_run_on_node_mask is not tested */
-} 
+}
 
 void usage(void)
 {
@@ -434,37 +434,37 @@ void usage(void)
 	printf("usage: numademo [-S] [-f] [-c] [-e] [-t] msize[kmg] {tests}\nNo tests means run all.\n");
 	printf("-c output CSV data. -f run even without NUMA API. -S run stupid tests. -e exit on error\n");
 	printf("-t regression test; do not run all node combinations\n");
-	printf("valid tests:"); 
-	for (i = 0; testname[i]; i++) 
-		printf(" %s", testname[i]); 
+	printf("valid tests:");
+	for (i = 0; testname[i]; i++)
+		printf(" %s", testname[i]);
 	putchar('\n');
 	exit(1);
 }
 
 /* duplicated to make numademo standalone */
-long memsize(char *s) 
-{ 
+long memsize(char *s)
+{
 	char *end;
 	long length = strtoul(s,&end,0);
-	switch (toupper(*end)) { 
+	switch (toupper(*end)) {
 	case 'G': length *= 1024;  /*FALL THROUGH*/
 	case 'M': length *= 1024;  /*FALL THROUGH*/
 	case 'K': length *= 1024; break;
 	}
-	return length; 
-} 
+	return length;
+}
 
 int main(int ac, char **av)
 {
 	int simple_tests = 0;
 	
-	while (av[1] && av[1][0] == '-') { 
+	while (av[1] && av[1][0] == '-') {
 		ac--;
-		switch (av[1][1]) { 
-		case 'c': 
-			delim = ","; 
+		switch (av[1][1]) {
+		case 'c':
+			delim = ",";
 			break;
-		case 'f': 
+		case 'f':
 			force = 1;
 			break;
 		case 'S':
@@ -478,29 +478,29 @@ int main(int ac, char **av)
 			regression_testing = 1;
 			break;
 		default:
-			usage(); 
-			break; 
-		} 
-		++av; 
-	} 
+			usage();
+			break;
+		}
+		++av;
+	}
 
-	if (!av[1]) 
-		usage(); 
+	if (!av[1])
+		usage();
 
-	if (numa_available() < 0) { 
+	if (numa_available() < 0) {
 		printf("your system does not support the numa API.\n");
 		if (!force)
 			exit(1);
 	}
 
-	max_node = numa_max_node(); 
-	printf("%d nodes available\n", max_node+1); 
+	max_node = numa_max_node();
+	printf("%d nodes available\n", max_node+1);
 	fract_nodes = ((max_node/8)*2) + FRACT_NODES;
 
 	if (max_node <= 2)
 		regression_testing = 0; /* set -t auto-off for small systems */
 
-	msize = memsize(av[1]); 
+	msize = memsize(av[1]);
 
 	if (!msize)
 		usage();
@@ -509,10 +509,10 @@ int main(int ac, char **av)
 	stream_setmem(msize);
 #endif
 
-	if (av[2] == NULL) { 
-		test(MEMSET); 
+	if (av[2] == NULL) {
+		test(MEMSET);
 		test(MEMCPY);
-		if (simple_tests) { 
+		if (simple_tests) {
 			test(FORWARD);
 			test(BACKWARD);
 		}
@@ -520,26 +520,26 @@ int main(int ac, char **av)
 		test(RANDOM2);
 #endif
 #ifdef HAVE_STREAM_LIB
-		test(STREAM); 
+		test(STREAM);
 #endif
 		test(PTRCHASE);
 	} else {
 		int k;
-		for (k = 2; k < ac; k++) { 
+		for (k = 2; k < ac; k++) {
 			int i;
 			int found = 0;
-			for (i = 0; testname[i]; i++) { 
-				if (!strcmp(testname[i],av[k])) { 
-					test(i); 
+			for (i = 0; testname[i]; i++) {
+				if (!strcmp(testname[i],av[k])) {
+					test(i);
 					found = 1;
 					break;
 				}
-			} 
-			if (!found) { 
+			}
+			if (!found) {
 				fprintf(stderr,"unknown test `%s'\n", av[k]);
 				usage();
 			}
 		}
-	} 
+	}
 	return 0;
 }
Index: numactl-dev/numaif.h
===================================================================
--- numactl-dev.orig/numaif.h
+++ numactl-dev/numaif.h
@@ -2,7 +2,7 @@
 #define NUMAIF_H 1
 
 #ifdef __cplusplus
-extern "C" { 
+extern "C" {
 #endif
 
 /* Kernel interface for NUMA API */
@@ -10,9 +10,9 @@ extern "C" {
 /* System calls */
 extern long get_mempolicy(int *policy, const unsigned long *nmask,
 			unsigned long maxnode, void *addr, int flags);
-extern long mbind(void *start, unsigned long len, int mode, 
+extern long mbind(void *start, unsigned long len, int mode,
 	const unsigned long *nmask, unsigned long maxnode, unsigned flags);
-extern long set_mempolicy(int mode, const unsigned long *nmask, 
+extern long set_mempolicy(int mode, const unsigned long *nmask,
 			  unsigned long maxnode);
 extern long migrate_pages(int pid, unsigned long maxnode,
 			  const unsigned long *frommask,
@@ -31,7 +31,7 @@ extern long move_pages(int pid, unsigned
 
 /* Flags for get_mem_policy */
 #define MPOL_F_NODE    (1<<0)   /* return next il node or node of address */
-				/* Warning: MPOL_F_NODE is unsupported and 
+				/* Warning: MPOL_F_NODE is unsupported and
 				   subject to change. Don't use. */
 #define MPOL_F_ADDR     (1<<1)  /* look up vma using address */
 #define MPOL_F_MEMS_ALLOWED (1<<2) /* query nodes allowed in cpuset */
Index: numactl-dev/numaint.h
===================================================================
--- numactl-dev.orig/numaint.h
+++ numactl-dev/numaint.h
@@ -17,7 +17,7 @@ extern int numa_sched_getaffinity_v2_int
 
 #define make_internal_alias(x) extern __typeof (x) x##_int __attribute((alias(#x), visibility("hidden")))
 
-enum numa_warn { 
+enum numa_warn {
 	W_nosysfs,
 	W_noproc,
 	W_badmeminfo,
@@ -29,7 +29,7 @@ enum numa_warn {
 	W_memory,
 	W_cpuparse,
 	W_nodeparse,
-}; 
+};
 
 #define howmany(x,y) (((x)+((y)-1))/(y))
 #define bitsperlong (8 * sizeof(unsigned long))
Index: numactl-dev/numamon.c
===================================================================
--- numactl-dev.orig/numamon.c
+++ numactl-dev/numamon.c
@@ -11,8 +11,8 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
-   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+   on your Linux system; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
    Display some numa statistics collected by the CPU.
    Opteron specific. Also not reliable because the counters
@@ -30,9 +30,9 @@
 #include <stdlib.h>
 #include <sys/fcntl.h>
 
-enum { LOCALLOCAL = 0, LOCALREMOTE = 1, REMOTELOCAL = 2 }; 
+enum { LOCALLOCAL = 0, LOCALREMOTE = 1, REMOTELOCAL = 2 };
 static int mem[] = { [LOCALLOCAL] = 0xa8, [LOCALREMOTE] = 0x98, [REMOTELOCAL] = 0x68 };
-static int io[] = {  [LOCALLOCAL] = 0xa4, [LOCALREMOTE] = 0x94, [REMOTELOCAL] = 0x64 }; 
+static int io[] = {  [LOCALLOCAL] = 0xa4, [LOCALREMOTE] = 0x94, [REMOTELOCAL] = 0x64 };
 static int *masks = mem;
 
 #define err(x) perror(x),exit(1)
@@ -60,7 +60,7 @@ int force = 0;
 int msrfd[MAXCPU];
 int delay;
 int absolute;
-char *cfilter; 
+char *cfilter;
 int verbose;
 
 void usage(void);
@@ -74,229 +74,229 @@ void Vprintf(char *fmt, ...)
 	va_end(ap);
 }
 
-unsigned long long rdmsr(int cpu, unsigned long msr) 
-{ 
-	unsigned long long val; 
+unsigned long long rdmsr(int cpu, unsigned long msr)
+{
+	unsigned long long val;
 	if (pread(msrfd[cpu], &val, 8, msr) != 8) {
-		fprintf(stderr, "rdmsr of %lx failed: %s\n", msr, strerror(errno));  
+		fprintf(stderr, "rdmsr of %lx failed: %s\n", msr, strerror(errno));
 		exit(1);
 	}
 	return val;
-} 
+}
 
 void wrmsr(int cpu, unsigned long msr, unsigned long long value)
-{ 
-	if (pwrite(msrfd[cpu], &value, 8, msr) != 8) { 
-		fprintf(stderr, "wdmsr of %lx failed: %s\n", msr, strerror(errno));  
+{
+	if (pwrite(msrfd[cpu], &value, 8, msr) != 8) {
+		fprintf(stderr, "wdmsr of %lx failed: %s\n", msr, strerror(errno));
 		exit(1);
-	} 
-} 
+	}
+}
 
-int cpufilter(int cpu) 
-{ 
-	long num; 
+int cpufilter(int cpu)
+{
+	long num;
 	char *end;
 	char *s;
 	
 	if (!cfilter)
 		return 1;	
-	for (s = cfilter;;) { 
-		num = strtoul(s, &end, 0); 
-		if (end == s) 
-			usage(); 
+	for (s = cfilter;;) {
+		num = strtoul(s, &end, 0);
+		if (end == s)
+			usage();
 		if (cpu == num)
 			return 1;
-		if (*end == ',') 
+		if (*end == ',')
 			s = end+1;
-		else if (*end == 0) 
+		else if (*end == 0)
 			break;
 		else
-			usage(); 
+			usage();
 	}
 	return 0;
-} 
+}
 
 void checkcounter(int cpu, int clear)
-{ 
+{
 	int i;
-	for (i = 1; i < 4; i++) { 
+	for (i = 1; i < 4; i++) {
 		int clear_this = clear;
-		unsigned long long evtsel = rdmsr(cpu, PERFEVTSEL0 + i); 
+		unsigned long long evtsel = rdmsr(cpu, PERFEVTSEL0 + i);
 		Vprintf("%d: %x %Lx\n", cpu, PERFEVTSEL0 + i, evtsel);
-		if (!(evtsel & PERFEVTSEL_EN)) { 
-			Vprintf("reinit %d\n", cpu);  
-			wrmsr(cpu, PERFEVTSEL0 + i, BASE | masks[i - 1]); 
+		if (!(evtsel & PERFEVTSEL_EN)) {
+			Vprintf("reinit %d\n", cpu);
+			wrmsr(cpu, PERFEVTSEL0 + i, BASE | masks[i - 1]);
 			clear_this = 1;
-		} else if (evtsel == (BASE | (masks[i-1] << 8))) { 
-			/* everything fine */ 
-		} else if (force) { 
-			Vprintf("reinit force %d\n", cpu); 
-			wrmsr(cpu, PERFEVTSEL0 + i, BASE | (masks[i - 1] << 8)); 
+		} else if (evtsel == (BASE | (masks[i-1] << 8))) {
+			/* everything fine */
+		} else if (force) {
+			Vprintf("reinit force %d\n", cpu);
+			wrmsr(cpu, PERFEVTSEL0 + i, BASE | (masks[i - 1] << 8));
 			clear_this = 1;
 		} else {
 			fprintf(stderr, "perfctr %d cpu %d already used with %Lx\n",
-				i, cpu, evtsel); 
+				i, cpu, evtsel);
 			fprintf(stderr, "Consider using -f if you know what you're doing.\n");
 			exit(1);
 		}
-		if (clear_this) { 
+		if (clear_this) {
 			Vprintf("clearing %d\n", cpu);
-			wrmsr(cpu, PERFCTR0 + i, 0); 
+			wrmsr(cpu, PERFCTR0 + i, 0);
 		}
-	} 
-} 
+	}
+}
 
 void setup(int clear)
-{ 
-	DIR *dir; 
+{
+	DIR *dir;
 	struct dirent *d;
 	int numcpus = 0;
 
-	memset(msrfd, -1, sizeof(msrfd)); 
+	memset(msrfd, -1, sizeof(msrfd));
 	dir = opendir("/dev/cpu");
-	if (!dir) 
-		err("cannot open /dev/cpu"); 
-	while ((d = readdir(dir)) != NULL) { 
+	if (!dir)
+		err("cannot open /dev/cpu");
+	while ((d = readdir(dir)) != NULL) {
 		char buf[64];
-		char *end; 
-		long cpunum = strtoul(d->d_name, &end, 0); 
-		if (*end != 0) 
-			continue; 
+		char *end;
+		long cpunum = strtoul(d->d_name, &end, 0);
+		if (*end != 0)
+			continue;
 		if (cpunum > MAXCPU) {
-			fprintf(stderr, "too many cpus %ld %s\n", cpunum, d->d_name); 
+			fprintf(stderr, "too many cpus %ld %s\n", cpunum, d->d_name);
 			continue;
 		}
 		if (!cpufilter(cpunum))
-			continue; 
+			continue;
 		snprintf(buf, 63, "/dev/cpu/%ld/msr", cpunum);
-		msrfd[cpunum] = open64(buf, O_RDWR); 
+		msrfd[cpunum] = open64(buf, O_RDWR);
 		if (msrfd[cpunum] < 0)
 			continue;
 		numcpus++;
-		checkcounter(cpunum, clear); 
-	} 
+		checkcounter(cpunum, clear);
+	}
 	closedir(dir);		
 	if (numcpus == 0) {
-		fprintf(stderr, "No CPU found using MSR driver.\n"); 
+		fprintf(stderr, "No CPU found using MSR driver.\n");
 		exit(1);
 	}
-} 
+}
 
 void printf_padded(int pad, char *fmt, ...)
 {
-	char buf[pad + 1]; 
+	char buf[pad + 1];
 	va_list ap;
 	va_start(ap, fmt);
-	vsnprintf(buf, pad, fmt, ap); 
-	printf("%-*s", pad, buf); 
+	vsnprintf(buf, pad, fmt, ap);
+	printf("%-*s", pad, buf);
 	va_end(ap);
 }
 
 void print_header(void)
 {
-	printf_padded(4, "CPU "); 
-	printf_padded(16, "LOCAL"); 
-	printf_padded(16, "LOCAL->REMOTE"); 
-	printf_padded(16, "REMOTE->LOCAL"); 
+	printf_padded(4, "CPU ");
+	printf_padded(16, "LOCAL");
+	printf_padded(16, "LOCAL->REMOTE");
+	printf_padded(16, "REMOTE->LOCAL");
 	putchar('\n');
 }
 
 void print_cpu(int cpu)
-{ 
+{
 	int i;
-	static unsigned long long lastval[4]; 
+	static unsigned long long lastval[4];
 	printf_padded(4, "%d", cpu);
-	for (i = 1; i < 4; i++) { 
+	for (i = 1; i < 4; i++) {
 		unsigned long long val = rdmsr(cpu, PERFCTR0 + i);
-		if (absolute) 
-			printf_padded(16, "%Lu", val); 
+		if (absolute)
+			printf_padded(16, "%Lu", val);
 		else
 			printf_padded(16, "%Lu", val - lastval[i]);		
 		lastval[i] = val;
-	} 
+	}
 	putchar('\n');
-} 
+}
 
 void dumpall(void)
 {
 	int cnt = 0;
 	int cpu;
 	print_header();
-	for (;;) { 
-		for (cpu = 0; cpu < MAXCPU; ++cpu) { 
-			if (msrfd[cpu] < 0) 
+	for (;;) {
+		for (cpu = 0; cpu < MAXCPU; ++cpu) {
+			if (msrfd[cpu] < 0)
 				continue;
 			print_cpu(cpu);
 		}
-		if (!delay) 
+		if (!delay)
 			break;
 		sleep(delay);
-		if (++cnt > 40) { 
+		if (++cnt > 40) {
 			cnt = 0;
 			print_header();
 		}
 	} 		
-} 
+}
 
 void checkk8(void)
-{ 
+{
 	char *line = NULL;
 	size_t size = 0;
 	int bad = 0;
 	FILE *f = fopen("/proc/cpuinfo", "r");
-	if (!f) 
+	if (!f)
 		return;	
-	while (getline(&line, &size, f) > 0) { 
-		if (!strncmp("vendor_id", line, 9)) { 
+	while (getline(&line, &size, f) > 0) {
+		if (!strncmp("vendor_id", line, 9)) {
 			if (!strstr(line, "AMD"))
-				bad++; 
-		} 
-		if (!strncmp("cpu family", line, 10)) { 
+				bad++;
+		}
+		if (!strncmp("cpu family", line, 10)) {
 			char *s = line + strcspn(line,":");
 			int family;
 			if (*s == ':') ++s;
-			family = strtoul(s, NULL, 0); 
+			family = strtoul(s, NULL, 0);
 			if (family != 15)
 				bad++;
-		} 
-	} 
+		}
+	}
 	if (bad) {
-		printf("not a opteron cpu\n"); 
+		printf("not a opteron cpu\n");
 		exit(1);
 	}
 	free(line);
 	fclose(f);
-} 
+}
 
 void usage(void)
 {
-	fprintf(stderr, "usage: numamon [args] [delay]\n"); 
+	fprintf(stderr, "usage: numamon [args] [delay]\n");
 	fprintf(stderr, "       -f forcibly overwrite counters\n");
 	fprintf(stderr, "       -i count IO (default memory)\n"); 	
 	fprintf(stderr, "       -a print absolute counter values (with delay)\n");
 	fprintf(stderr, "       -s setup counters and exit\n"); 	
 	fprintf(stderr, "       -c clear counters and exit\n"); 	
 	fprintf(stderr, "       -m Print memory traffic (default)\n"); 	
-	fprintf(stderr, "       -C cpu{,cpu} only print for cpus\n"); 
+	fprintf(stderr, "       -C cpu{,cpu} only print for cpus\n");
 	fprintf(stderr, "       -v Be verbose\n");
 	exit(1);
-} 
+}
 
-int main(int ac, char **av) 
-{ 
+int main(int ac, char **av)
+{
 	int opt;
-	checkk8(); 
-	while ((opt = getopt(ac,av,"ifscmaC:v")) != -1) { 
-		switch (opt) { 
-		case 'f': 
-			force = 1; 
+	checkk8();
+	while ((opt = getopt(ac,av,"ifscmaC:v")) != -1) {
+		switch (opt) {
+		case 'f':
+			force = 1;
 			break;
-		case 'c': 
+		case 'c':
 			setup(1);
-			exit(0); 
-		case 's': 
-			setup(0); 
-			exit(0); 
+			exit(0);
+		case 's':
+			setup(0);
+			exit(0);
 		case 'm':
 			masks = mem;
 			break;
@@ -312,20 +312,20 @@ int main(int ac, char **av)
 		case 'v':
 			verbose = 1;
 			break;
-		default: 
+		default:
 			usage();
 		}
-	} 
-	if (av[optind]) { 
-		char *end; 
-		delay = strtoul(av[optind], &end, 10); 
-		if (*end) 
-			usage(); 
+	}
+	if (av[optind]) {
+		char *end;
+		delay = strtoul(av[optind], &end, 10);
+		if (*end)
+			usage();
 		if (av[optind+1])
 			usage();
-	} 
+	}
 
-	setup(0); 
+	setup(0);
 	dumpall();
 	return 0;
-} 
+}
Index: numactl-dev/shm.c
===================================================================
--- numactl-dev.orig/shm.c
+++ numactl-dev/shm.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003,2004 Andi Kleen, SuSE Labs.
-   Manage shared memory policy for numactl. 
+   Manage shared memory policy for numactl.
    The actual policy is set in numactl itself, this just sets up and maps
    the shared memory segments and dumps them.
 
@@ -14,7 +14,7 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
+   on your Linux system; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 
 #define _GNU_SOURCE 1
@@ -40,18 +40,18 @@ char *shmptr;
 unsigned long long shmlen;
 mode_t shmmode = 0600;
 unsigned long long shmoffset;
-int shmflags; 
+int shmflags;
 static int shm_pagesize;
 
 long huge_page_size(void)
-{ 
+{
 	size_t len = 0;
 	char *line = NULL;
-	FILE *f = fopen("/proc/meminfo", "r"); 
+	FILE *f = fopen("/proc/meminfo", "r");
 	if (f != NULL) {
-		while (getdelim(&line, &len, '\n', f) > 0) { 
+		while (getdelim(&line, &len, '\n', f) > 0) {
 			int ps;
-			if (sscanf(line, "Hugepagesize: %d kB", &ps) == 1) 
+			if (sscanf(line, "Hugepagesize: %d kB", &ps) == 1)
 				return ps * 1024;
 		}
 		free(line);
@@ -62,10 +62,10 @@ long huge_page_size(void)
 
 static void check_region(void)
 {
-	if (((unsigned long)shmptr % shm_pagesize) || (shmlen % shm_pagesize)) { 
+	if (((unsigned long)shmptr % shm_pagesize) || (shmlen % shm_pagesize)) {
 		fprintf(stderr, "numactl: policy region not page aligned\n");
 		exit(1);
-	} 
+	}
 }
 
 static key_t sysvkey(char *name)
@@ -81,39 +81,39 @@ static key_t sysvkey(char *name)
 	if (fd < 0)
 		nerror("cannot create key for shm %s\n", name);	
 	key = ftok(name, shmid);
-	if (key < 0) 
-		nerror("cannot get key for newly created shm key file %s", 
+	if (key < 0)
+		nerror("cannot get key for newly created shm key file %s",
 		       name);
-	return key; 
+	return key;
 }
 
 /* Attach a sysv style shared memory segment. */
-void attach_sysvshm(char *name) 
-{ 
+void attach_sysvshm(char *name)
+{
 	struct shmid_ds s;
 	key_t key = sysvkey(name);
 	
 	shmfd = shmget(key, shmlen, shmflags);
-	if (shmfd < 0 && errno == ENOENT) { 
+	if (shmfd < 0 && errno == ENOENT) {
 		if (shmlen == 0)
 			complain(
                      "need a --length to create a sysv shared memory segment");
-		fprintf(stderr, 
+		fprintf(stderr,
          "numactl: Creating shared memory segment %s id %ld mode %04o length %.fMB\n",
 			name, shmid, shmmode, ((double)shmlen) / (1024*1024) );
 		shmfd = shmget(key, shmlen, IPC_CREAT|shmmode|shmflags);
-		if (shmfd < 0) 
+		if (shmfd < 0)
 			nerror("cannot create shared memory segment");
 	}
 
-	if (shmlen == 0) { 
-		if (shmctl(shmfd, IPC_STAT, &s) < 0) 
+	if (shmlen == 0) {
+		if (shmctl(shmfd, IPC_STAT, &s) < 0)
 			err("shmctl IPC_STAT");
 		shmlen = s.shm_segsz;
 	}
 
 	shmptr = shmat(shmfd, NULL, SHM_RDONLY);
-	if (shmptr == (void*)-1) 
+	if (shmptr == (void*)-1)
 		err("shmat");
 	shmptr += shmoffset;
 
@@ -127,21 +127,21 @@ void attach_shared(char *name)
 {
 	struct stat64 st;
 
-	shmfd = open(name, O_RDONLY); 
-	if (shmfd < 0) { 
+	shmfd = open(name, O_RDONLY);
+	if (shmfd < 0) {
 		errno = 0;
 		if (shmlen == 0)
 		        complain("need a --length to create a shared file");
 		shmfd = open(name, O_RDWR|O_CREAT, shmmode);
-		if (shmfd < 0) 
+		if (shmfd < 0)
 			nerror("cannot create file %s", name);
-	} 
-	if (fstat64(shmfd, &st) < 0) 
+	}
+	if (fstat64(shmfd, &st) < 0)
 		err("shm stat");
 	if (shmlen > st.st_size) {
-		if (ftruncate64(shmfd, shmlen) < 0) { 
-			/* XXX: we could do it by hand, but it would it 
-			   would be impossible to apply policy then. 
+		if (ftruncate64(shmfd, shmlen) < 0) {
+			/* XXX: we could do it by hand, but it would it
+			   would be impossible to apply policy then.
 			   need to fix that in the kernel. */
 			perror("ftruncate");
 		}
@@ -152,31 +152,31 @@ void attach_shared(char *name)
 	check_region();
 	
 	/* RED-PEN For shmlen > address space may need to map in pieces.
-	   Left for some poor 32bit soul. */   
+	   Left for some poor 32bit soul. */
 	shmptr = mmap64(NULL, shmlen, PROT_READ, MAP_SHARED, shmfd, shmoffset);
 	if (shmptr == (char*)-1)
 		err("shm mmap");			
 
-} 
+}
 
-static void 
+static void
 dumppol(unsigned long long start, unsigned long long end, int pol, struct bitmask *mask)
-{ 
+{
 	if (pol == MPOL_DEFAULT)
 		return;
-	printf("%016Lx-%016Lx: %s ", 
-	       shmoffset+start, 
-	       shmoffset+end, 
+	printf("%016Lx-%016Lx: %s ",
+	       shmoffset+start,
+	       shmoffset+end,
 	       policy_name(pol));
 	printmask("", mask);
-} 
+}
 
 /* Dump policies in a shared memory segment. */
-void dump_shm(void) 
-{ 
+void dump_shm(void)
+{
 	struct bitmask *nodes, *prevnodes;
-	int prevpol = -1, pol; 
-	unsigned long long c, start; 
+	int prevpol = -1, pol;
+	unsigned long long c, start;
 
 	start = 0;
 	if (shmlen == 0) {
@@ -187,20 +187,20 @@ void dump_shm(void)
 	nodes = numa_allocate_nodemask();
 	prevnodes = numa_allocate_nodemask();
 
-	for (c = 0; c < shmlen; c += shm_pagesize) { 
+	for (c = 0; c < shmlen; c += shm_pagesize) {
 		if (get_mempolicy(&pol, nodes->maskp, nodes->size, c+shmptr,
 						MPOL_F_ADDR) < 0)
 			err("get_mempolicy on shm");
-		if (pol == prevpol) 
+		if (pol == prevpol)
 			continue;
 		if (prevpol != -1)
 			dumppol(start, c, prevpol, prevnodes);
 		prevnodes = nodes;
 		prevpol = pol;
 		start = c;
-	} 
+	}
 	dumppol(start, c, prevpol, prevnodes);
-} 
+}
 
 static void dumpnode(unsigned long long start, unsigned long long end, int node)
 {
@@ -233,16 +233,16 @@ void dump_shm_nodes(void)
 	dumpnode(start, c, prevnode);
 }
 
-static void vwarn(char *ptr, char *fmt, ...) 
-{ 
+static void vwarn(char *ptr, char *fmt, ...)
+{
 	va_list ap;
 	unsigned long off = (unsigned long)ptr - (unsigned long)shmptr;
 	va_start(ap,fmt);
 	printf("numactl verify %lx(%lx): ",  (unsigned long)ptr, off);
 	vprintf(fmt, ap);
-	va_end(ap); 
+	va_end(ap);
 	exitcode = 1;
-} 
+}
 
 static unsigned interleave_next(unsigned cur, struct bitmask *mask)
 {
@@ -251,14 +251,14 @@ static unsigned interleave_next(unsigned
 	++cur;
 	while (!numa_bitmask_isbitset(mask, cur)) {
 		cur = (cur+1) % numa_num_nodes;
-	} 
+	}
 	return cur;
 }
 
 /* Verify policy in a shared memory segment */
 void verify_shm(int policy, struct bitmask *nodes)
 {
-	char *p; 
+	char *p;
 	int ilnode, node;
 	int pol2;
 	struct bitmask *nodes2;
@@ -268,35 +268,35 @@ void verify_shm(int policy, struct bitma
 	if (policy == MPOL_INTERLEAVE) {
 		if (get_mempolicy(&ilnode, NULL, 0, shmptr,
 					MPOL_F_ADDR|MPOL_F_NODE)
-		    < 0) 
+		    < 0)
 			err("get_mempolicy");
-	} 
+	}
 	
-	for (p = shmptr; p - (char *)shmptr < shmlen; p += shm_pagesize) { 
+	for (p = shmptr; p - (char *)shmptr < shmlen; p += shm_pagesize) {
 		if (get_mempolicy(&pol2, nodes2->maskp, nodes2->size, p,
 							MPOL_F_ADDR) < 0)
 			err("get_mempolicy");
-		if (pol2 != policy) { 
-			vwarn(p, "wrong policy %s, expected %s\n", 
+		if (pol2 != policy) {
+			vwarn(p, "wrong policy %s, expected %s\n",
 			      policy_name(pol2), policy_name(policy));
 			return;
 		}
 		if (memcmp(nodes2, nodes, numa_bitmask_nbytes(nodes))) {
-			vwarn(p, "mismatched node mask\n"); 
+			vwarn(p, "mismatched node mask\n");
 			printmask("expected", nodes);
 			printmask("real", nodes2);
-		} 
+		}
 
-		if (get_mempolicy(&node, NULL, 0, p, MPOL_F_ADDR|MPOL_F_NODE) < 0) 
+		if (get_mempolicy(&node, NULL, 0, p, MPOL_F_ADDR|MPOL_F_NODE) < 0)
 			err("get_mempolicy");
 
-		switch (policy) { 
-		case MPOL_INTERLEAVE: 
+		switch (policy) {
+		case MPOL_INTERLEAVE:
 			if (node < 0 || !numa_bitmask_isbitset(nodes2, node))
 				vwarn(p, "interleave node out of range %d\n", node);
-			if (node != ilnode) { 
+			if (node != ilnode) {
 				vwarn(p, "expected interleave node %d, got %d\n",
-				     ilnode,node); 
+				     ilnode,node);
 				return;
 			}
 			ilnode = interleave_next(ilnode, nodes2);
@@ -309,10 +309,10 @@ void verify_shm(int policy, struct bitma
 			}	
 			break;
 
-		case MPOL_DEFAULT: 
-			break; 
+		case MPOL_DEFAULT:
+			break;
 			
 		}
-	} 
+	}
 		
 }
Index: numactl-dev/stream_lib.c
===================================================================
--- numactl-dev.orig/stream_lib.c
+++ numactl-dev/stream_lib.c
@@ -20,7 +20,7 @@ static inline double mysecond()
  * Revision: 4.0-BETA, October 24, 1995
  * Original code developed by John D. McCalpin
  *
- * This program measures memory transfer rates in MB/s for simple 
+ * This program measures memory transfer rates in MB/s for simple
  * computational kernels coded in C.  These numbers reveal the quality
  * of code generation for simple uncacheable kernels as well as showing
  * the cost of floating-point operations relative to memory accesses.
@@ -28,10 +28,10 @@ static inline double mysecond()
  * INSTRUCTIONS:
  *
  *	1) Stream requires a good bit of memory to run.  Adjust the
- *          value of 'N' (below) to give a 'timing calibration' of 
+ *          value of 'N' (below) to give a 'timing calibration' of
  *          at least 20 clock-ticks.  This will provide rate estimates
  *          that should be good to about 5% precision.
- * 
+ *
  * Hacked by AK to be a library
  */
 
@@ -235,20 +235,20 @@ int checktick()
 }
 
 void stream_setmem(unsigned long size)
-{ 
+{
 	N = (size - OFFSET) / (3*sizeof(double));
-} 
+}
 
 long stream_memsize(void)
-{ 
+{
 	return 3*(sizeof(double) * (N+OFFSET)) ;
-} 
+}
 
-long stream_init(void *mem) 
-{ 
+long stream_init(void *mem)
+{
 	int i;
 
-	for (i = 0; i < 4; i++) { 
+	for (i = 0; i < 4; i++) {
 		rmstime[i] = 0;
 		maxtime[i] = 0;
 		mintime[i] = FLT_MAX;
@@ -264,4 +264,4 @@ long stream_init(void *mem)
 	c = (double *)mem + 2*(N+OFFSET);
 	stream_check();
 	return 0;
-} 
+}
Index: numactl-dev/stream_lib.h
===================================================================
--- numactl-dev.orig/stream_lib.h
+++ numactl-dev/stream_lib.h
@@ -4,7 +4,7 @@ long stream_init(void *mem);
 void stream_test(double *res);
 void stream_check(void);
 void stream_setmem(unsigned long size);
-extern int stream_verbose; 
+extern int stream_verbose;
 extern char *stream_names[];
 
 
Index: numactl-dev/stream_main.c
===================================================================
--- numactl-dev.orig/stream_main.c
+++ numactl-dev/stream_main.c
@@ -21,7 +21,7 @@ int main(int ac, char **av)
 	long size;
 	int policy;
 
-	policy = parse_policy(av[1], av[2]); 
+	policy = parse_policy(av[1], av[2]);
 
         nodes = numa_allocate_nodemask();
 
@@ -31,13 +31,13 @@ int main(int ac, char **av)
 		printf ("<%s> is invalid\n", av[2]);
 		exit(1);
 	}
-	size = stream_memsize();  
+	size = stream_memsize();
 	map = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-		   0, 0); 
-	if (map == (char*)-1) exit(1); 
+		   0, 0);
+	if (map == (char*)-1) exit(1);
 	if (mbind(map, size, policy, nodes->maskp, nodes->size, 0) < 0)
 		perror("mbind"), exit(1);
-	stream_init(map); 
+	stream_init(map);
 	stream_test(NULL);
 	return 0;
 }
Index: numactl-dev/syscall.c
===================================================================
--- numactl-dev.orig/syscall.c
+++ numactl-dev/syscall.c
@@ -11,7 +11,7 @@
    Lesser General Public License for more details.
 
    You should find a copy of v2.1 of the GNU Lesser General Public License
-   somewhere on your Linux system; if not, write to the Free Software 
+   somewhere on your Linux system; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 #include <unistd.h>
 #include <sys/types.h>
@@ -119,23 +119,23 @@
 /* 6 argument calls on x86-64 are often buggy in both glibc and
    asm/unistd.h. Add a working version here. */
 long syscall6(long call, long a, long b, long c, long d, long e, long f)
-{ 
+{
        long res;
-       asm volatile ("movq %[d],%%r10 ; movq %[e],%%r8 ; movq %[f],%%r9 ; syscall" 
+       asm volatile ("movq %[d],%%r10 ; movq %[e],%%r8 ; movq %[f],%%r9 ; syscall"
 		     : "=a" (res)
-		     : "0" (call),"D" (a),"S" (b), "d" (c), 
+		     : "0" (call),"D" (a),"S" (b), "d" (c),
 		       [d] "g" (d), [e] "g" (e), [f] "g" (f) :
 		     "r11","rcx","r8","r10","r9","memory" );
-       if (res < 0) { 
-	       errno = -res; 
-	       res = -1; 
-       } 
+       if (res < 0) {
+	       errno = -res;
+	       res = -1;
+       }
        return res;
-} 
+}
 #elif defined(__i386__)
 
-/* i386 has buggy syscall6 in glibc too. This is tricky to do 
-   in inline assembly because it clobbers so many registers. Do it 
+/* i386 has buggy syscall6 in glibc too. This is tricky to do
+   in inline assembly because it clobbers so many registers. Do it
    out of line. */
 asm(
 "__syscall6:\n"
@@ -160,14 +160,14 @@ asm(
 extern long __syscall6(long n, long a, long b, long c, long d, long e, long f);
 
 long syscall6(long call, long a, long b, long c, long d, long e, long f)
-{ 
+{
        long res = __syscall6(call,a,b,c,d,e,f);
-       if (res < 0) { 
-	       errno = -res; 
-	       res = -1; 
-       } 
+       if (res < 0) {
+	       errno = -res;
+	       res = -1;
+       }
        return res;
-} 
+}
 
 #else
 #define syscall6 syscall
@@ -180,14 +180,14 @@ long WEAK get_mempolicy(int *policy, con
 					maxnode, addr, flags);
 }
 
-long WEAK mbind(void *start, unsigned long len, int mode, 
+long WEAK mbind(void *start, unsigned long len, int mode,
 	const unsigned long *nmask, unsigned long maxnode, unsigned flags)
 {
 	return syscall6(__NR_mbind, (long)start, len, mode, (long)nmask,
 				maxnode, flags);
 }
 
-long WEAK set_mempolicy(int mode, const unsigned long *nmask, 
+long WEAK set_mempolicy(int mode, const unsigned long *nmask,
                                    unsigned long maxnode)
 {
 	long i;
Index: numactl-dev/threadtest.c
===================================================================
--- numactl-dev.orig/threadtest.c
+++ numactl-dev/threadtest.c
@@ -1,3 +1,3 @@
 /* Test if gcc supports thread */
-int __thread x; 
-int main(void) { return x; } 
+int __thread x;
+int main(void) { return x; }
Index: numactl-dev/util.c
===================================================================
--- numactl-dev.orig/util.c
+++ numactl-dev/util.c
@@ -11,7 +11,7 @@
    General Public License for more details.
 
    You should find a copy of v2 of the GNU General Public License somewhere
-   on your Linux system; if not, write to the Free Software Foundation, 
+   on your Linux system; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 #include "numa.h"
 #include "numaif.h"
@@ -26,18 +26,18 @@
 #include <unistd.h>
 
 void printmask(char *name, struct bitmask *mask)
-{ 
+{
 	int i;
 
-	printf("%s: ", name); 
+	printf("%s: ", name);
 	for (i = 0; i <= mask->size; i++)
 		if (numa_bitmask_isbitset(mask, i))
-			printf("%d ", i); 
+			printf("%d ", i);
 	putchar('\n');
-} 
+}
 
 void printcpumask(char *name, struct bitmask *mask)
-{ 
+{
 	int i;
 	printf("%s: ", name);
 	for (i = 0; i < mask->size; i++) {
@@ -45,92 +45,92 @@ void printcpumask(char *name, struct bit
 			printf("%d ", i);
 	}
 	putchar('\n');
-} 
+}
 
 void complain(char *fmt, ...)
 {
 	va_list ap;
-	va_start(ap, fmt); 
+	va_start(ap, fmt);
 	fprintf(stderr, "numactl: ");
-	vfprintf(stderr,fmt,ap); 
+	vfprintf(stderr,fmt,ap);
 	putchar('\n');
-	va_end(ap); 
-	exit(1); 
+	va_end(ap);
+	exit(1);
 }
 
-void nerror(char *fmt, ...) 
-{ 
+void nerror(char *fmt, ...)
+{
 	int err = errno;
 	va_list ap;
-	va_start(ap,fmt); 
+	va_start(ap,fmt);
 	fprintf(stderr, "numactl: ");
-	vfprintf(stderr, fmt, ap); 
+	vfprintf(stderr, fmt, ap);
 	va_end(ap);
-	if (err) 
+	if (err)
 		fprintf(stderr,": %s\n", strerror(err));
 	else
 		fputc('\n', stderr);
 	exit(1);
-} 
+}
 
-long memsize(char *s) 
-{ 
+long memsize(char *s)
+{
 	char *end;
 	long length = strtoul(s,&end,0);
-	switch (toupper(*end)) { 
+	switch (toupper(*end)) {
 	case 'G': length *= 1024;  /*FALL THROUGH*/
 	case 'M': length *= 1024;  /*FALL THROUGH*/
 	case 'K': length *= 1024; break;
 	}
-	return length; 
-} 
+	return length;
+}
 
 
-static struct policy { 
+static struct policy {
 	char *name;
-	int policy; 
-	int noarg; 
-} policies[] = { 
-	{ "interleave", MPOL_INTERLEAVE, }, 
-	{ "membind",    MPOL_BIND, }, 
-	{ "preferred",   MPOL_PREFERRED, }, 
-	{ "default",    MPOL_DEFAULT, 1 }, 
+	int policy;
+	int noarg;
+} policies[] = {
+	{ "interleave", MPOL_INTERLEAVE, },
+	{ "membind",    MPOL_BIND, },
+	{ "preferred",   MPOL_PREFERRED, },
+	{ "default",    MPOL_DEFAULT, 1 },
 	{ NULL },
 };
 
-static char *policy_names[] = { "default", "preferred", "bind", "interleave" }; 
+static char *policy_names[] = { "default", "preferred", "bind", "interleave" };
 
 char *policy_name(int policy)
 {
 	static char buf[32];
 	if (policy >= array_len(policy_names)) {
-		sprintf(buf, "[%d]", policy); 
+		sprintf(buf, "[%d]", policy);
 		return buf;
 	}
 	return policy_names[policy];
 }
 
-int parse_policy(char *name, char *arg) 
-{ 
+int parse_policy(char *name, char *arg)
+{
 	int k;
-	struct policy *p = NULL; 
-	if (!name) 
+	struct policy *p = NULL;
+	if (!name)
 		return MPOL_DEFAULT;
-	for (k = 0; policies[k].name; k++) { 
+	for (k = 0; policies[k].name; k++) {
 		p = &policies[k];
 		if (!strcmp(p->name, name))
-			break; 
+			break;
 	}
-	if (!p || !p->name || (!arg && !p->noarg)) 
-		usage(); 
+	if (!p || !p->name || (!arg && !p->noarg))
+		usage();
     return p->policy;
-} 
+}
 
 void print_policies(void)
 {
 	int i;
 	printf("Policies:");
-	for (i = 0; policies[i].name; i++) 
+	for (i = 0; policies[i].name; i++)
 		printf(" %s", policies[i].name);
-	printf("\n"); 
+	printf("\n");
 }
