From c554638446abce4dcdd29640e3d85c9d99048638 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sun, 17 Dec 2006 17:28:59 +0000 Subject: [PATCH] Support systems without malloc.h or posix_memalign (ie, pretty much every one we support that isn't Linux) This commit was SVN r12880. --- configure.ac | 2 +- ompi/mca/mpool/rdma/mpool_rdma_component.c | 2 ++ ompi/mca/mpool/rdma/mpool_rdma_module.c | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bf025a330a..d0f3c34e74 100644 --- a/configure.ac +++ b/configure.ac @@ -713,7 +713,7 @@ OMPI_CHECK_FUNC_LIB([dirname], [gen]) # Darwin doesn't need -lm, as it's a symlink to libSystem.dylib OMPI_CHECK_FUNC_LIB([ceil], [m]) -AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp]) +AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp posix_memalign]) # # Make sure we can copy va_lists (need check declared, not linkable) diff --git a/ompi/mca/mpool/rdma/mpool_rdma_component.c b/ompi/mca/mpool/rdma/mpool_rdma_component.c index 5578eb62a3..e3c68190b5 100644 --- a/ompi/mca/mpool/rdma/mpool_rdma_component.c +++ b/ompi/mca/mpool/rdma/mpool_rdma_component.c @@ -26,7 +26,9 @@ #include "orte/util/proc_info.h" #include "orte/util/sys_info.h" #include +#ifdef HAVE_MALLOC_H #include +#endif /* * Local functions diff --git a/ompi/mca/mpool/rdma/mpool_rdma_module.c b/ompi/mca/mpool/rdma/mpool_rdma_module.c index b4572f14ed..a7b19670d3 100644 --- a/ompi/mca/mpool/rdma/mpool_rdma_module.c +++ b/ompi/mca/mpool/rdma/mpool_rdma_module.c @@ -25,7 +25,9 @@ #include "ompi/mca/mpool/rdma/mpool_rdma.h" #include #include +#ifdef HAVE_MALLOC_H #include +#endif #include "ompi/mca/rcache/rcache.h" #include "ompi/mca/rcache/base/base.h" #include "ompi/mca/mpool/base/base.h" @@ -82,8 +84,14 @@ void* mca_mpool_rdma_alloc(mca_mpool_base_module_t *mpool, size_t size, { void *addr; +#ifdef HAVE_POSIX_MEMALIGN if(posix_memalign(&addr, mca_mpool_base_page_size, size) != 0) return NULL; +#else + if (NULL == (addr = malloc(size))) { + return NULL; + } +#endif if(OMPI_SUCCESS != mca_mpool_rdma_register(mpool, addr, size, flags, reg)) { free(addr);