2016-01-21 23:40:00 +01:00

35 lines
1.1 KiB
Plaintext

$NetBSD: patch-dl,v 1.5 2014/11/30 08:40:51 spz Exp $
SunOS needs unistd.h for sysconf().
--- mono/utils/dlmalloc.c.orig 2014-09-22 13:23:09.000000000 +0000
+++ mono/utils/dlmalloc.c
@@ -1208,11 +1208,14 @@ int mspace_mallopt(int, int);
#ifndef LACKS_UNISTD_H
#include <unistd.h> /* for sbrk */
#else /* LACKS_UNISTD_H */
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) || !defined(__DragonFly__)
extern void* sbrk(ptrdiff_t);
#endif /* FreeBSD etc */
#endif /* LACKS_UNISTD_H */
#endif /* HAVE_MMAP */
+#ifdef __sun
+#include <unistd.h> /* for sysconf */
+#endif
#ifndef WIN32
#ifndef malloc_getpagesize
@@ -1375,7 +1378,11 @@ static int win32munmap(void* ptr, size_t
#endif /* HAVE_MMAP */
#if HAVE_MMAP && HAVE_MREMAP
+#ifdef linux
#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#else
+#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (addr), (nsz), (mv))
+#endif
#else /* HAVE_MMAP && HAVE_MREMAP */
#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
#endif /* HAVE_MMAP && HAVE_MREMAP */