Correct ifdef checks for posix and linux fallocate
[fio.git] / os / os-windows.h
index 06fe4335beb7bda4095dd3304c8deab454ecfb38..3a8563744af6fefb1235d9c868af5890e09f419b 100644 (file)
 #include "../file.h"
 #include "../log.h"
 
+#include "windows/posix.h"
+
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_CPU_AFFINITY
 #define FIO_HAVE_CHARDEV_SIZE
 #define FIO_HAVE_FDATASYNC
 #define FIO_HAVE_WINDOWSAIO
 #define FIO_HAVE_GETTID
-#define FIO_HAVE_CLOCK_MONOTONIC
 #define FIO_USE_GENERIC_RAND
 
 #define FIO_PREFERRED_ENGINE           "windowsaio"
 
 #define FIO_MAX_CPUS   MAXIMUM_PROCESSORS
 
-#define FIO_OS_HAVE_SOCKLEN_T
-typedef int fio_socklen_t;
-
 #define OS_MAP_ANON            MAP_ANON
 
-#define FIO_LITTLE_ENDIAN
 #define fio_swap16(x)  _byteswap_ushort(x)
 #define fio_swap32(x)  _byteswap_ulong(x)
 #define fio_swap64(x)  _byteswap_uint64(x)
 
-typedef off_t off64_t;
-typedef int clockid_t;
-
 typedef DWORD_PTR os_cpu_mask_t;
 
 #define CLOCK_REALTIME 1
@@ -81,6 +75,8 @@ typedef DWORD_PTR os_cpu_mask_t;
 #define POLLHUP        1
 
 #define SIGCONT        0
+#define SIGUSR1        1
+#define SIGUSR2 2
 
 typedef int sigset_t;
 typedef int siginfo_t;
@@ -93,7 +89,6 @@ struct sigaction
        void* (*sa_sigaction)(int, siginfo_t *, void*);
 };
 
-char *strsep(char **stringp, const char *delim);
 long sysconf(int name);
 
 int kill(pid_t pid, int sig);
@@ -184,7 +179,12 @@ static inline int fio_setaffinity(int pid, os_cpu_mask_t cpumask)
        h = OpenThread(THREAD_QUERY_INFORMATION | THREAD_SET_INFORMATION, TRUE, pid);
        if (h != NULL) {
                bSuccess = SetThreadAffinityMask(h, cpumask);
+               if (!bSuccess)
+                       log_err("fio_setaffinity failed: failed to set thread affinity (pid %d, mask %.16llx)\n", pid, cpumask);
+
                CloseHandle(h);
+       } else {
+               log_err("fio_setaffinity failed: failed to get handle for pid %d\n", pid);
        }
 
        return (bSuccess)? 0 : -1;
@@ -211,7 +211,7 @@ static inline void fio_cpu_clear(os_cpu_mask_t *mask, int cpu)
 
 static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu)
 {
-       *mask |= 1 << (cpu-1);
+       *mask |= 1 << cpu;
 }
 
 static inline int fio_cpuset_init(os_cpu_mask_t *mask)