only use CPU_COUNT if it's available
authorSzilard Pall <pszilard@cbr.su.se>
Fri, 9 Nov 2012 01:38:37 +0000 (02:38 +0100)
committerSzilard Pall <pszilard@cbr.su.se>
Fri, 9 Nov 2012 02:12:22 +0000 (03:12 +0100)
The external affinity detection implemented by a6e1181 uses CPU_COUNT
from sched.h for a consistency check, but this macro is only available
with glibc 2.6 and later. Hence, a check for this macro was needed to
avoid issues with glibc <2.6

Change-Id: I6088972e9a5aabefb2b3fa3b38ac8d4ba32662f7

src/kernel/runner.c

index d8f8a383f57a41053695bff1c9ae5f43ed3bbbfb..63432012011cc85b2ed916317be5a5183d0cad07 100644 (file)
@@ -807,7 +807,9 @@ static void check_cpu_affinity_set(FILE *fplog, const t_commrec *cr,
     }
 
     /* Before proceeding with the actual check, make sure that the number of
-     * detected CPUs is >= the CPUs in the current set. */
+     * detected CPUs is >= the CPUs in the current set.
+     * We need to check for CPU_COUNT as it was added only in glibc 2.6. */
+#ifdef CPU_COUNT
     if (ncpus < CPU_COUNT(&mask_current))
     {
         if (debug)
@@ -817,6 +819,7 @@ static void check_cpu_affinity_set(FILE *fplog, const t_commrec *cr,
         }
         return;
     }
+#endif /* CPU_COUNT */
 
     bAllSet = TRUE;
     for (i = 0; (i < ncpus && i < CPU_SETSIZE); i++)