Don't align memory unless using raw io
[fio.git] / os / os-linux.h
index a4f7b244172d2dbefc0b24ac754df9327640cc4a..11f767c5b2e8105c6ab9fec7f10baf17f9a566d2 100644 (file)
@@ -22,6 +22,7 @@
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_RAWBIND
+#define FIO_HAVE_BLKTRACE
 
 #define OS_MAP_ANON            (MAP_ANONYMOUS)
 
@@ -34,10 +35,21 @@ typedef struct drand48_data os_random_state_t;
 #define fadvise(fd, off, len, advice)  \
        posix_fadvise((fd), (off_t)(off), (len), (advice))
 
+/*
+ * If you are on an ancient glibc (2.3.2), then define GLIBC_2_3_2 if you want
+ * the affinity helpers to work.
+ */
+#ifndef GLIBC_2_3_2
 #define fio_setaffinity(td)            \
        sched_setaffinity((td)->pid, sizeof((td)->o.cpumask), &(td)->o.cpumask)
 #define fio_getaffinity(pid, ptr)      \
        sched_getaffinity((pid), sizeof(cpu_set_t), (ptr))
+#else
+#define fio_setaffinity(td)            \
+       sched_setaffinity((td)->pid, &(td)->o.cpumask)
+#define fio_getaffinity(pid, ptr)      \
+       sched_getaffinity((pid), (ptr))
+#endif
 
 static inline int ioprio_set(int which, int who, int ioprio)
 {
@@ -57,7 +69,7 @@ static inline int ioprio_set(int which, int who, int ioprio)
 #define SPLICE_F_GIFT   (0x08)  /* pages passed in are a gift */
 
 static inline int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out,
-                        size_t len, unsigned long flags)
+                        size_t len, unsigned int flags)
 {
        return syscall(__NR_sys_splice, fdin, off_in, fdout, off_out, len, flags);
 }
@@ -74,6 +86,10 @@ static inline int vmsplice(int fd, const struct iovec *iov,
 }
 #endif
 
+#ifdef SPLICE_F_UNMAP
+#define SPLICE_F_UNMAP (0x10)
+#endif
+
 #define SPLICE_DEF_SIZE        (64*1024)
 
 #ifdef FIO_HAVE_SYSLET