[PATCH 05/08] - Fix Parsing of maxproc{cpu|node} in set_thread_constraints() Against: numactl-2.0.3-rc2 NOTE: a patch to fix this has already been posted to linux-numa by Brice Goglin. This is the version that I had in my tree. Hard-coded '+15' was dropping the first character of the mask. This caused, e.g., numactl to error out on last 4 processors of a platform--on a 32-cpu system, in my case. That's a tab separating the tag from the mask, so look for tab explicitly. libnuma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) Index: numactl-2.0.3-rc2/libnuma.c =================================================================== --- numactl-2.0.3-rc2.orig/libnuma.c 2009-02-13 11:17:57.000000000 -0500 +++ numactl-2.0.3-rc2/libnuma.c 2009-02-13 11:32:35.000000000 -0500 @@ -373,6 +373,9 @@ read_mask(char *s, struct bitmask *bmp) unsigned int *start = tmp; unsigned int i, n = 0, m = 0; + if (!s) + return 0; /* shouldn't happen */ + i = strtoul(s, &end, 16); /* Skip leading zeros */ @@ -445,12 +448,15 @@ set_thread_constraints(void) } while (getline(&buffer, &buflen, f) > 0) { + /* mask starts after [last] tab */ + char *mask = strrchr(buffer,'\t') + 1; + if (strncmp(buffer,"Cpus_allowed:",13) == 0) - maxproccpu = read_mask(buffer + 15, numa_all_cpus_ptr); + maxproccpu = read_mask(mask, numa_all_cpus_ptr); if (strncmp(buffer,"Mems_allowed:",13) == 0) { maxprocnode = - read_mask(buffer + 15, numa_all_nodes_ptr); + read_mask(mask, numa_all_nodes_ptr); } } fclose(f); -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html