They don't have CPU_COUNT(), so add a helper for that.
Signed-off-by: Jens Axboe <axboe@fb.com>
echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
+##########################################
+# CPU_COUNT test
+cpu_count="no"
+cat > $TMPC << EOF
+#include <sched.h>
+int main(int argc, char **argv)
+{
+ cpu_set_t mask;
+ return CPU_COUNT(&mask);
+}
+EOF
+if compile_prog "" "" "cpu_count"; then
+ cpu_count="yes"
+fi
+echo "CPU_COUNT $cpu_count"
+
##########################################
# clock_gettime probe
clock_gettime="no"
##########################################
# clock_gettime probe
clock_gettime="no"
if test "$rbd" = "yes" ; then
output_sym "CONFIG_RBD"
fi
if test "$rbd" = "yes" ; then
output_sym "CONFIG_RBD"
fi
+if test "$cpu_count" = "yes" ; then
+ output_sym "CONFIG_CPU_COUNT"
+fi
echo "LIBS+=$LIBS" >> $config_host_mak
echo "CFLAGS+=$CFLAGS" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "CFLAGS+=$CFLAGS" >> $config_host_mak
+#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)
{
#ifndef FIO_HAVE_GETTID
static inline int gettid(void)
{