numactl/numactl-1.0.2-cpumask.patch

64 lines
2.1 KiB
Diff

diff -up numactl-1.0.2/numactl.c.orig numactl-1.0.2/numactl.c
--- numactl-1.0.2/numactl.c.orig 2007-09-21 06:23:51.000000000 -0400
+++ numactl-1.0.2/numactl.c 2008-04-25 09:10:05.000000000 -0400
@@ -355,14 +355,14 @@ int main(int ac, char **av)
break;
case 'C': /* --physcpubind */
{
- int ncpus;
+ int bufsz;
unsigned long *cpubuf;
dontshm("-C/--physcpubind");
- cpubuf = cpumask(optarg, &ncpus);
+ cpubuf = cpumask(optarg, &bufsz);
errno = 0;
check_cpubind(do_shm);
did_cpubind = 1;
- numa_sched_setaffinity(0, CPU_BYTES(ncpus), cpubuf);
+ numa_sched_setaffinity(0, bufsz, cpubuf);
checkerror("sched_setaffinity");
free(cpubuf);
break;
diff -up numactl-1.0.2/util.h.orig numactl-1.0.2/util.h
--- numactl-1.0.2/util.h.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.h 2008-04-25 09:10:05.000000000 -0400
@@ -1,7 +1,7 @@
extern void printmask(char *name, nodemask_t *mask);
extern void printcpumask(char *name, unsigned long *mask, int len);
extern nodemask_t nodemask(char *s);
-extern unsigned long *cpumask(char *s, int *ncpus);
+extern unsigned long *cpumask(char *s, int *bufsz);
extern int read_sysctl(char *name);
extern void complain(char *fmt, ...);
extern void nerror(char *fmt, ...);
diff -up numactl-1.0.2/util.c.orig numactl-1.0.2/util.c
--- numactl-1.0.2/util.c.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.c 2008-04-25 09:10:45.000000000 -0400
@@ -52,7 +52,7 @@ void printmask(char *name, nodemask_t *m
int numcpus;
/* caller must free buffer */
-unsigned long *cpumask(char *s, int *ncpus)
+unsigned long *cpumask(char *s, int *bufsz)
{
int invert = 0;
char *end;
@@ -92,7 +92,7 @@ unsigned long *cpumask(char *s, int *ncp
unsigned long arg2 = strtoul(++s, &end2, 0);
if (end2 == s)
complain("missing cpu argument %s\n", s);
- if (arg > numcpus)
+ if (arg >= numcpus)
complain("cpu argument %d out of range\n", arg);
while (++arg <= arg2)
set_bit(arg, cpubuf);
@@ -110,7 +110,7 @@ unsigned long *cpumask(char *s, int *ncp
set_bit(i, cpubuf);
}
}
- *ncpus = cpubufsize;
+ *bufsz = cpubufsize;
return cpubuf;
}