* cygheap.cc (init_cheap): Set initial_sz to something or suffer spurious

output.
(cygheap_fixup_in_child): Set alloc_sz to passed in size to ensure that
children will have the right size heap.
(_csbrk): Make output conditional on DEBUGGING.
This commit is contained in:
Christopher Faylor 2004-03-21 22:24:06 +00:00
parent e362f67fef
commit c7c7492aab
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2004-03-21 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (init_cheap): Set initial_sz to something or suffer
spurious output.
(cygheap_fixup_in_child): Set alloc_sz to passed in size to ensure that
children will have the right size heap.
(_csbrk): Make output conditional on DEBUGGING.
2004-03-21 Christopher Faylor <cgf@redhat.com> 2004-03-21 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (init_cheap): Conditionalize debugging code. * cygheap.cc (init_cheap): Conditionalize debugging code.

View File

@ -57,7 +57,7 @@ init_cheap ()
char buf[80]; char buf[80];
DWORD initial_sz = 0; DWORD initial_sz = 0;
if (!GetEnvironmentVariable ("CYGWIN_HEAPSIZE", buf, sizeof buf - 1)) if (!GetEnvironmentVariable ("CYGWIN_HEAPSIZE", buf, sizeof buf - 1))
alloc_sz = CYGHEAPSIZE; initial_sz = alloc_sz = CYGHEAPSIZE;
else else
{ {
initial_sz = alloc_sz = atoi (buf); initial_sz = alloc_sz = atoi (buf);
@ -148,14 +148,14 @@ cygheap_fixup_in_child (bool execed)
void *newaddr; void *newaddr;
newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, addr); newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, addr);
alloc_sz = child_proc_info->cygheap_alloc_sz;
if (newaddr != cygheap) if (newaddr != cygheap)
{ {
if (!newaddr) if (!newaddr)
newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL); newaddr = MapViewOfFileEx (child_proc_info->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL);
DWORD n = (DWORD) cygheap_max - (DWORD) cygheap; DWORD n = (DWORD) cygheap_max - (DWORD) cygheap;
/* Reserve cygwin heap in same spot as parent */ /* Reserve cygwin heap in same spot as parent */
if (!VirtualAlloc (cygheap, child_proc_info->cygheap_alloc_sz, if (!VirtualAlloc (cygheap, alloc_sz, MEM_RESERVE, PAGE_NOACCESS))
MEM_RESERVE, PAGE_NOACCESS))
{ {
MEMORY_BASIC_INFORMATION m; MEMORY_BASIC_INFORMATION m;
memset (&m, 0, sizeof m); memset (&m, 0, sizeof m);
@ -231,7 +231,7 @@ _csbrk (int sbs)
/* nothing to do */; /* nothing to do */;
else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE)) else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
{ {
#if 1 #ifdef DEBUGGING
system_printf ("couldn't commit memory for cygwin heap, prebrk %p, size %d, heapsize now %d, max heap size %u, %E", system_printf ("couldn't commit memory for cygwin heap, prebrk %p, size %d, heapsize now %d, max heap size %u, %E",
prebrk, sbs, (char *) cygheap_max - (char *) cygheap, prebrk, sbs, (char *) cygheap_max - (char *) cygheap,
alloc_sz); alloc_sz);