Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-08-07 05:20:59 +0400
committerChristopher Faylor <me@cgf.cx>2002-08-07 05:20:59 +0400
commit772f6c3e12a207c923d25fbc04757f01a31fda48 (patch)
treed4d28111c3be580ccc08770026367fbf06968aca /winsup
parente851d2fe43cebc6028959f9bcb0e457f88e115da (diff)
* cygheap.cc (_csbrk): Avoid !cygheap considerations.
(cygheap_init): Deal with unintialized cygheap issues here.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/cygheap.cc33
2 files changed, 18 insertions, 20 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4d6a7238b..93ead8c54 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,4 +1,9 @@
2002-08-06 Christopher Faylor <cgf@redhat.com>
+
+ * cygheap.cc (_csbrk): Avoid !cygheap considerations.
+ (cygheap_init): Deal with unintialized cygheap issues here.
+
+2002-08-06 Christopher Faylor <cgf@redhat.com>
Conrad Scott <conrad.scott@dsl.pipex.com
* cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 976618bf7..fb13fbed6 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -171,25 +171,13 @@ cygheap_fixup_in_child (bool execed)
static void *__stdcall
_csbrk (int sbs)
{
- void *prebrk;
-
- if (!cygheap)
- {
- init_cheap ();
- cygheap_max = cygheap;
- (void) _csbrk (sbs + sizeof (*cygheap) + (2 * system_info.dwPageSize));
- prebrk = (char *) (cygheap + 1);
- }
- else
- {
- prebrk = cygheap_max;
- void *prebrka = pagetrunc (prebrk);
- (char *) cygheap_max += sbs;
- if (!sbs || (prebrk != prebrka && prebrka == pagetrunc (cygheap_max)))
- /* nothing to do */;
- else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("couldn't commit memory for cygwin heap, %E");
- }
+ void *prebrk = cygheap_max;
+ void *prebrka = pagetrunc (prebrk);
+ (char *) cygheap_max += sbs;
+ if (!sbs || (prebrk != prebrka && prebrka == pagetrunc (cygheap_max)))
+ /* nothing to do */;
+ else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
+ api_fatal ("couldn't commit memory for cygwin heap, %E");
return prebrk;
}
@@ -198,7 +186,12 @@ extern "C" void __stdcall
cygheap_init ()
{
new_muto (cygheap_protect);
- _csbrk (0);
+ if (!cygheap)
+ {
+ init_cheap ();
+ cygheap_max = cygheap;
+ (void) _csbrk (sizeof (*cygheap));
+ }
if (!cygheap->fdtab)
cygheap->fdtab.init ();
}