projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add basic memcpy test
[fio.git]
/
os
/
os-dragonfly.h
diff --git
a/os/os-dragonfly.h
b/os/os-dragonfly.h
index 187330bfd39f49a09b514be4c0df800623ba6974..713046f53543442a89d21c55ace2cbcd05839d4b 100644
(file)
--- a/
os/os-dragonfly.h
+++ b/
os/os-dragonfly.h
@@
-5,6
+5,7
@@
#include <errno.h>
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/endian.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/statvfs.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/statvfs.h>
@@
-14,6
+15,7
@@
#include <sys/resource.h>
#include "../file.h"
#include <sys/resource.h>
#include "../file.h"
+#include "../lib/types.h"
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
#define FIO_HAVE_ODIRECT
#define FIO_USE_GENERIC_RAND
@@
-24,6
+26,7
@@
#define FIO_HAVE_GETTID
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_IOPRIO
#define FIO_HAVE_GETTID
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_IOPRIO
+#define FIO_HAVE_SHM_ATTACH_REMOVED
#define OS_MAP_ANON MAP_ANON
#define OS_MAP_ANON MAP_ANON
@@
-70,8
+73,7
@@
typedef cpumask_t os_cpu_mask_t;
/*
* Define USCHED_GET_CPUMASK as the macro didn't exist until release 4.5.
/*
* Define USCHED_GET_CPUMASK as the macro didn't exist until release 4.5.
- * usched_set(2) returns EINVAL if the kernel doesn't support it, though
- * fio_getaffinity() returns void.
+ * usched_set(2) returns EINVAL if the kernel doesn't support it.
*
* Also note usched_set(2) works only for the current thread regardless of
* the command type. It doesn't work against another thread regardless of
*
* Also note usched_set(2) works only for the current thread regardless of
* the command type. It doesn't work against another thread regardless of
@@
-82,6
+84,9
@@
typedef cpumask_t os_cpu_mask_t;
#define USCHED_GET_CPUMASK 5
#endif
#define USCHED_GET_CPUMASK 5
#endif
+/* No CPU_COUNT(), but use the default function defined in os/os.h */
+#define fio_cpu_count(mask) CPU_COUNT((mask))
+
static inline int fio_cpuset_init(os_cpu_mask_t *mask)
{
CPUMASK_ASSZERO(*mask);
static inline int fio_cpuset_init(os_cpu_mask_t *mask)
{
CPUMASK_ASSZERO(*mask);
@@
-103,23
+108,9
@@
static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu)
CPUMASK_ORBIT(*mask, cpu);
}
CPUMASK_ORBIT(*mask, cpu);
}
-static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
-{
- if (CPUMASK_TESTBIT(*mask, cpu))
- return 1;
-
- return 0;
-}
-
-static inline int fio_cpu_count(os_cpu_mask_t *mask)
+static inline bool fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
{
{
- int i, n = 0;
-
- for (i = 0; i < FIO_MAX_CPUS; i++)
- if (CPUMASK_TESTBIT(*mask, i))
- n++;
-
- return n;
+ return CPUMASK_TESTBIT(*mask, cpu) != 0;
}
static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
}
static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
@@
-145,12
+136,15
@@
static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
return 0;
}
return 0;
}
-static inline
void
fio_getaffinity(int pid, os_cpu_mask_t *mask)
+static inline
int
fio_getaffinity(int pid, os_cpu_mask_t *mask)
{
/* 0 for the current thread, see BUGS in usched_set(2) */
pid = 0;
{
/* 0 for the current thread, see BUGS in usched_set(2) */
pid = 0;
- usched_set(pid, USCHED_GET_CPUMASK, mask, sizeof(*mask));
+ if (usched_set(pid, USCHED_GET_CPUMASK, mask, sizeof(*mask)))
+ return -1;
+
+ return 0;
}
/* fio code is Linux based, so rename macros to Linux style */
}
/* fio code is Linux based, so rename macros to Linux style */
@@
-189,7
+183,7
@@
static inline int chardev_size(struct fio_file *f, unsigned long long *bytes)
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
- return E
INVAL
;
+ return E
NOTSUP
;
}
static inline unsigned long long os_phys_mem(void)
}
static inline unsigned long long os_phys_mem(void)
@@
-220,7
+214,7
@@
static inline unsigned long long get_fs_free_size(const char *path)
return ret;
}
return ret;
}
-static inline int os_trim(
int fd
, unsigned long long start,
+static inline int os_trim(
struct fio_file *f
, unsigned long long start,
unsigned long long len)
{
off_t range[2];
unsigned long long len)
{
off_t range[2];
@@
-228,7
+222,7
@@
static inline int os_trim(int fd, unsigned long long start,
range[0] = start;
range[1] = len;
range[0] = start;
range[1] = len;
- if (!ioctl(fd, IOCTLTRIM, range))
+ if (!ioctl(f
->f
d, IOCTLTRIM, range))
return 0;
return errno;
return 0;
return errno;
@@
-238,4
+232,15
@@
static inline int os_trim(int fd, unsigned long long start,
#define FIO_MADV_FREE MADV_FREE
#endif
#define FIO_MADV_FREE MADV_FREE
#endif
+static inline int shm_attach_to_open_removed(void)
+{
+ int x;
+ size_t len = sizeof(x);
+
+ if (sysctlbyname("kern.ipc.shm_allow_removed", &x, &len, NULL, 0) < 0)
+ return 0;
+
+ return x > 0 ? 1 : 0;
+}
+
#endif
#endif