summaryrefslogtreecommitdiff
path: root/os/os-solaris.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-12-16 09:50:05 +0100
committerJens Axboe <jens.axboe@oracle.com>2009-12-16 09:50:05 +0100
commitf8ed6d895233a874ce4e119f24d759445dff254d (patch)
tree559c3d7df823855764d42629f8704860b2ff4fcb /os/os-solaris.h
parent535313705d69dc16f27ca38acf2f9bf7205e410d (diff)
downloadfio-f8ed6d895233a874ce4e119f24d759445dff254d.tar.gz
fio-f8ed6d895233a874ce4e119f24d759445dff254d.tar.bz2
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>
Diffstat (limited to 'os/os-solaris.h')
-rw-r--r--os/os-solaris.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/os/os-solaris.h b/os/os-solaris.h
index ff8d6f25..175654e8 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 @@ static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
#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