Make weak posix_memalign() private to Solaris
OSX has posix_memalign() but no memalign() and no malloc.h
standard include. So until we have a autoconf based build
system, move this weak helper to the private Solaris header.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/os/os-solaris.h b/os/os-solaris.h
index ff8d6f2..175654e 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -2,6 +2,7 @@
#define FIO_OS_SOLARIS_H
#include <errno.h>
+#include <malloc.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/pset.h>
@@ -102,4 +103,17 @@
#define FIO_MADV_FREE MADV_FREE
#endif
+/*
+ * Some Solaris versions don't have posix_memalign(), provide a private
+ * weak alternative
+ */
+static inline int __weak posix_memalign(void **ptr, size_t align, size_t size)
+{
+ *ptr = memalign(align, size);
+ if (*ptr)
+ return 0;
+
+ return ENOMEM;
+}
+
#endif