aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-04 17:44:07 +0200
committerSverker Eriksson <[email protected]>2016-05-04 18:55:46 +0200
commitdd5087bf582bba0879fa352bdc0ddcbf06d943d2 (patch)
treee9c0958a8541095a07e3a85b715d04f00b0a5efc /erts
parent067c234829144dd1c33b9640cd6a0e5faf3d04b3 (diff)
downloadotp-dd5087bf582bba0879fa352bdc0ddcbf06d943d2.tar.gz
otp-dd5087bf582bba0879fa352bdc0ddcbf06d943d2.tar.bz2
otp-dd5087bf582bba0879fa352bdc0ddcbf06d943d2.zip
erts: Add macro HAVE_ERTS_MMAP
and make erts_mmap unavailable at compile time if not supported.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_alloc.c23
-rw-r--r--erts/emulator/beam/erl_bif_info.c2
-rw-r--r--erts/emulator/sys/common/erl_mmap.c13
-rw-r--r--erts/emulator/sys/common/erl_mmap.h15
4 files changed, 38 insertions, 15 deletions
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index 01db65d539..f571515def 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -2963,10 +2963,11 @@ erts_allocator_options(void *proc)
atoms[length] = am_atom_put("alloc_util", 10);
terms[length++] = erts_alcu_au_info_options(NULL, NULL, hpp, szp);
-
+#if HAVE_ERTS_MMAP
atoms[length] = ERTS_MAKE_AM("erts_mmap");
terms[length++] = erts_mmap_info_options(&erts_dflt_mmapper, NULL, NULL,
NULL, hpp, szp);
+#endif
{
Eterm o[3], v[3];
o[0] = am_atom_put("m", 1);
@@ -3093,12 +3094,14 @@ reply_alloc_info(void *vair)
Uint sz, *szp;
ErlOffHeap *ohp = NULL;
ErtsMessage *mp = NULL;
+#if HAVE_ERTS_MMAP
struct erts_mmap_info_struct mmap_info_dflt;
-#if defined(ARCH_64) && defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
+# if defined(ARCH_64) && defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
struct erts_mmap_info_struct mmap_info_literal;
-#endif
-#ifdef ERTS_ALC_A_EXEC
+# endif
+# ifdef ERTS_ALC_A_EXEC
struct erts_mmap_info_struct mmap_info_exec;
+# endif
#endif
int i;
Eterm (*info_func)(Allctr_t *,
@@ -3207,7 +3210,7 @@ reply_alloc_info(void *vair)
break;
case ERTS_ALC_INFO_A_ERTS_MMAP:
alloc_atom = erts_bld_atom(hpp, szp, "erts_mmap");
-
+#if HAVE_ERTS_MMAP
ainfo = (air->only_sz ? NIL :
erts_mmap_info(&erts_dflt_mmapper, NULL, NULL,
hpp, szp, &mmap_info_dflt));
@@ -3215,7 +3218,7 @@ reply_alloc_info(void *vair)
alloc_atom,
erts_bld_atom(hpp,szp,"default_mmap"),
ainfo);
-#if defined(ARCH_64) && defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
+# if defined(ARCH_64) && defined(ERTS_HAVE_OS_PHYSICAL_MEMORY_RESERVATION)
ai_list = erts_bld_cons(hpp, szp,
ainfo, ai_list);
ainfo = (air->only_sz ? NIL :
@@ -3225,8 +3228,8 @@ reply_alloc_info(void *vair)
alloc_atom,
erts_bld_atom(hpp,szp,"literal_mmap"),
ainfo);
-#endif
-#ifdef ERTS_ALC_A_EXEC
+# endif
+# ifdef ERTS_ALC_A_EXEC
ai_list = erts_bld_cons(hpp, szp,
ainfo, ai_list);
ainfo = (air->only_sz ? NIL :
@@ -3236,6 +3239,10 @@ reply_alloc_info(void *vair)
alloc_atom,
erts_bld_atom(hpp,szp,"exec_mmap"),
ainfo);
+# endif
+#else /* !HAVE_ERTS_MMAP */
+ ainfo = erts_bld_tuple2(hpp, szp, alloc_atom,
+ am_false);
#endif
break;
case ERTS_ALC_INFO_A_MSEG_ALLOC:
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index c9741b361f..95d1fef3d3 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -3554,7 +3554,7 @@ BIF_RETTYPE erts_debug_get_internal_state_1(BIF_ALIST_1)
BIF_RET(res);
}
else if (ERTS_IS_ATOM_STR("mmap", BIF_ARG_1)) {
- BIF_RET(erts_mmap_debug_info(&erts_dflt_mmapper, BIF_P));
+ BIF_RET(erts_mmap_debug_info(BIF_P));
}
else if (ERTS_IS_ATOM_STR("unique_monotonic_integer_state", BIF_ARG_1)) {
BIF_RET(erts_debug_get_unique_monotonic_integer_state(BIF_P));
diff --git a/erts/emulator/sys/common/erl_mmap.c b/erts/emulator/sys/common/erl_mmap.c
index bf675cf1ab..53009a1481 100644
--- a/erts/emulator/sys/common/erl_mmap.c
+++ b/erts/emulator/sys/common/erl_mmap.c
@@ -28,6 +28,8 @@
#include "erl_mmap.h"
#include <stddef.h>
+#if HAVE_ERTS_MMAP
+
/* #define ERTS_MMAP_OP_RINGBUF_SZ 100 */
#if defined(DEBUG) || 0
@@ -2513,9 +2515,13 @@ Eterm erts_mmap_info_options(ErtsMemMapper* mm,
return res;
}
+#endif /* HAVE_ERTS_MMAP */
-Eterm erts_mmap_debug_info(ErtsMemMapper* mm, Process* p)
+Eterm erts_mmap_debug_info(Process* p)
{
+#if HAVE_ERTS_MMAP
+ ErtsMemMapper* mm = &erts_dflt_mmapper;
+
if (mm->supercarrier) {
ERTS_DECL_AM(sabot);
ERTS_DECL_AM(satop);
@@ -2553,9 +2559,8 @@ Eterm erts_mmap_debug_info(ErtsMemMapper* mm, Process* p)
HRelease(p, hp_end, hp);
return list;
}
- else {
- return am_undefined;
- }
+#endif
+ return am_undefined;
}
diff --git a/erts/emulator/sys/common/erl_mmap.h b/erts/emulator/sys/common/erl_mmap.h
index 3790f2c94e..7ac61a82c1 100644
--- a/erts/emulator/sys/common/erl_mmap.h
+++ b/erts/emulator/sys/common/erl_mmap.h
@@ -50,6 +50,13 @@
# define ERTS_HAVE_OS_MMAP 1
#endif
+#ifdef ERTS_HAVE_GENUINE_OS_MMAP
+# define HAVE_ERTS_MMAP 1
+#else
+# define HAVE_ERTS_MMAP 0
+#endif
+
+
extern UWord erts_page_inv_mask;
typedef struct {
@@ -107,6 +114,10 @@ typedef struct {
#define ERTS_PAGEALIGNED_SIZE \
(ERTS_INV_PAGEALIGNED_MASK + 1)
+struct process;
+Eterm erts_mmap_debug_info(struct process*);
+
+#if HAVE_ERTS_MMAP
typedef struct ErtsMemMapper_ ErtsMemMapper;
@@ -130,8 +141,6 @@ Eterm erts_mmap_info(ErtsMemMapper*, int *print_to_p, void *print_to_arg,
Eterm erts_mmap_info_options(ErtsMemMapper*,
char *prefix, int *print_to_p, void *print_to_arg,
Uint **hpp, Uint *szp);
-struct process;
-Eterm erts_mmap_debug_info(ErtsMemMapper*, struct process*);
#ifdef ERTS_WANT_MEM_MAPPERS
@@ -157,4 +166,6 @@ void hard_dbg_remove_mseg(void* seg, UWord sz);
# define HARD_DBG_REMOVE_MSEG(SEG,SZ)
#endif
+#endif /* HAVE_ERTS_MMAP */
+
#endif /* ERL_MMAP_H__ */