Author: gnichols
Date: 2010-09-09 13:45:18 +0000 (Thu, 09 Sep 2010)
New Revision: 673
Modified:
trunk/tests/memory/threaded_memtest.c
Log:
631921 - memory cert (threaded_memtest) fails to compile on RHEL5
Modified: trunk/tests/memory/threaded_memtest.c
===================================================================
--- trunk/tests/memory/threaded_memtest.c 2010-09-09 13:43:10 UTC (rev 672)
+++ trunk/tests/memory/threaded_memtest.c 2010-09-09 13:45:18 UTC (rev 673)
@@ -87,7 +87,8 @@
/* short name of the program */
char *basename = NULL;
-/* set the affinity for the current task to the given CPU */
+#ifdef CPU_ALLOC
+/* RHEL6+ set the affinity for the current task to the given CPU */
/* This now uses dynamic cpu_sets as the convention cpu_set_t
was limited to 1024p */
int on_cpu(unsigned cpu){
@@ -104,7 +105,21 @@
}
return 0;
}
+#else
+/* use old setup - RHEL5*/
+int on_cpu(unsigned cpu){
+ cpu_set_t mask;
+ CPU_ZERO(&mask);
+ CPU_SET(cpu,&mask);
+ if (setaffinity(mask) < 0){
+ perror("sched_setaffinity");
+ return -1;
+ }
+ return 0;
+}
+#endif
+
/* Parse a memsize string like '34m' or '128k' into a long int */
long unsigned parse_memsize(const char *str) {
long unsigned size;