summaryrefslogtreecommitdiff
path: root/src/gmalloc.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2004-04-12 19:41:56 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2004-04-12 19:41:56 +0000
commit2b8881470812c765fa15650855464775a02f38aa (patch)
tree96f6a9d0fc13cf3bba3984294d809d808d29e59c /src/gmalloc.c
parent5efe07e0b373fa19cc7412f144b5651bd111b9c5 (diff)
downloademacs-2b8881470812c765fa15650855464775a02f38aa.tar.gz
(__default_morecore): Use bss_sbrk(), not __sbrk(), before Cygwin unexec.
Diffstat (limited to 'src/gmalloc.c')
-rw-r--r--src/gmalloc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 99fa36d073a..eae83a74eb6 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -352,6 +352,10 @@ Cambridge, MA 02139, USA.
#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 @@ __ptr_t
__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;