summaryrefslogtreecommitdiff
path: root/os/os-solaris.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-06-04 19:55:58 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-06-04 19:55:58 +0200
commitf022ddb71f93b5d9e32261491284b9881fceaf0c (patch)
treefd129fd8a8d266bd853752cc4f7763511544cd39 /os/os-solaris.h
parente116f2b90f110334e77741227ad4e4600302c718 (diff)
downloadfio-f022ddb71f93b5d9e32261491284b9881fceaf0c.tar.gz
fio-f022ddb71f93b5d9e32261491284b9881fceaf0c.tar.bz2
Solaris: support for proper random functions
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os-solaris.h')
-rw-r--r--os/os-solaris.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 866e0c0e..9e243e8a 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -11,8 +11,12 @@
#define OS_MAP_ANON (MAP_ANON)
+struct solaris_rand_seed {
+ unsigned short r[3];
+};
+
typedef unsigned long os_cpu_mask_t;
-typedef unsigned int os_random_state_t;
+typedef struct solaris_rand_seed os_random_state_t;
/*
* FIXME
@@ -29,29 +33,22 @@ static inline int blockdev_invalidate_cache(int fd)
static inline unsigned long long os_phys_mem(void)
{
-#if 0
- int mib[2] = { CTL_HW, HW_PHYSMEM };
- unsigned long long mem;
- size_t len = sizeof(mem);
-
- sysctl(mib, 2, &mem, &len, NULL, 0);
- return mem;
-#else
return 0;
-#endif
}
static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
{
- srand(seed);
+ rs->r[0] = seed & 0xffff;
+ seed >>= 16;
+ rs->r[1] = seed & 0xffff;
+ seed >>= 16;
+ rs->r[2] = seed & 0xffff;
+ seed48(rs->r);
}
static inline long os_random_long(os_random_state_t *rs)
{
- long val;
-
- val = rand_r(rs);
- return val;
+ return nrand48(rs->r);
}
#define FIO_OS_DIRECTIO