+
+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);
+
+static inline bool fio_fallocate(struct fio_file *f, uint64_t offset, uint64_t len)
+{
+ fstore_t store = {F_ALLOCATEALL, F_PEOFPOSMODE, offset, len};
+ if (fcntl(f->fd, F_PREALLOCATE, &store) != -1) {
+ if (ftruncate(f->fd, len) == 0)
+ return true;
+ }
+
+ return false;
+}
+