Detect Windows operating system in ./configure
[fio.git] / os / os.h
diff --git a/os/os.h b/os/os.h
index 4b5903471bf8a421c0571d3d8a2de4461d74b417..7f92d1bc710bbf84a13c582a7e0d5c7893b36697 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -17,6 +17,7 @@ enum {
        os_hpux,
        os_mac,
        os_netbsd,
+       os_openbsd,
        os_solaris,
        os_windows,
        os_android,
@@ -30,6 +31,8 @@ enum {
 #include "os-linux.h"
 #elif defined(__FreeBSD__)
 #include "os-freebsd.h"
+#elif defined(__OpenBSD__)
+#include "os-openbsd.h"
 #elif defined(__NetBSD__)
 #include "os-netbsd.h"
 #elif defined(__sun__)
@@ -77,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
@@ -321,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)
 {