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.
Этот коммит содержится в:
родитель
d9f144d09f
Коммит
448a4707ce
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -26,6 +27,13 @@
|
|||||||
#include <infiniband/verbs.h>
|
#include <infiniband/verbs.h>
|
||||||
#endif /* MPAGE_ENABLE */
|
#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;
|
extern char* mca_memheap_base_param_hca_name;
|
||||||
|
|
||||||
static int _shm_attach(map_segment_t *, size_t, int, int);
|
static int _shm_attach(map_segment_t *, size_t, int, int);
|
||||||
@ -278,9 +286,7 @@ static int _mmap_attach(map_segment_t *s, size_t size)
|
|||||||
size,
|
size,
|
||||||
PROT_READ | PROT_WRITE,
|
PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED |
|
MAP_SHARED |
|
||||||
#if defined (__APPLE__)
|
#if defined(MAP_ANONYMOUS)
|
||||||
MAP_ANON |
|
|
||||||
#elif defined (__GNUC__)
|
|
||||||
MAP_ANONYMOUS |
|
MAP_ANONYMOUS |
|
||||||
#endif
|
#endif
|
||||||
MAP_FIXED,
|
MAP_FIXED,
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user