client: pretty up probe output
[fio.git] / os / os-freebsd.h
CommitLineData
ebac4655
JA
1#ifndef FIO_OS_FREEBSD_H
2#define FIO_OS_FREEBSD_H
3
cca84643
JA
4#define FIO_OS os_freebsd
5
690dec6e 6#include <errno.h>
5c4e1dbc 7#include <sys/sysctl.h>
aa5e69b2 8#include <sys/disk.h>
b939683e 9#include <sys/thr.h>
232f9b73 10#include <sys/endian.h>
5c4e1dbc 11
e2e58886
JA
12#include "../file.h"
13
ebac4655 14#define FIO_HAVE_POSIXAIO
2c0ecd28 15#define FIO_HAVE_ODIRECT
ecc314ba 16#define FIO_HAVE_STRSEP
53531370 17#define FIO_USE_GENERIC_RAND
4ccdccd1 18#define FIO_HAVE_CHARDEV_SIZE
ecc314ba 19#define FIO_HAVE_CLOCK_MONOTONIC
e8d588e4 20#define FIO_HAVE_GETTID
ebac4655 21
dc873b6f 22#define OS_MAP_ANON MAP_ANON
ebac4655 23
232f9b73
JA
24#if BYTE_ORDER == LITTLE_ENDIAN
25#define FIO_LITTLE_ENDIAN
26#else
27#define FIO_BIG_ENDIAN
28#endif
29
30#define fio_swap16(x) bswap16(x)
31#define fio_swap32(x) bswap32(x)
32#define fio_swap64(x) bswap64(x)
33
907249cf
JA
34typedef off_t off64_t;
35
ecc314ba 36static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
aa5e69b2
JA
37{
38 off_t size;
39
ecc314ba 40 if (!ioctl(f->fd, DIOCGMEDIASIZE, &size)) {
aa5e69b2
JA
41 *bytes = size;
42 return 0;
43 }
44
2fa55e93 45 *bytes = 0;
aa5e69b2
JA
46 return errno;
47}
48
ecc314ba 49static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
4ccdccd1 50{
9b836561 51 return blockdev_size(f, bytes);
4ccdccd1
JA
52}
53
ecc314ba 54static inline int blockdev_invalidate_cache(struct fio_file *f)
e5b401d4
JA
55{
56 return EINVAL;
ebac4655
JA
57}
58
32cd46a0
JA
59static inline unsigned long long os_phys_mem(void)
60{
61 int mib[2] = { CTL_HW, HW_PHYSMEM };
62 unsigned long long mem;
63 size_t len = sizeof(mem);
64
65 sysctl(mib, 2, &mem, &len, NULL, 0);
66 return mem;
67}
68
e8d588e4
JA
69static inline int gettid(void)
70{
71 long lwpid;
72
73 thr_self(&lwpid);
74 return (int) lwpid;
75}
76
a1c58075
JA
77#ifdef MADV_FREE
78#define FIO_MADV_FREE MADV_FREE
79#endif
80
ebac4655 81#endif