projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add strong madvise() hint for cache pruning
[fio.git]
/
os
/
os-freebsd.h
diff --git
a/os/os-freebsd.h
b/os/os-freebsd.h
index 01c5ce917b57d9501774cd80d8a84e82b6df6b35..26bb8a096790b40d4f4194b2288d1a955596f3b9 100644
(file)
--- a/
os/os-freebsd.h
+++ b/
os/os-freebsd.h
@@
-1,27
+1,26
@@
#ifndef FIO_OS_FREEBSD_H
#define FIO_OS_FREEBSD_H
#ifndef FIO_OS_FREEBSD_H
#define FIO_OS_FREEBSD_H
+#include <errno.h>
#include <sys/sysctl.h>
#include <sys/sysctl.h>
-#undef FIO_HAVE_LIBAIO
#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_POSIXAIO
-#undef FIO_HAVE_FADVISE
-#undef FIO_HAVE_CPU_AFFINITY
-#undef FIO_HAVE_DISK_UTIL
-#undef FIO_HAVE_SGIO
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_ODIRECT
-#define OS_MAP_ANON
(MAP_ANON)
+#define OS_MAP_ANON
MAP_ANON
typedef unsigned long os_cpu_mask_t;
typedef unsigned int os_random_state_t;
typedef unsigned long os_cpu_mask_t;
typedef unsigned int os_random_state_t;
-/*
- * FIXME
- */
static inline int blockdev_size(int fd, unsigned long long *bytes)
{
static inline int blockdev_size(int fd, unsigned long long *bytes)
{
- return EINVAL;
+ off_t end = lseek(fd, 0, SEEK_END);
+
+ if (end < 0)
+ return errno;
+
+ *bytes = end;
+ return 0;
}
static inline int blockdev_invalidate_cache(int fd)
}
static inline int blockdev_invalidate_cache(int fd)
@@
-52,11
+51,8
@@
static inline long os_random_long(os_random_state_t *rs)
return val;
}
return val;
}
-static inline double os_random_double(os_random_state_t *rs)
-{
- double val;
+#ifdef MADV_FREE
+#define FIO_MADV_FREE MADV_FREE
+#endif
- val = (double) rand_r(rs);
- return val;
-}
#endif
#endif