From: Tomohiro Kusumi Date: Fri, 3 Nov 2017 16:46:02 +0000 (+0200) Subject: solaris: add os_phys_mem() implementation X-Git-Tag: fio-3.2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f1ee61586b30ea4a54c8f10e1b1c5aa28a837101;p=fio.git solaris: add os_phys_mem() implementation Copied from os/os-linux.h. The standard sysconf(3C) names work on Solaris (actually compiled/tested on illumos) as well. Signed-off-by: Tomohiro Kusumi Signed-off-by: Jens Axboe --- diff --git a/os/os-solaris.h b/os/os-solaris.h index a6cd3766..644807c5 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -66,7 +66,14 @@ static inline int blockdev_invalidate_cache(struct fio_file *f) static inline unsigned long long os_phys_mem(void) { - return 0; + long pagesize, pages; + + pagesize = sysconf(_SC_PAGESIZE); + pages = sysconf(_SC_PHYS_PAGES); + if (pages == -1 || pagesize == -1) + return 0; + + return (unsigned long long) pages * (unsigned long long) pagesize; } static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)