[msvc] Update csproj files (#4254)
[mono.git] / mono / utils / dlmalloc.c
index 349df1fa726350b05947e28d2cdeb66071245393..3177f2d17a1194f5ebc59fbea7382990120a4db5 100644 (file)
@@ -24,6 +24,7 @@
 /* Use mmap for allocating memory */
 #define HAVE_MORECORE 0
 #define NO_MALLINFO 1
 /* Use mmap for allocating memory */
 #define HAVE_MORECORE 0
 #define NO_MALLINFO 1
+#include <mono/utils/dlmalloc.h>
 
 /*
 * Quickstart
 
 /*
 * Quickstart
@@ -341,7 +342,7 @@ HAVE_MMAP                 default: 1 (true)
   able to unmap memory that may have be allocated using multiple calls
   to MMAP, so long as they are adjacent.
 
   able to unmap memory that may have be allocated using multiple calls
   to MMAP, so long as they are adjacent.
 
-HAVE_MREMAP               default: 1 on linux, else 0
+HAVE_MREMAP               default: 1 on linux and NetBSD, else 0
   If true realloc() uses mremap() to re-allocate large blocks and
   extend or shrink allocation spaces.
 
   If true realloc() uses mremap() to re-allocate large blocks and
   extend or shrink allocation spaces.
 
@@ -535,11 +536,11 @@ DEFAULT_MMAP_THRESHOLD       default: 256K
 #define MMAP_CLEARS 1
 #endif  /* MMAP_CLEARS */
 #ifndef HAVE_MREMAP
 #define MMAP_CLEARS 1
 #endif  /* MMAP_CLEARS */
 #ifndef HAVE_MREMAP
-#ifdef linux
+#if defined(linux) || defined(__NetBSD__)
 #define HAVE_MREMAP 1
 #define HAVE_MREMAP 1
-#else   /* linux */
+#else   /* linux || __NetBSD__ */
 #define HAVE_MREMAP 0
 #define HAVE_MREMAP 0
-#endif  /* linux */
+#endif  /* linux || __NetBSD__ */
 #endif  /* HAVE_MREMAP */
 #ifndef MALLOC_FAILURE_ACTION
 #define MALLOC_FAILURE_ACTION  errno = ENOMEM;
 #endif  /* HAVE_MREMAP */
 #ifndef MALLOC_FAILURE_ACTION
 #define MALLOC_FAILURE_ACTION  errno = ENOMEM;
@@ -1163,7 +1164,7 @@ int mspace_mallopt(int, int);
 
 /*------------------------------ internal #includes ---------------------- */
 
 
 /*------------------------------ internal #includes ---------------------- */
 
-#ifdef WIN32
+#ifdef _MSC_VER
 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
 #endif /* WIN32 */
 
 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
 #endif /* WIN32 */
 
@@ -1374,7 +1375,13 @@ static int win32munmap(void* ptr, size_t size) {
 #endif /* HAVE_MMAP */
 
 #if HAVE_MMAP && HAVE_MREMAP
 #endif /* HAVE_MMAP */
 
 #if HAVE_MMAP && HAVE_MREMAP
+#if defined(linux)
 #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
 #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#elif defined(__NetBSD__)
+#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (addr), (nsz), (mv))
+#else
+#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif
 #else  /* HAVE_MMAP && HAVE_MREMAP */
 #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
 #endif /* HAVE_MMAP && HAVE_MREMAP */
 #else  /* HAVE_MMAP && HAVE_MREMAP */
 #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
 #endif /* HAVE_MMAP && HAVE_MREMAP */