* cygheap.cc (_csbrk): Avoid !cygheap considerations.
(cygheap_init): Deal with unintialized cygheap issues here.
This commit is contained in:
parent
e851d2fe43
commit
772f6c3e12
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2002-08-06 Christopher Faylor <cgf@redhat.com>
|
||||||
Conrad Scott <conrad.scott@dsl.pipex.com
|
Conrad Scott <conrad.scott@dsl.pipex.com
|
||||||
|
|
||||||
|
|
|
@ -171,25 +171,13 @@ cygheap_fixup_in_child (bool execed)
|
||||||
static void *__stdcall
|
static void *__stdcall
|
||||||
_csbrk (int sbs)
|
_csbrk (int sbs)
|
||||||
{
|
{
|
||||||
void *prebrk;
|
void *prebrk = cygheap_max;
|
||||||
|
void *prebrka = pagetrunc (prebrk);
|
||||||
if (!cygheap)
|
(char *) cygheap_max += sbs;
|
||||||
{
|
if (!sbs || (prebrk != prebrka && prebrka == pagetrunc (cygheap_max)))
|
||||||
init_cheap ();
|
/* nothing to do */;
|
||||||
cygheap_max = cygheap;
|
else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
|
||||||
(void) _csbrk (sbs + sizeof (*cygheap) + (2 * system_info.dwPageSize));
|
api_fatal ("couldn't commit memory for cygwin heap, %E");
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
return prebrk;
|
return prebrk;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +186,12 @@ extern "C" void __stdcall
|
||||||
cygheap_init ()
|
cygheap_init ()
|
||||||
{
|
{
|
||||||
new_muto (cygheap_protect);
|
new_muto (cygheap_protect);
|
||||||
_csbrk (0);
|
if (!cygheap)
|
||||||
|
{
|
||||||
|
init_cheap ();
|
||||||
|
cygheap_max = cygheap;
|
||||||
|
(void) _csbrk (sizeof (*cygheap));
|
||||||
|
}
|
||||||
if (!cygheap->fdtab)
|
if (!cygheap->fdtab)
|
||||||
cygheap->fdtab.init ();
|
cygheap->fdtab.init ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue