Fix compile on CentOS/RHEL5
They don't have CPU_COUNT(), so add a helper for that.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/os/os.h b/os/os.h
index a6bc17f..7f92d1b 100644
--- a/os/os.h
+++ b/os/os.h
@@ -327,6 +327,22 @@
}
#endif
+#ifndef CONFIG_CPU_COUNT
+#ifdef FIO_HAVE_CPU_AFFINITY
+static inline int CPU_COUNT(os_cpu_mask_t *mask)
+{
+ int max_cpus = cpus_online();
+ int nr_cpus, i;
+
+ for (i = 0, nr_cpus = 0; i < max_cpus; i++)
+ if (fio_cpu_isset(mask, i))
+ nr_cpus++;
+
+ return nr_cpus;
+}
+#endif
+#endif
+
#ifndef FIO_HAVE_GETTID
static inline int gettid(void)
{