summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/os-aix.h4
-rw-r--r--os/os-android.h57
-rw-r--r--os/os-dragonfly.h204
-rw-r--r--os/os-freebsd.h44
-rw-r--r--os/os-hpux.h3
-rw-r--r--os/os-linux-syscall.h277
-rw-r--r--os/os-linux.h105
-rw-r--r--os/os-mac.h73
-rw-r--r--os/os-netbsd.h39
-rw-r--r--os/os-openbsd.h70
-rw-r--r--os/os-solaris.h3
-rw-r--r--os/os-windows.h16
-rw-r--r--os/os.h53
-rwxr-xr-xos/windows/eula.rtfbin1060 -> 1072 bytes
-rwxr-xr-xos/windows/examples.wxs112
-rwxr-xr-xos/windows/install.wxs8
-rwxr-xr-xos/windows/posix.c114
-rw-r--r--os/windows/posix/include/sys/ioctl.h7
18 files changed, 1008 insertions, 181 deletions
diff --git a/os/os-aix.h b/os/os-aix.h
index 3d677650..e204d6f2 100644
--- a/os/os-aix.h
+++ b/os/os-aix.h
@@ -14,8 +14,6 @@
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
-#define FIO_HAVE_PSHARED_MUTEX
-
#define OS_MAP_ANON MAP_ANON
#define OS_MSG_DONTWAIT 0
@@ -23,7 +21,7 @@
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
diff --git a/os/os-android.h b/os/os-android.h
index 96ff5ba2..1c3eb7db 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -12,20 +12,25 @@
#include <fcntl.h>
#include <errno.h>
#include <sched.h>
+#include <linux/unistd.h>
#include <linux/major.h>
#include <asm/byteorder.h>
-#include <byteswap.h>
+#include "./os-linux-syscall.h"
#include "binject.h"
#include "../file.h"
+#ifndef __has_builtin // Optional of course.
+ #define __has_builtin(x) 0 // Compatibility with non-clang compilers.
+#endif
+
#define FIO_HAVE_DISK_UTIL
#define FIO_HAVE_IOSCHED_SWITCH
#define FIO_HAVE_IOPRIO
+#define FIO_HAVE_IOPRIO_CLASS
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_BLKTRACE
-#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_FS_STAT
#define FIO_HAVE_TRIM
@@ -52,21 +57,28 @@
#define MAP_HUGETLB 0x40000 /* arch specific */
#endif
-
+#ifndef CONFIG_NO_SHM
/*
* The Android NDK doesn't currently export <sys/shm.h>, so define the
* necessary stuff here.
*/
-#include <linux/shm.h>
-#define SHM_HUGETLB 04000
+#if __ANDROID_API__ >= 26
+#define shmat bionic_shmat
+#define shmctl bionic_shmctl
+#define shmdt bionic_shmdt
+#define shmget bionic_shmget
+#endif
+#include <sys/shm.h>
+#undef shmat
+#undef shmctl
+#undef shmdt
+#undef shmget
-#define shmid_ds shmid64_ds
-#undef __key
+#define SHM_HUGETLB 04000
#include <stdio.h>
#include <linux/ashmem.h>
-#include <sys/mman.h>
#define ASHMEM_DEVICE "/dev/ashmem"
@@ -86,14 +98,14 @@ static inline int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf)
static inline int shmget (key_t __key, size_t __size, int __shmflg)
{
int fd,ret;
- char key[11];
-
+ char keybuf[11];
+
fd = open(ASHMEM_DEVICE, O_RDWR);
if (fd < 0)
return fd;
- sprintf(key,"%d",__key);
- ret = ioctl(fd, ASHMEM_SET_NAME, key);
+ sprintf(keybuf,"%d",__key);
+ ret = ioctl(fd, ASHMEM_SET_NAME, keybuf);
if (ret < 0)
goto error;
@@ -102,7 +114,7 @@ static inline int shmget (key_t __key, size_t __size, int __shmflg)
goto error;
return fd;
-
+
error:
close(fd);
return ret;
@@ -124,6 +136,7 @@ static inline int shmdt (const void *__shmaddr)
size = *ptr; //find mmap size which we stored at the beginning of the buffer
return munmap((void *)ptr, size + sizeof(size_t));
}
+#endif
#define SPLICE_DEF_SIZE (64*1024)
@@ -143,6 +156,12 @@ enum {
#define IOPRIO_BITS 16
#define IOPRIO_CLASS_SHIFT 13
+#define IOPRIO_MIN_PRIO 0 /* highest priority */
+#define IOPRIO_MAX_PRIO 7 /* lowest priority */
+
+#define IOPRIO_MIN_PRIO_CLASS 0
+#define IOPRIO_MAX_PRIO_CLASS 3
+
static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
{
/*
@@ -215,9 +234,19 @@ static inline long os_random_long(os_random_state_t *rs)
#define FIO_O_NOATIME 0
#endif
+/* Check for GCC or Clang byte swap intrinsics */
+#if (__has_builtin(__builtin_bswap16) && __has_builtin(__builtin_bswap32) \
+ && __has_builtin(__builtin_bswap64)) || (__GNUC__ > 4 \
+ || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) /* fio_swapN */
+#define fio_swap16(x) __builtin_bswap16(x)
+#define fio_swap32(x) __builtin_bswap32(x)
+#define fio_swap64(x) __builtin_bswap64(x)
+#else
+#include <byteswap.h>
#define fio_swap16(x) bswap_16(x)
#define fio_swap32(x) bswap_32(x)
#define fio_swap64(x) bswap_64(x)
+#endif /* fio_swapN */
#define CACHE_LINE_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
@@ -241,7 +270,7 @@ static inline int arch_cache_line_size(void)
return atoi(size);
}
-static inline unsigned long long get_fs_size(const char *path)
+static inline unsigned long long get_fs_free_size(const char *path)
{
unsigned long long ret;
struct statfs s;
diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h
index cc3de31e..8a116e60 100644
--- a/os/os-dragonfly.h
+++ b/os/os-dragonfly.h
@@ -4,23 +4,27 @@
#define FIO_OS os_dragonfly
#include <errno.h>
+#include <unistd.h>
#include <sys/param.h>
-/* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
-#define rb_node _rb_node
#include <sys/sysctl.h>
-#undef rb_node
-#undef rb_left
-#undef rb_right
+#include <sys/statvfs.h>
+#include <sys/diskslice.h>
+#include <sys/ioctl_compat.h>
+#include <sys/usched.h>
+#include <sys/resource.h>
#include "../file.h"
#define FIO_HAVE_ODIRECT
-#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
+#define FIO_HAVE_FS_STAT
+#define FIO_HAVE_TRIM
+#define FIO_HAVE_CHARDEV_SIZE
#define FIO_HAVE_GETTID
-
-#undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
+#define FIO_HAVE_CPU_AFFINITY
+#define FIO_HAVE_IOPRIO
+#define FIO_HAVE_SHM_ATTACH_REMOVED
#define OS_MAP_ANON MAP_ANON
@@ -32,11 +36,155 @@
#define fio_swap32(x) bswap32(x)
#define fio_swap64(x) bswap64(x)
+/* This is supposed to equal (sizeof(cpumask_t)*8) */
+#define FIO_MAX_CPUS SMP_MAXCPU
+
typedef off_t off64_t;
+typedef cpumask_t os_cpu_mask_t;
+
+/*
+ * These macros are copied from sys/cpu/x86_64/include/types.h.
+ * It's okay to copy from arch dependent header because x86_64 is the only
+ * supported arch, and no other arch is going to be supported any time soon.
+ *
+ * These are supposed to be able to be included from userspace by defining
+ * _KERNEL_STRUCTURES, however this scheme is badly broken that enabling it
+ * causes compile-time conflicts with other headers. Although the current
+ * upstream code no longer requires _KERNEL_STRUCTURES, they should be kept
+ * here for compatibility with older versions.
+ */
+#ifndef CPUMASK_SIMPLE
+#define CPUMASK_SIMPLE(cpu) ((uint64_t)1 << (cpu))
+#define CPUMASK_TESTBIT(val, i) ((val).ary[((i) >> 6) & 3] & \
+ CPUMASK_SIMPLE((i) & 63))
+#define CPUMASK_ORBIT(mask, i) ((mask).ary[((i) >> 6) & 3] |= \
+ CPUMASK_SIMPLE((i) & 63))
+#define CPUMASK_NANDBIT(mask, i) ((mask).ary[((i) >> 6) & 3] &= \
+ ~CPUMASK_SIMPLE((i) & 63))
+#define CPUMASK_ASSZERO(mask) do { \
+ (mask).ary[0] = 0; \
+ (mask).ary[1] = 0; \
+ (mask).ary[2] = 0; \
+ (mask).ary[3] = 0; \
+ } while(0)
+#endif
+
+/*
+ * Define USCHED_GET_CPUMASK as the macro didn't exist until release 4.5.
+ * usched_set(2) returns EINVAL if the kernel doesn't support it.
+ *
+ * Also note usched_set(2) works only for the current thread regardless of
+ * the command type. It doesn't work against another thread regardless of
+ * a caller's privilege. A caller would generally specify 0 for pid for the
+ * current thread though that's the only choice. See BUGS in usched_set(2).
+ */
+#ifndef USCHED_GET_CPUMASK
+#define USCHED_GET_CPUMASK 5
+#endif
+
+/* No CPU_COUNT(), but use the default function defined in os/os.h */
+#define fio_cpu_count(mask) CPU_COUNT((mask))
+
+static inline int fio_cpuset_init(os_cpu_mask_t *mask)
+{
+ CPUMASK_ASSZERO(*mask);
+ return 0;
+}
+
+static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
+{
+ return 0;
+}
+
+static inline void fio_cpu_clear(os_cpu_mask_t *mask, int cpu)
+{
+ CPUMASK_NANDBIT(*mask, cpu);
+}
+
+static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu)
+{
+ CPUMASK_ORBIT(*mask, cpu);
+}
+
+static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
+{
+ if (CPUMASK_TESTBIT(*mask, cpu))
+ return 1;
+
+ return 0;
+}
+
+static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
+{
+ int i, firstcall = 1;
+
+ /* 0 for the current thread, see BUGS in usched_set(2) */
+ pid = 0;
+
+ for (i = 0; i < FIO_MAX_CPUS; i++) {
+ if (!CPUMASK_TESTBIT(mask, i))
+ continue;
+ if (firstcall) {
+ if (usched_set(pid, USCHED_SET_CPU, &i, sizeof(int)))
+ return -1;
+ firstcall = 0;
+ } else {
+ if (usched_set(pid, USCHED_ADD_CPU, &i, sizeof(int)))
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *mask)
+{
+ /* 0 for the current thread, see BUGS in usched_set(2) */
+ pid = 0;
+
+ if (usched_set(pid, USCHED_GET_CPUMASK, mask, sizeof(*mask)))
+ return -1;
+
+ return 0;
+}
+
+/* fio code is Linux based, so rename macros to Linux style */
+#define IOPRIO_WHO_PROCESS PRIO_PROCESS
+#define IOPRIO_WHO_PGRP PRIO_PGRP
+#define IOPRIO_WHO_USER PRIO_USER
+
+#define IOPRIO_MIN_PRIO 1 /* lowest priority */
+#define IOPRIO_MAX_PRIO 10 /* highest priority */
+
+/*
+ * Prototypes declared in sys/sys/resource.h are preventing from defining
+ * ioprio_set() with 4 arguments, so define fio's ioprio_set() as a macro.
+ * Note that there is no idea of class within ioprio_set(2) unlike Linux.
+ */
+#define ioprio_set(which, who, ioprio_class, ioprio) \
+ ioprio_set(which, who, ioprio)
+
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct partinfo pi;
+
+ if (!ioctl(f->fd, DIOCGPART, &pi)) {
+ *bytes = (unsigned long long) pi.media_size;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
+static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ return blockdev_size(f, bytes);
+}
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
@@ -54,8 +202,46 @@ static inline int gettid(void)
return (int) lwp_gettid();
}
+static inline unsigned long long get_fs_free_size(const char *path)
+{
+ unsigned long long ret;
+ struct statvfs s;
+
+ if (statvfs(path, &s) < 0)
+ return -1ULL;
+
+ ret = s.f_frsize;
+ ret *= (unsigned long long) s.f_bfree;
+ return ret;
+}
+
+static inline int os_trim(int fd, unsigned long long start,
+ unsigned long long len)
+{
+ off_t range[2];
+
+ range[0] = start;
+ range[1] = len;
+
+ if (!ioctl(fd, IOCTLTRIM, range))
+ return 0;
+
+ return errno;
+}
+
#ifdef MADV_FREE
#define FIO_MADV_FREE MADV_FREE
#endif
+static inline int shm_attach_to_open_removed(void)
+{
+ int x;
+ size_t len = sizeof(x);
+
+ if (sysctlbyname("kern.ipc.shm_allow_removed", &x, &len, NULL, 0) < 0)
+ return 0;
+
+ return x > 0 ? 1 : 0;
+}
+
#endif
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index 22765ce6..c7863b5e 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -10,6 +10,7 @@
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/cpuset.h>
+#include <sys/statvfs.h>
#include "../file.h"
@@ -17,8 +18,11 @@
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_CHARDEV_SIZE
+#define FIO_HAVE_FS_STAT
+#define FIO_HAVE_TRIM
#define FIO_HAVE_GETTID
#define FIO_HAVE_CPU_AFFINITY
+#define FIO_HAVE_SHM_ATTACH_REMOVED
#define OS_MAP_ANON MAP_ANON
@@ -78,7 +82,7 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
@@ -99,8 +103,46 @@ static inline int gettid(void)
return (int) lwpid;
}
+static inline unsigned long long get_fs_free_size(const char *path)
+{
+ unsigned long long ret;
+ struct statvfs s;
+
+ if (statvfs(path, &s) < 0)
+ return -1ULL;
+
+ ret = s.f_frsize;
+ ret *= (unsigned long long) s.f_bfree;
+ return ret;
+}
+
+static inline int os_trim(int fd, unsigned long long start,
+ unsigned long long len)
+{
+ off_t range[2];
+
+ range[0] = start;
+ range[1] = len;
+
+ if (!ioctl(fd, DIOCGDELETE, range))
+ return 0;
+
+ return errno;
+}
+
#ifdef MADV_FREE
#define FIO_MADV_FREE MADV_FREE
#endif
+static inline int shm_attach_to_open_removed(void)
+{
+ int x;
+ size_t len = sizeof(x);
+
+ if (sysctlbyname("kern.ipc.shm_allow_removed", &x, &len, NULL, 0) < 0)
+ return 0;
+
+ return x > 0 ? 1 : 0;
+}
+
#endif
diff --git a/os/os-hpux.h b/os/os-hpux.h
index 82acd110..6a240b0d 100644
--- a/os/os-hpux.h
+++ b/os/os-hpux.h
@@ -22,7 +22,6 @@
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
-#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CHARDEV_SIZE
#define OS_MAP_ANON MAP_ANONYMOUS
@@ -44,7 +43,7 @@ typedef struct aiocb64 os_aiocb_t;
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
diff --git a/os/os-linux-syscall.h b/os/os-linux-syscall.h
new file mode 100644
index 00000000..c399b2fa
--- /dev/null
+++ b/os/os-linux-syscall.h
@@ -0,0 +1,277 @@
+#ifndef FIO_OS_LINUX_SYSCALL_H
+#define FIO_OS_LINUX_SYSCALL_H
+
+#include "../arch/arch.h"
+
+/* Linux syscalls for x86 */
+#if defined(ARCH_X86_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 289
+#define __NR_ioprio_get 290
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 250
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 313
+#define __NR_sys_tee 315
+#define __NR_sys_vmsplice 316
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 378
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 379
+#endif
+
+/* Linux syscalls for x86_64 */
+#elif defined(ARCH_X86_64_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 251
+#define __NR_ioprio_get 252
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 221
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 275
+#define __NR_sys_tee 276
+#define __NR_sys_vmsplice 278
+#endif
+
+#ifndef __NR_shmget
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#define __NR_shmdt 67
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 327
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 328
+#endif
+
+/* Linux syscalls for ppc */
+#elif defined(ARCH_PPC_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 273
+#define __NR_ioprio_get 274
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 233
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 283
+#define __NR_sys_tee 284
+#define __NR_sys_vmsplice 285
+#endif
+
+/* Linux syscalls for ia64 */
+#elif defined(ARCH_IA64_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 1274
+#define __NR_ioprio_get 1275
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 1234
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 1297
+#define __NR_sys_tee 1301
+#define __NR_sys_vmsplice 1302
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 1348
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 1349
+#endif
+
+/* Linux syscalls for alpha */
+#elif defined(ARCH_ALPHA_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 442
+#define __NR_ioprio_get 443
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 413
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 468
+#define __NR_sys_tee 470
+#define __NR_sys_vmsplice 471
+#endif
+
+/* Linux syscalls for s390 */
+#elif defined(ARCH_S390_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 253
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 306
+#define __NR_sys_tee 308
+#define __NR_sys_vmsplice 309
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 376
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 377
+#endif
+
+/* Linux syscalls for sparc */
+#elif defined(ARCH_SPARC_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 196
+#define __NR_ioprio_get 218
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 209
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 232
+#define __NR_sys_tee 280
+#define __NR_sys_vmsplice 25
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 358
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 359
+#endif
+
+/* Linux syscalls for sparc64 */
+#elif defined(ARCH_SPARC64_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 196
+#define __NR_ioprio_get 218
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 209
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 232
+#define __NR_sys_tee 280
+#define __NR_sys_vmsplice 25
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 358
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 359
+#endif
+
+/* Linux syscalls for arm */
+#elif defined(ARCH_ARM_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 314
+#define __NR_ioprio_get 315
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 270
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 340
+#define __NR_sys_tee 342
+#define __NR_sys_vmsplice 343
+#endif
+
+#ifndef __NR_preadv2
+#define __NR_preadv2 392
+#endif
+#ifndef __NR_pwritev2
+#define __NR_pwritev2 393
+#endif
+
+/* Linux syscalls for mips */
+#elif defined(ARCH_MIPS64_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 314
+#define __NR_ioprio_get 315
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 215
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 263
+#define __NR_sys_tee 265
+#define __NR_sys_vmsplice 266
+#endif
+
+/* Linux syscalls for sh */
+#elif defined(ARCH_SH_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 288
+#define __NR_ioprio_get 289
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 250
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 313
+#define __NR_sys_tee 315
+#define __NR_sys_vmsplice 316
+#endif
+
+/* Linux syscalls for hppa */
+#elif defined(ARCH_HPPA_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 267
+#define __NR_ioprio_get 268
+#endif
+
+#ifndef __NR_fadvise64
+#define __NR_fadvise64 236
+#endif
+
+#ifndef __NR_sys_splice
+#define __NR_sys_splice 291
+#define __NR_sys_tee 293
+#define __NR_sys_vmsplice 294
+#endif
+
+/* Linux syscalls for aarch64 */
+#elif defined(ARCH_AARCH64_H)
+#ifndef __NR_ioprio_set
+#define __NR_ioprio_set 30
+#define __NR_ioprio_get 31
+#endif
+
+#else
+#warning "Unknown architecture"
+#endif
+
+#endif /* FIO_OS_LINUX_SYSCALL_H */
diff --git a/os/os-linux.h b/os/os-linux.h
index e1936342..ba53590d 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -6,6 +6,7 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/syscall.h>
+#include <sys/sysmacros.h>
#include <sys/vfs.h>
#include <sys/mman.h>
#include <unistd.h>
@@ -15,21 +16,25 @@
#include <linux/unistd.h>
#include <linux/raw.h>
#include <linux/major.h>
-#include <byteswap.h>
+#include "./os-linux-syscall.h"
#include "binject.h"
#include "../file.h"
+#ifndef __has_builtin // Optional of course.
+ #define __has_builtin(x) 0 // Compatibility with non-clang compilers.
+#endif
+
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_DISK_UTIL
#define FIO_HAVE_SGIO
#define FIO_HAVE_IOPRIO
+#define FIO_HAVE_IOPRIO_CLASS
#define FIO_HAVE_IOSCHED_SWITCH
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_HUGETLB
#define FIO_HAVE_RAWBIND
#define FIO_HAVE_BLKTRACE
-#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CL_SIZE
#define FIO_HAVE_CGROUPS
#define FIO_HAVE_FS_STAT
@@ -37,6 +42,8 @@
#define FIO_HAVE_BINJECT
#define FIO_HAVE_GETTID
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
+#define FIO_HAVE_PWRITEV2
+#define FIO_HAVE_SHM_ATTACH_REMOVED
#ifdef MAP_HUGETLB
#define FIO_HAVE_MMAP_HUGE
@@ -94,6 +101,12 @@ enum {
#define IOPRIO_BITS 16
#define IOPRIO_CLASS_SHIFT 13
+#define IOPRIO_MIN_PRIO 0 /* highest priority */
+#define IOPRIO_MAX_PRIO 7 /* lowest priority */
+
+#define IOPRIO_MIN_PRIO_CLASS 0
+#define IOPRIO_MAX_PRIO_CLASS 3
+
static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
{
/*
@@ -209,21 +222,19 @@ static inline int fio_lookup_raw(dev_t dev, int *majdev, int *mindev)
#define FIO_MADV_FREE MADV_REMOVE
#endif
-#if defined(__builtin_bswap16)
+/* Check for GCC or Clang byte swap intrinsics */
+#if (__has_builtin(__builtin_bswap16) && __has_builtin(__builtin_bswap32) \
+ && __has_builtin(__builtin_bswap64)) || (__GNUC__ > 4 \
+ || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) /* fio_swapN */
#define fio_swap16(x) __builtin_bswap16(x)
-#else
-#define fio_swap16(x) __bswap_16(x)
-#endif
-#if defined(__builtin_bswap32)
#define fio_swap32(x) __builtin_bswap32(x)
-#else
-#define fio_swap32(x) __bswap_32(x)
-#endif
-#if defined(__builtin_bswap64)
#define fio_swap64(x) __builtin_bswap64(x)
#else
-#define fio_swap64(x) __bswap_64(x)
-#endif
+#include <byteswap.h>
+#define fio_swap16(x) bswap_16(x)
+#define fio_swap32(x) bswap_32(x)
+#define fio_swap64(x) bswap_64(x)
+#endif /* fio_swapN */
#define CACHE_LINE_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
@@ -247,7 +258,7 @@ static inline int arch_cache_line_size(void)
return atoi(size);
}
-static inline unsigned long long get_fs_size(const char *path)
+static inline unsigned long long get_fs_free_size(const char *path)
{
unsigned long long ret;
struct statfs s;
@@ -282,4 +293,70 @@ static inline int fio_set_sched_idle(void)
}
#endif
+#ifndef POSIX_FADV_STREAMID
+#define POSIX_FADV_STREAMID 8
+#endif
+
+#define FIO_HAVE_STREAMID
+
+#ifndef RWF_HIPRI
+#define RWF_HIPRI 0x00000001
+#endif
+#ifndef RWF_DSYNC
+#define RWF_DSYNC 0x00000002
+#endif
+#ifndef RWF_SYNC
+#define RWF_SYNC 0x00000004
+#endif
+
+#ifndef CONFIG_PWRITEV2
+#ifdef __NR_preadv2
+static inline void make_pos_h_l(unsigned long *pos_h, unsigned long *pos_l,
+ off_t offset)
+{
+#if BITS_PER_LONG == 64
+ *pos_l = offset;
+ *pos_h = 0;
+#else
+ *pos_l = offset & 0xffffffff;
+ *pos_h = ((uint64_t) offset) >> 32;
+#endif
+}
+static inline ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt,
+ off_t offset, unsigned int flags)
+{
+ unsigned long pos_l, pos_h;
+
+ make_pos_h_l(&pos_h, &pos_l, offset);
+ return syscall(__NR_preadv2, fd, iov, iovcnt, pos_l, pos_h, flags);
+}
+static inline ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt,
+ off_t offset, unsigned int flags)
+{
+ unsigned long pos_l, pos_h;
+
+ make_pos_h_l(&pos_h, &pos_l, offset);
+ return syscall(__NR_pwritev2, fd, iov, iovcnt, pos_l, pos_h, flags);
+}
+#else
+static inline ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt,
+ off_t offset, unsigned int flags)
+{
+ errno = ENOSYS;
+ return -1;
+}
+static inline ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt,
+ off_t offset, unsigned int flags)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* __NR_preadv2 */
+#endif /* CONFIG_PWRITEV2 */
+
+static inline int shm_attach_to_open_removed(void)
+{
+ return 1;
+}
+
#endif
diff --git a/os/os-mac.h b/os/os-mac.h
index d202e99d..7de36ea7 100644
--- a/os/os-mac.h
+++ b/os/os-mac.h
@@ -35,76 +35,9 @@
typedef off_t off64_t;
-/* OS X as of 10.6 doesn't have the timer_* functions.
- * Emulate the functionality using setitimer and sigaction here
- */
-
-#define MAX_TIMERS 64
-
+#ifndef CONFIG_CLOCKID_T
typedef unsigned int clockid_t;
-typedef unsigned int timer_t;
-
-struct itimerspec {
- struct timespec it_value;
- struct timespec it_interval;
-};
-
-static struct sigevent fio_timers[MAX_TIMERS];
-static unsigned int num_timers = 0;
-
-static void sig_alrm(int signum)
-{
- union sigval sv;
-
- for (int i = 0; i < num_timers; i++) {
- if (fio_timers[i].sigev_notify_function == NULL)
- continue;
-
- if (fio_timers[i].sigev_notify == SIGEV_THREAD)
- fio_timers[i].sigev_notify_function(sv);
- else if (fio_timers[i].sigev_notify == SIGEV_SIGNAL)
- kill(getpid(), fio_timers[i].sigev_signo);
- }
-}
-
-static inline int timer_settime(timer_t timerid, int flags,
- const struct itimerspec *value,
- struct itimerspec *ovalue)
-{
- struct sigaction sa;
- struct itimerval tv;
- struct itimerval tv_out;
- int rc;
-
- tv.it_interval.tv_sec = value->it_interval.tv_sec;
- tv.it_interval.tv_usec = value->it_interval.tv_nsec / 1000;
-
- tv.it_value.tv_sec = value->it_value.tv_sec;
- tv.it_value.tv_usec = value->it_value.tv_nsec / 1000;
-
- sa.sa_handler = sig_alrm;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = 0;
-
- rc = sigaction(SIGALRM, &sa, NULL);
-
- if (!rc)
- rc = setitimer(ITIMER_REAL, &tv, &tv_out);
-
- if (!rc && ovalue != NULL) {
- ovalue->it_interval.tv_sec = tv_out.it_interval.tv_sec;
- ovalue->it_interval.tv_nsec = tv_out.it_interval.tv_usec * 1000;
- ovalue->it_value.tv_sec = tv_out.it_value.tv_sec;
- ovalue->it_value.tv_nsec = tv_out.it_value.tv_usec * 1000;
- }
-
- return rc;
-}
-
-static inline int timer_delete(timer_t timer)
-{
- return 0;
-}
+#endif
#define FIO_OS_DIRECTIO
static inline int fio_set_odirect(int fd)
@@ -144,7 +77,7 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 4b0269e6..7be02a78 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -6,6 +6,10 @@
#include <errno.h>
#include <lwp.h>
#include <sys/param.h>
+#include <sys/statvfs.h>
+#include <sys/ioctl.h>
+#include <sys/dkio.h>
+#include <sys/disklabel.h>
/* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
#define rb_node _rb_node
#include <sys/sysctl.h>
@@ -16,12 +20,12 @@
#include "../file.h"
#define FIO_HAVE_ODIRECT
-#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
+#define FIO_HAVE_FS_STAT
#define FIO_HAVE_GETTID
-#undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
+#undef FIO_HAVE_CPU_AFFINITY /* doesn't exist */
#define OS_MAP_ANON MAP_ANON
@@ -35,9 +39,22 @@
typedef off_t off64_t;
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct disklabel dl;
+
+ if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
+ *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
@@ -55,11 +72,21 @@ static inline int gettid(void)
return (int) _lwp_self();
}
+static inline unsigned long long get_fs_free_size(const char *path)
+{
+ unsigned long long ret;
+ struct statvfs s;
+
+ if (statvfs(path, &s) < 0)
+ return -1ULL;
+
+ ret = s.f_frsize;
+ ret *= (unsigned long long) s.f_bfree;
+ return ret;
+}
+
#ifdef MADV_FREE
#define FIO_MADV_FREE MADV_FREE
#endif
-/* XXX NetBSD doesn't have getopt_long_only */
-#define getopt_long_only getopt_long
-
#endif
diff --git a/os/os-openbsd.h b/os/os-openbsd.h
index b1d8e832..d874ee25 100644
--- a/os/os-openbsd.h
+++ b/os/os-openbsd.h
@@ -5,6 +5,11 @@
#include <errno.h>
#include <sys/param.h>
+#include <sys/statvfs.h>
+#include <sys/ioctl.h>
+#include <sys/dkio.h>
+#include <sys/disklabel.h>
+#include <sys/utsname.h>
/* XXX hack to avoid conflicts between rbtree.h and <sys/tree.h> */
#include <sys/sysctl.h>
#undef RB_BLACK
@@ -14,12 +19,13 @@
#include "../file.h"
#undef FIO_HAVE_ODIRECT
-#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
+#define FIO_HAVE_FS_STAT
#define FIO_HAVE_GETTID
+#define FIO_HAVE_SHM_ATTACH_REMOVED
-#undef FIO_HAVE_CPU_AFFINITY /* XXX notyet */
+#undef FIO_HAVE_CPU_AFFINITY /* doesn't exist */
#define OS_MAP_ANON MAP_ANON
@@ -33,9 +39,22 @@
typedef off_t off64_t;
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct disklabel dl;
+
+ if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
+ *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return EINVAL;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
@@ -50,11 +69,54 @@ static inline unsigned long long os_phys_mem(void)
static inline int gettid(void)
{
- return (int) pthread_self();
+ return (int)(intptr_t) pthread_self();
+}
+
+static inline unsigned long long get_fs_free_size(const char *path)
+{
+ unsigned long long ret;
+ struct statvfs s;
+
+ if (statvfs(path, &s) < 0)
+ return -1ULL;
+
+ ret = s.f_frsize;
+ ret *= (unsigned long long) s.f_bfree;
+ return ret;
}
#ifdef MADV_FREE
#define FIO_MADV_FREE MADV_FREE
#endif
+static inline int shm_attach_to_open_removed(void)
+{
+ struct utsname uts;
+ int major, minor;
+
+ if (uname(&uts) == -1)
+ return 0;
+
+ /*
+ * Return 1 if >= OpenBSD 5.1 according to 97900ebf,
+ * assuming both major/minor versions are < 10.
+ */
+ if (uts.release[0] > '9' || uts.release[0] < '0')
+ return 0;
+ if (uts.release[1] != '.')
+ return 0;
+ if (uts.release[2] > '9' || uts.release[2] < '0')
+ return 0;
+
+ major = uts.release[0] - '0';
+ minor = uts.release[2] - '0';
+
+ if (major > 5)
+ return 1;
+ if (major == 5 && minor >= 1)
+ return 1;
+
+ return 0;
+}
+
#endif
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 5b78cc2c..8f8f53b6 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -16,7 +16,6 @@
#include "../file.h"
#define FIO_HAVE_CPU_AFFINITY
-#define FIO_HAVE_PSHARED_MUTEX
#define FIO_HAVE_CHARDEV_SIZE
#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
@@ -61,7 +60,7 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return 0;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
diff --git a/os/os-windows.h b/os/os-windows.h
index 66036351..0c8c42d3 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -16,9 +16,15 @@
#include "../file.h"
#include "../log.h"
#include "../lib/hweight.h"
+#include "../oslib/strcasestr.h"
#include "windows/posix.h"
+/* Cygwin doesn't define rand_r if C99 or newer is being used */
+#if defined(WIN32) && !defined(rand_r)
+int rand_r(unsigned *);
+#endif
+
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 65535
#endif
@@ -105,6 +111,7 @@ int fcntl(int fildes, int cmd, ...);
int fdatasync(int fildes);
int lstat(const char * path, struct stat * buf);
uid_t geteuid(void);
+char* ctime_r(const time_t *t, char *buf);
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
ssize_t pwrite(int fildes, const void *buf, size_t nbyte,
@@ -145,9 +152,7 @@ static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- /* There's no way to invalidate the cache in Windows
- * so just pretend to succeed */
- return 0;
+ return ENOTSUP;
}
static inline unsigned long long os_phys_mem(void)
@@ -186,7 +191,7 @@ static inline int fio_setaffinity(int pid, os_cpu_mask_t cpumask)
return (bSuccess)? 0 : -1;
}
-static inline void fio_getaffinity(int pid, os_cpu_mask_t *mask)
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *mask)
{
os_cpu_mask_t systemMask;
@@ -197,7 +202,10 @@ static inline void fio_getaffinity(int pid, os_cpu_mask_t *mask)
CloseHandle(h);
} else {
log_err("fio_getaffinity failed: failed to get handle for pid %d\n", pid);
+ return -1;
}
+
+ return 0;
}
static inline void fio_cpu_clear(os_cpu_mask_t *mask, int cpu)
diff --git a/os/os.h b/os/os.h
index 7cb81211..5e3c813d 100644
--- a/os/os.h
+++ b/os/os.h
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include "../arch/arch.h"
+#include "../lib/types.h"
enum {
os_linux = 1,
@@ -65,7 +66,11 @@ typedef struct aiocb os_aiocb_t;
#endif
#ifndef CONFIG_STRSEP
-#include "../lib/strsep.h"
+#include "../oslib/strsep.h"
+#endif
+
+#ifndef CONFIG_STRLCAT
+#include "../oslib/strlcat.h"
#endif
#ifdef MSG_DONTWAIT
@@ -76,15 +81,32 @@ typedef struct aiocb os_aiocb_t;
#define POSIX_FADV_DONTNEED (0)
#define POSIX_FADV_SEQUENTIAL (0)
#define POSIX_FADV_RANDOM (0)
+#define POSIX_FADV_NORMAL (0)
#endif
#ifndef FIO_HAVE_CPU_AFFINITY
-#define fio_setaffinity(pid, mask) (0)
-#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;
+
+static inline int fio_setaffinity(int pid, os_cpu_mask_t cpumask)
+{
+ return 0;
+}
+
+static inline int fio_getaffinity(int pid, os_cpu_mask_t *cpumask)
+{
+ return -1;
+}
+
+static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
+{
+ return -1;
+}
+
+static inline int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
+{
+ return 0;
+}
#else
extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
#endif
@@ -134,7 +156,7 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
#endif
#ifndef FIO_PREFERRED_ENGINE
-#define FIO_PREFERRED_ENGINE "sync"
+#define FIO_PREFERRED_ENGINE "psync"
#endif
#ifndef FIO_OS_PATH_SEPARATOR
@@ -150,7 +172,7 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu);
#endif
#ifndef FIO_MAX_JOBS
-#define FIO_MAX_JOBS 2048
+#define FIO_MAX_JOBS 4096
#endif
#ifndef CONFIG_SOCKLEN_T
@@ -320,12 +342,20 @@ static inline int init_random_state(struct thread_data *td, unsigned long *rand_
#endif
#ifndef FIO_HAVE_FS_STAT
-static inline unsigned long long get_fs_size(const char *path)
+static inline unsigned long long get_fs_free_size(const char *path)
{
return 0;
}
#endif
+#ifdef __powerpc64__
+#define FIO_HAVE_CPU_ONLINE_SYSCONF
+static inline unsigned int cpus_online(void)
+{
+ return sysconf(_SC_NPROCESSORS_CONF);
+}
+#endif
+
#ifndef FIO_HAVE_CPU_ONLINE_SYSCONF
static inline unsigned int cpus_online(void)
{
@@ -356,4 +386,11 @@ static inline int gettid(void)
}
#endif
+#ifndef FIO_HAVE_SHM_ATTACH_REMOVED
+static inline int shm_attach_to_open_removed(void)
+{
+ return 0;
+}
+#endif
+
#endif
diff --git a/os/windows/eula.rtf b/os/windows/eula.rtf
index cc7be7fb..1c929321 100755
--- a/os/windows/eula.rtf
+++ b/os/windows/eula.rtf
Binary files differ
diff --git a/os/windows/examples.wxs b/os/windows/examples.wxs
index a21182a9..cc2ff5c8 100755
--- a/os/windows/examples.wxs
+++ b/os/windows/examples.wxs
@@ -9,48 +9,111 @@
<File Source="..\..\examples\aio-read.fio" />
</Component>
<Component>
+ <File Source="..\..\examples\backwards-read.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\basic-verify.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\cpuio.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\dev-dax.fio" />
+ </Component>
+ <Component>
<File Source="..\..\examples\disk-zone-profile.fio" />
</Component>
<Component>
+ <File Source="..\..\examples\e4defrag.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\e4defrag2.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\enospc-pressure.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\falloc.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\fixed-rate-submission.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\flow.fio" />
+ </Component>
+ <Component>
<File Source="..\..\examples\fsx.fio" />
</Component>
<Component>
+ <File Source="..\..\examples\fusion-aw-sync.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\gfapi.fio" />
+ </Component>
+ <Component>
<File Source="..\..\examples\iometer-file-access-server.fio" />
</Component>
<Component>
+ <File Source="..\..\examples\jesd219.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\latency-profile.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\libhdfs.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\mtd.fio" />
+ </Component>
+ <Component>
<File Source="..\..\examples\netio.fio" />
</Component>
<Component>
<File Source="..\..\examples\netio_multicast.fio" />
</Component>
<Component>
- <File Source="..\..\examples\ssd-test.fio" />
+ <File Source="..\..\examples\null.fio" />
</Component>
<Component>
- <File Source="..\..\examples\surface-scan.fio" />
+ <File Source="..\..\examples\numa.fio" />
</Component>
<Component>
- <File Source="..\..\examples\tiobench-example.fio" />
+ <File Source="..\..\examples\pmemblk.fio" />
</Component>
<Component>
- <File Source="..\..\examples\null.fio" />
+ <File Source="..\..\examples\poisson-rate-submission.fio" />
</Component>
<Component>
- <File Source="..\..\examples\flow.fio" />
+ <File Source="..\..\examples\rand-zones.fio" />
</Component>
<Component>
- <File Source="..\..\examples\cpuio.fio" />
+ <File Source="..\..\examples\rbd.fio" />
</Component>
<Component>
- <File Source="..\..\examples\falloc.fio" />
+ <File Source="..\..\examples\rdmaio-client.fio" />
</Component>
<Component>
- <File Source="..\..\examples\fusion-aw-sync.fio" />
+ <File Source="..\..\examples\rdmaio-server.fio" />
</Component>
<Component>
<File Source="..\..\examples\ssd-steadystate.fio" />
</Component>
<Component>
+ <File Source="..\..\examples\ssd-test.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\steadystate.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\surface-scan.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\tiobench-example.fio" />
+ </Component>
+ <Component>
+ <File Source="..\..\examples\waitfor.fio" />
+ </Component>
+ <Component>
<File Source="..\..\examples\zipf.fio" />
</Component>
</DirectoryRef>
@@ -59,20 +122,41 @@
<ComponentGroup Id="examples">
<ComponentRef Id="_1mbs_clients.fio" />
<ComponentRef Id="aio_read.fio" />
+ <ComponentRef Id="backwards_read.fio" />
+ <ComponentRef Id="basic_verify.fio" />
+ <ComponentRef Id="cpuio.fio" />
+ <ComponentRef Id="dev_dax.fio" />
<ComponentRef Id="disk_zone_profile.fio" />
+ <ComponentRef Id="e4defrag.fio" />
+ <ComponentRef Id="e4defrag2.fio" />
+ <ComponentRef Id="enospc_pressure.fio" />
+ <ComponentRef Id="falloc.fio" />
+ <ComponentRef Id="fixed_rate_submission.fio" />
+ <ComponentRef Id="flow.fio" />
<ComponentRef Id="fsx.fio" />
+ <ComponentRef Id="fusion_aw_sync.fio" />
+ <ComponentRef Id="gfapi.fio" />
<ComponentRef Id="iometer_file_access_server.fio" />
+ <ComponentRef Id="jesd219.fio" />
+ <ComponentRef Id="latency_profile.fio" />
+ <ComponentRef Id="libhdfs.fio" />
+ <ComponentRef Id="mtd.fio" />
<ComponentRef Id="netio.fio" />
<ComponentRef Id="netio_multicast.fio" />
+ <ComponentRef Id="null.fio" />
+ <ComponentRef Id="numa.fio" />
+ <ComponentRef Id="pmemblk.fio" />
+ <ComponentRef Id="poisson_rate_submission.fio" />
+ <ComponentRef Id="rand_zones.fio" />
+ <ComponentRef Id="rbd.fio" />
+ <ComponentRef Id="rdmaio_client.fio" />
+ <ComponentRef Id="rdmaio_server.fio" />
+ <ComponentRef Id="ssd_steadystate.fio" />
<ComponentRef Id="ssd_test.fio" />
+ <ComponentRef Id="steadystate.fio" />
<ComponentRef Id="surface_scan.fio" />
<ComponentRef Id="tiobench_example.fio" />
- <ComponentRef Id="null.fio" />
- <ComponentRef Id="flow.fio" />
- <ComponentRef Id="cpuio.fio" />
- <ComponentRef Id="falloc.fio" />
- <ComponentRef Id="fusion_aw_sync.fio" />
- <ComponentRef Id="ssd_steadystate.fio" />
+ <ComponentRef Id="waitfor.fio" />
<ComponentRef Id="zipf.fio" />
</ComponentGroup>
</Fragment>
diff --git a/os/windows/install.wxs b/os/windows/install.wxs
index 74f1d28a..05d2a83b 100755
--- a/os/windows/install.wxs
+++ b/os/windows/install.wxs
@@ -10,7 +10,7 @@
<Product Id="*"
Codepage="1252" Language="1033"
Manufacturer="fio" Name="fio"
- UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.2.6">
+ UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.20">
<Package
Description="Flexible IO Tester"
InstallerVersion="301" Keywords="Installer,MSI,Database"
@@ -40,7 +40,7 @@
<File Id="COPYING" Name="COPYING.txt" Source="..\..\COPYING"/>
</Component>
<Component>
- <File Id="LICENSE" Name="LICENSE.txt" Source="..\..\LICENSE"/>
+ <File Id="MORAL_LICENSE" Name="MORAL-LICENSE.txt" Source="..\..\MORAL-LICENSE"/>
</Component>
<Directory Id="examples" Name="examples"/>
</Directory>
@@ -54,11 +54,11 @@
<ComponentRef Id="README"/>
<ComponentRef Id="REPORTING_BUGS"/>
<ComponentRef Id="COPYING"/>
- <ComponentRef Id="LICENSE"/>
+ <ComponentRef Id="MORAL_LICENSE"/>
<ComponentGroupRef Id="examples"/>
</Feature>
- <Property Id="ARPURLINFOABOUT" Value="http://git.kernel.dk/?p=fio.git" />
+ <Property Id="ARPURLINFOABOUT" Value="http://git.kernel.dk/cgit/fio/" />
<Property Id='ARPCONTACT'>fio@vger.kernel.org</Property>
<Property Id='ARPHELPLINK'>http://www.spinics.net/lists/fio/</Property>
<Property Id='ARPURLUPDATEINFO'>http://bluestop.org/fio/</Property>
diff --git a/os/windows/posix.c b/os/windows/posix.c
index d238c64a..eae8c861 100755
--- a/os/windows/posix.c
+++ b/os/windows/posix.c
@@ -40,12 +40,6 @@ HRESULT WINAPI StringCchPrintfA(
const char *pszFormat,
...);
-int vsprintf_s(
- char *buffer,
- size_t numberOfElements,
- const char *format,
- va_list argptr);
-
int win_to_posix_error(DWORD winerr)
{
switch (winerr)
@@ -229,6 +223,32 @@ char *dlerror(void)
return dl_error;
}
+/* Copied from http://blogs.msdn.com/b/joshpoley/archive/2007/12/19/date-time-formats-and-conversions.aspx */
+void Time_tToSystemTime(time_t dosTime, SYSTEMTIME *systemTime)
+{
+ FILETIME utcFT;
+ LONGLONG jan1970;
+
+ jan1970 = Int32x32To64(dosTime, 10000000) + 116444736000000000;
+ utcFT.dwLowDateTime = (DWORD)jan1970;
+ utcFT.dwHighDateTime = jan1970 >> 32;
+
+ FileTimeToSystemTime((FILETIME*)&utcFT, systemTime);
+}
+
+char* ctime_r(const time_t *t, char *buf)
+{
+ SYSTEMTIME systime;
+ const char * const dayOfWeek[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+ const char * const monthOfYear[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ Time_tToSystemTime(*t, &systime);
+ /* We don't know how long `buf` is, but assume it's rounded up from the minimum of 25 to 32 */
+ StringCchPrintfA(buf, 31, "%s %s %d %02d:%02d:%02d %04d\n", dayOfWeek[systime.wDayOfWeek % 7], monthOfYear[(systime.wMonth - 1) % 12],
+ systime.wDay, systime.wHour, systime.wMinute, systime.wSecond, systime.wYear);
+ return buf;
+}
+
int gettimeofday(struct timeval *restrict tp, void *restrict tzp)
{
FILETIME fileTime;
@@ -278,35 +298,76 @@ void *mmap(void *addr, size_t len, int prot, int flags,
int fildes, off_t off)
{
DWORD vaProt = 0;
+ DWORD mapAccess = 0;
+ DWORD lenlow;
+ DWORD lenhigh;
+ HANDLE hMap;
void* allocAddr = NULL;
if (prot & PROT_NONE)
vaProt |= PAGE_NOACCESS;
- if ((prot & PROT_READ) && !(prot & PROT_WRITE))
+ if ((prot & PROT_READ) && !(prot & PROT_WRITE)) {
vaProt |= PAGE_READONLY;
+ mapAccess = FILE_MAP_READ;
+ }
- if (prot & PROT_WRITE)
+ if (prot & PROT_WRITE) {
vaProt |= PAGE_READWRITE;
+ mapAccess |= FILE_MAP_WRITE;
+ }
- if ((flags & MAP_ANON) | (flags & MAP_ANONYMOUS))
+ lenlow = len & 0xFFFF;
+ lenhigh = len >> 16;
+ /* If the low DWORD is zero and the high DWORD is non-zero, `CreateFileMapping`
+ will return ERROR_INVALID_PARAMETER. To avoid this, set both to zero. */
+ if (lenlow == 0) {
+ lenhigh = 0;
+ }
+
+ if (flags & MAP_ANON || flags & MAP_ANONYMOUS)
{
allocAddr = VirtualAlloc(addr, len, MEM_COMMIT, vaProt);
if (allocAddr == NULL)
errno = win_to_posix_error(GetLastError());
}
+ else
+ {
+ hMap = CreateFileMapping((HANDLE)_get_osfhandle(fildes), NULL, vaProt, lenhigh, lenlow, NULL);
+
+ if (hMap != NULL)
+ {
+ allocAddr = MapViewOfFile(hMap, mapAccess, off >> 16, off & 0xFFFF, len);
+ }
+
+ if (hMap == NULL || allocAddr == NULL)
+ errno = win_to_posix_error(GetLastError());
+
+ }
return allocAddr;
}
int munmap(void *addr, size_t len)
{
- if (!VirtualFree(addr, 0, MEM_RELEASE)) {
- errno = win_to_posix_error(GetLastError());
- return -1;
+ BOOL success;
+
+ /* We may have allocated the memory with either MapViewOfFile or
+ VirtualAlloc. Therefore, try calling UnmapViewOfFile first, and if that
+ fails, call VirtualFree. */
+ success = UnmapViewOfFile(addr);
+
+ if (!success)
+ {
+ success = VirtualFree(addr, 0, MEM_RELEASE);
}
- return 0;
+ return !success;
+}
+
+int msync(void *addr, size_t len, int flags)
+{
+ return !FlushViewOfFile(addr, len);
}
int fork(void)
@@ -621,10 +682,19 @@ int setgid(gid_t gid)
int nice(int incr)
{
- if (incr != 0) {
- errno = EINVAL;
- return -1;
- }
+ DWORD prioclass = NORMAL_PRIORITY_CLASS;
+
+ if (incr < -15)
+ prioclass = HIGH_PRIORITY_CLASS;
+ else if (incr < 0)
+ prioclass = ABOVE_NORMAL_PRIORITY_CLASS;
+ else if (incr > 15)
+ prioclass = IDLE_PRIORITY_CLASS;
+ else if (incr > 0)
+ prioclass = BELOW_NORMAL_PRIORITY_CLASS;
+
+ if (!SetPriorityClass(GetCurrentProcess(), prioclass))
+ log_err("fio: SetPriorityClass failed\n");
return 0;
}
@@ -667,17 +737,9 @@ int getrusage(int who, struct rusage *r_usage)
int posix_madvise(void *addr, size_t len, int advice)
{
- log_err("%s is not implemented\n", __func__);
return ENOSYS;
}
-/* Windows doesn't support advice for memory pages. Just ignore it. */
-int msync(void *addr, size_t len, int flags)
-{
- errno = ENOSYS;
- return -1;
-}
-
int fdatasync(int fildes)
{
return fsync(fildes);
@@ -864,7 +926,7 @@ struct dirent *readdir(DIR *dirp)
if (dirp->find_handle == INVALID_HANDLE_VALUE) {
char search_pattern[MAX_PATH];
- StringCchPrintfA(search_pattern, MAX_PATH, "%s\\*", dirp->dirname);
+ StringCchPrintfA(search_pattern, MAX_PATH-1, "%s\\*", dirp->dirname);
dirp->find_handle = FindFirstFileA(search_pattern, &find_data);
if (dirp->find_handle == INVALID_HANDLE_VALUE)
return NULL;
diff --git a/os/windows/posix/include/sys/ioctl.h b/os/windows/posix/include/sys/ioctl.h
new file mode 100644
index 00000000..a42247d1
--- /dev/null
+++ b/os/windows/posix/include/sys/ioctl.h
@@ -0,0 +1,7 @@
+#ifndef IOCTL_H
+#define IOCTL_H
+
+/* This file is empty since it only needs to exist on Windows
+ but isn't otherwise used */
+
+#endif /* IOCTL_H */ \ No newline at end of file