X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos.h;h=7f92d1bc710bbf84a13c582a7e0d5c7893b36697;hp=4416ae482fb46a176cccf252bea8307dbc24b0c8;hb=b24f59ab5ac96a67a016dc921687b0feae9bbf94;hpb=d7213923067aa49922962a469a691c3ec951064d diff --git a/os/os.h b/os/os.h index 4416ae48..7f92d1bc 100644 --- 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 @@ -90,6 +96,12 @@ typedef unsigned long os_cpu_mask_t; #define OS_O_DIRECT O_DIRECT #endif +#ifdef OS_O_ATOMIC +#define FIO_O_ATOMIC OS_O_ATOMIC +#else +#define FIO_O_ATOMIC 0 +#endif + #ifndef FIO_HAVE_HUGETLB #define SHM_HUGETLB 0 #define MAP_HUGETLB 0 @@ -214,12 +226,13 @@ static inline uint64_t fio_swap64(uint64_t val) }) #ifndef FIO_HAVE_BLKTRACE -static inline int is_blktrace(const char *fname) +static inline int is_blktrace(const char *fname, int *need_swap) { return 0; } struct thread_data; -static inline int load_blktrace(struct thread_data *td, const char *fname) +static inline int load_blktrace(struct thread_data *td, const char *fname, + int need_swap) { return 1; } @@ -314,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) {