From 448a4707ce190606dcde47e0542b69136689a150 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 10 Jan 2014 15:20:34 +0000 Subject: [PATCH] Portability fix: better checking for MAP_ANONYMOUS and MAP_ANON. Thanks to Paul Hargrove for identifying the issue and suggesting the fix. This commit was SVN r30227. --- oshmem/mca/memheap/base/memheap_base_alloc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/oshmem/mca/memheap/base/memheap_base_alloc.c b/oshmem/mca/memheap/base/memheap_base_alloc.c index a1d97bf2b9..13a525550d 100644 --- a/oshmem/mca/memheap/base/memheap_base_alloc.c +++ b/oshmem/mca/memheap/base/memheap_base_alloc.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,6 +27,13 @@ #include #endif /* MPAGE_ENABLE */ +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +#endif /* MAP_ANONYMOUS and MAP_ANON */ +#if !defined(MAP_FAILED) +# define MAP_FAILED ((char*)-1) +#endif /* MAP_FAILED */ + extern char* mca_memheap_base_param_hca_name; static int _shm_attach(map_segment_t *, size_t, int, int); @@ -278,10 +286,8 @@ static int _mmap_attach(map_segment_t *s, size_t size) size, PROT_READ | PROT_WRITE, MAP_SHARED | -#if defined (__APPLE__) -MAP_ANON | -#elif defined (__GNUC__) -MAP_ANONYMOUS | +#if defined(MAP_ANONYMOUS) + MAP_ANONYMOUS | #endif MAP_FIXED, 0,