changeset 54824:54395b0b6779

(__default_morecore): Use bss_sbrk(), not __sbrk(), before Cygwin unexec.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 12 Apr 2004 19:41:56 +0000
parents 3e88eecfd57d
children 59000534cc29
files src/gmalloc.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/gmalloc.c	Mon Apr 12 19:40:35 2004 +0000
+++ b/src/gmalloc.c	Mon Apr 12 19:41:56 2004 +0000
@@ -352,6 +352,10 @@
 #include <errno.h>
 
 /* How to really get more memory.  */
+#if defined(CYGWIN)
+extern __ptr_t bss_sbrk PP ((ptrdiff_t __size));
+extern int bss_sbrk_did_unexec;
+#endif
 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore;
 
 /* Debugging hook for `malloc'.  */
@@ -1572,7 +1576,14 @@
 __default_morecore (increment)
      __malloc_ptrdiff_t increment;
 {
-  __ptr_t result = (__ptr_t) __sbrk (increment);
+  __ptr_t result;
+#if defined(CYGWIN)
+  if (!bss_sbrk_did_unexec)
+    {
+      return bss_sbrk (increment);
+    }
+#endif
+  result = (__ptr_t) __sbrk (increment);
   if (result == (__ptr_t) -1)
     return NULL;
   return result;