X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-linux.h;h=2599091b7fd41d8fbf6efdff0ee6190dfe6e9034;hb=ff2451922f21826c2047208c2c3963843b1ffdcc;hp=024ef89ae23d1d4548b6c4a7982de9db1b6913b2;hpb=a596f047e2b3d447ccca76bd075f05473a1f8d1c;p=fio.git diff --git a/os/os-linux.h b/os/os-linux.h index 024ef89a..2599091b 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -12,6 +12,7 @@ #include #include #include +#include #include "indirect.h" #include "binject.h" @@ -32,7 +33,6 @@ #define FIO_HAVE_BLKTRACE #define FIO_HAVE_STRSEP #define FIO_HAVE_FALLOCATE -#define FIO_HAVE_LINUX_FALLOCATE #define FIO_HAVE_POSIXAIO_FSYNC #define FIO_HAVE_PSHARED_MUTEX #define FIO_HAVE_CL_SIZE @@ -42,6 +42,15 @@ #define FIO_HAVE_TRIM #define FIO_HAVE_BINJECT #define FIO_HAVE_CLOCK_MONOTONIC +#define FIO_HAVE_GETTID + +/* + * Can only enable this for newer glibcs, or the header and defines are + * missing + */ +#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 6 +#define FIO_HAVE_LINUX_FALLOCATE +#endif #ifdef SYNC_FILE_RANGE_WAIT_BEFORE #define FIO_HAVE_SYNC_FILE_RANGE @@ -102,6 +111,11 @@ static inline int ioprio_set(int which, int who, int ioprio) return syscall(__NR_ioprio_set, which, who, ioprio); } +static inline int gettid(void) +{ + return syscall(__NR_gettid); +} + /* * Just check for SPLICE_F_MOVE, if that isn't there, assume the others * aren't either. @@ -273,6 +287,18 @@ static inline int fio_lookup_raw(dev_t dev, int *majdev, int *mindev) #define FIO_MADV_FREE MADV_REMOVE #endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define FIO_LITTLE_ENDIAN +#elif __BYTE_ORDER == __BIG_ENDIAN +#define FIO_BIG_ENDIAN +#else +#error "Unknown endianness" +#endif + +#define fio_swap16(x) __bswap_16(x) +#define fio_swap32(x) __bswap_32(x) +#define fio_swap64(x) __bswap_64(x) + #define CACHE_LINE_FILE \ "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"