From f7abaee8c456a3d4d2a65ca90708c372a37ac1e6 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 13 Feb 2014 23:59:39 +0000 Subject: [PATCH] Some windows cleanups - thanks to Marco Atzeri for the patch cmr=v1.7.5:reviewer=miked This commit was SVN r30720. --- oshmem/include/shmem.h.in | 29 ++++++-------------- oshmem/mca/memheap/base/memheap_base_alloc.c | 4 ++- oshmem/mca/memheap/ptmalloc/malloc.c | 25 ----------------- 3 files changed, 12 insertions(+), 46 deletions(-) diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index e2355ddb57..7897d3b33a 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -1,6 +1,7 @@ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2014 Intel, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -14,16 +15,12 @@ #include /* include for ptrdiff_t */ -#if defined(WIN32) || defined(_WIN32) -# define OSHMEM_COMPLEX_TYPE(type) +#if defined(c_plusplus) || defined(__cplusplus) +# include +# define OSHMEM_COMPLEX_TYPE(type) std::complex #else -# if defined(c_plusplus) || defined(__cplusplus) -# include -# define OSHMEM_COMPLEX_TYPE(type) std::complex -# else -# include -# define OSHMEM_COMPLEX_TYPE(type) type complex -# endif +# include +# define OSHMEM_COMPLEX_TYPE(type) type complex #endif @@ -35,18 +32,10 @@ #ifndef OSHMEM_DECLSPEC -# if defined(WIN32) || defined(_WIN32) -# if defined(OSHMEM_IMPORTS) -# define OSHMEM_DECLSPEC __declspec(dllimport) -# else -# define OSHMEM_DECLSPEC -# endif /* defined(OSHMEM_IMPORTS) */ +# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1) +# define OSHMEM_DECLSPEC __attribute__((visibility("default"))) # else -# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1) -# define OSHMEM_DECLSPEC __attribute__((visibility("default"))) -# else -# define OSHMEM_DECLSPEC -# endif +# define OSHMEM_DECLSPEC # endif #endif diff --git a/oshmem/mca/memheap/base/memheap_base_alloc.c b/oshmem/mca/memheap/base/memheap_base_alloc.c index 8575bea9b1..85c8053c47 100644 --- a/oshmem/mca/memheap/base/memheap_base_alloc.c +++ b/oshmem/mca/memheap/base/memheap_base_alloc.c @@ -2,6 +2,7 @@ * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014 Intel, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,6 +22,7 @@ #include #include +#include #if defined(MPAGE_ENABLE) && (MPAGE_ENABLE > 0) #include @@ -222,7 +224,7 @@ static int _shm_attach(map_segment_t *s, size_t size, int use_hp, int do_rmid) shm_context = use_hp; - flags = IPC_CREAT | IPC_EXCL | SHM_R | SHM_W; + flags = IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR;; #if defined (SHM_HUGETLB) flags |= (use_hp ? SHM_HUGETLB : 0); #endif diff --git a/oshmem/mca/memheap/ptmalloc/malloc.c b/oshmem/mca/memheap/ptmalloc/malloc.c index 95e45a0067..3551d8cd61 100644 --- a/oshmem/mca/memheap/ptmalloc/malloc.c +++ b/oshmem/mca/memheap/ptmalloc/malloc.c @@ -482,31 +482,6 @@ MAX_RELEASE_CHECK_RATE default: 255 unless not DL_HAVE_MMAP improvement at the expense of carrying around more memory. */ -#ifndef WIN32 -#ifdef _WIN32 -#define WIN32 1 -#endif /* _WIN32 */ -#endif /* WIN32 */ -#ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#define DL_HAVE_MMAP 1 -#define HAVE_MORECORE 0 -#define LACKS_UNISTD_H -#define LACKS_SYS_PARAM_H -#define LACKS_SYS_MMAN_H -#define LACKS_STRING_H -#define LACKS_STRINGS_H -#define LACKS_SYS_TYPES_H -#define LACKS_ERRNO_H -#define MALLOC_FAILURE_ACTION -#ifdef _WIN32_WCE /* WINCE reportedly does not clear */ -#define MMAP_CLEARS 0 -#else -#define MMAP_CLEARS 1 -#endif /* _WIN32_WCE */ -#endif /* WIN32 */ - #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE