cpu_online() implementation for ppc64 added to os/os.h by
c5dd5d97
(powerpc: fix cpus_online() to get correct max CPU number for powerpc64)
seems Linux specific, thus it should be moved to os/os-linux.h.
For example, non standard sysconf values _SC_NPROCESSORS_ONLN and
_SC_NPROCESSORS_CONF do the same thing with libc in FreeBSD, whereas
they aren't always the same with glibc. This implies
c5dd5d97 is about
Linux, and wouldn't be a general solution that needs to be in os/os.h.
sysconf(3) in FreeBSD
https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/sysconf.c#L588
Another possibility is AIX in addition to Linux, but below website
has an example of both _SC_NPROCESSORS_ONLN and _SC_NPROCESSORS_CONF
having the same value under SMT.
Topic: prtconf and sysconf produce different numbers of processors
https://www.ibm.com/developerworks/community/forums/html/topic?id=
77777777-0000-0000-0000-
000014250083
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
return atoi(size);
}
+#ifdef __powerpc64__
+#define FIO_HAVE_CPU_ONLINE_SYSCONF
+static inline unsigned int cpus_online(void)
+{
+ return sysconf(_SC_NPROCESSORS_CONF);
+}
+#endif
+
static inline unsigned long long get_fs_free_size(const char *path)
{
unsigned long long ret;
}
#endif
-#ifdef __powerpc64__
-#define FIO_HAVE_CPU_ONLINE_SYSCONF
-static inline unsigned int cpus_online(void)
-{
- return sysconf(_SC_NPROCESSORS_CONF);
-}
-#endif
-
#ifndef FIO_HAVE_CPU_ONLINE_SYSCONF
static inline unsigned int cpus_online(void)
{