From f8ed6d895233a874ce4e119f24d759445dff254d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 16 Dec 2009 09:50:05 +0100 Subject: [PATCH] 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 --- helpers.c | 11 +---------- os/os-solaris.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/helpers.c b/helpers.c index 098195c8..8ac58239 100644 --- a/helpers.c +++ b/helpers.c @@ -1,20 +1,11 @@ -#include #include #include #include +#include #include #include "compiler/compiler.h" -int __weak posix_memalign(void **ptr, size_t align, size_t size) -{ - *ptr = memalign(align, size); - if (*ptr) - return 0; - - return ENOMEM; -} - int __weak posix_fallocate(int fd, off_t offset, off_t len) { return 0; 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 +#include #include #include #include @@ -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 -- 2.25.1