X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=os%2Fos-mac.h;h=c9103c45ac44afe0a79e6878d7f604f49b9dae18;hb=9943adfb8adf50e6f54ab6aff613c99a3a75d224;hp=92a60ee98766f0fc1526cd440e38a687e6cc02ae;hpb=c032d6743ad21cc6702e8ac71afe227e9cd8773c;p=fio.git diff --git a/os/os-mac.h b/os/os-mac.h index 92a60ee9..c9103c45 100644 --- a/os/os-mac.h +++ b/os/os-mac.h @@ -14,13 +14,14 @@ #include #include +#include "../arch/arch.h" #include "../file.h" -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_GETTID #define FIO_HAVE_CHARDEV_SIZE #define FIO_HAVE_NATIVE_FALLOCATE +#define FIO_HAVE_CPU_HAS #define OS_MAP_ANON MAP_ANON @@ -28,13 +29,11 @@ #define fio_swap32(x) OSSwapInt32(x) #define fio_swap64(x) OSSwapInt64(x) -/* - * OSX has a pitifully small shared memory segment by default, - * so default to a lower number of max jobs supported - */ -#define FIO_MAX_JOBS 128 - -typedef off_t off64_t; +#ifdef CONFIG_PTHREAD_GETAFFINITY +#define FIO_HAVE_GET_THREAD_AFFINITY +#define fio_get_thread_affinity(mask) \ + pthread_getaffinity_np(pthread_self(), sizeof(mask), &(mask)) +#endif #ifndef CONFIG_CLOCKID_T typedef unsigned int clockid_t; @@ -91,16 +90,12 @@ static inline unsigned long long os_phys_mem(void) return mem; } +#ifndef CONFIG_HAVE_GETTID static inline int gettid(void) { return mach_thread_self(); } - -/* - * For some reason, there's no header definition for fdatasync(), even - * if it exists. - */ -extern int fdatasync(int fd); +#endif static inline bool fio_fallocate(struct fio_file *f, uint64_t offset, uint64_t len) { @@ -113,4 +108,12 @@ static inline bool fio_fallocate(struct fio_file *f, uint64_t offset, uint64_t l return false; } +static inline bool os_cpu_has(cpu_features feature) +{ + /* just check for arm on OSX for now, we know that has it */ + if (feature != CPU_ARM64_CRC32C) + return false; + return FIO_ARCH == arch_aarch64; +} + #endif