Detect Windows operating system in ./configure
[fio.git] / os / os.h
diff --git a/os/os.h b/os/os.h
index 03d1e9a14565f8481dd93db480e1896dfde184ec..7f92d1bc710bbf84a13c582a7e0d5c7893b36697 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -80,7 +80,10 @@ typedef struct aiocb os_aiocb_t;
 #define fio_getaffinity(pid, mask)     do { } while (0)
 #define fio_cpu_clear(mask, cpu)       do { } while (0)
 #define fio_cpuset_exit(mask)          (-1)
+#define fio_cpus_split(mask, cpu)      (0)
 typedef unsigned long os_cpu_mask_t;
+#else
+extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
 #endif
 
 #ifndef FIO_HAVE_IOPRIO
@@ -324,6 +327,22 @@ static inline unsigned int cpus_online(void)
 }
 #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)
 {