From 5a0b0ec3aa5be6c541f82f61fe09e98420ca9cd7 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Thu, 11 Oct 2018 15:03:26 -0500 Subject: [PATCH] Disable MMAP in the malloc and stub madvise. --- src/internal/malloc_impl.h | 6 ++++++ src/mman/wasm32/madvise.c | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 src/mman/wasm32/madvise.c diff --git a/src/internal/malloc_impl.h b/src/internal/malloc_impl.h index 5d025b06..8039ee82 100644 --- a/src/internal/malloc_impl.h +++ b/src/internal/malloc_impl.h @@ -34,7 +34,13 @@ struct bin { #define C_INUSE ((size_t)1) +#ifndef __wasm__ #define IS_MMAPPED(c) !((c)->csize & (C_INUSE)) +#else +#undef MMAP_THRESHOLD +#define MMAP_THRESHOLD ((size_t)-1) +#define IS_MMAPPED(c) (0) +#endif __attribute__((__visibility__("hidden"))) void __bin_chunk(struct chunk *); diff --git a/src/mman/wasm32/madvise.c b/src/mman/wasm32/madvise.c new file mode 100644 index 00000000..8d8869d9 --- /dev/null +++ b/src/mman/wasm32/madvise.c @@ -0,0 +1,6 @@ +#include +#include "libc.h" + +int __madvise(void *addr, size_t len, int advice) { return 0; } + +weak_alias(__madvise, madvise);