Add strong madvise() hint for cache pruning
[fio.git] / os / os-solaris.h
index 56729565b127631b2061258c7a9e373e47da7f21..5029d38f356e5983992bb58ae04cfffa77773a5d 100644 (file)
@@ -23,12 +23,15 @@ struct solaris_rand_seed {
 typedef psetid_t os_cpu_mask_t;
 typedef struct solaris_rand_seed os_random_state_t;
 
-/*
- * FIXME
- */
 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)
@@ -70,7 +73,7 @@ static inline int fio_set_odirect(int fd)
  * pset binding hooks for fio
  */
 #define fio_setaffinity(pid, cpumask)          \
-       pset_bind(&(cpumask), P_PID, (pid), NULL)
+       pset_bind((cpumask), P_PID, (pid), NULL)
 #define fio_getaffinity(pid, ptr)      ({ 0; })
 
 #define fio_cpu_clear(mask, cpu)       pset_assign(PS_NONE, (cpu), NULL)
@@ -105,4 +108,8 @@ static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
  */
 #define FIO_MAX_CPUS                   16384
 
+#ifdef MADV_FREE
+#define FIO_MADV_FREE  MADV_FREE
+#endif
+
 #endif