* cygheap.h (mini_cygheap): New struct.

(init_cygheap): Inherit locale field via mini_cygheap.
* cygheap.cc (cygheap_at_start): Define new variable.
(cygheap): Initialize as cygheap_at_start so that locale information is always
available.
(cygheap_init): Initialize cygheap iff it is set to cygheap_at_start.
* shared_info.h (memory_init): Accommodate argument change.
* memory.cc (memory_init): Accept an argument indicating whether cygheap should
be initialized or not.
* dcrt0.cc (child_info_fork::handle_fork): Pass false to memory_init().
(child_info_spawn::handle_spawn): Ditto.
(dll_crt0_0): Pass true to memory_init when not forking or execing.
* cygheap.h (cygheap_types::HEAP_2_DLL): New enum.
* dll_init.h (dll): Remove unused namelen field.
(dll_list::load_after_fork): Accommodate change in arguments.
* dll_init.cc (dll_list::alloc): Allocate dll information in the cygwin heap.
(dll_list::detach): Free dll information from the cygwin heap.
(dll_list::load_after_fork): Use dll information in the cygwin heap directly
rather than querying parent.
* fork.cc (frok::first_dll): Delete.
(frok::child): Don't report on first_dll.  Don't pass it to load_on_fork.
(frok::parent): Don't set first_dll.
(fork): Ditto.
This commit is contained in:
Christopher Faylor
2009-06-08 03:53:40 +00:00
parent 1866410bb8
commit 71f53a2f62
9 changed files with 104 additions and 185 deletions

View File

@@ -24,7 +24,12 @@
#include <unistd.h>
#include <wchar.h>
init_cygheap NO_COPY *cygheap;
static mini_cygheap NO_COPY cygheap_at_start =
{
{__utf8_mbtowc, __utf8_wctomb}
};
init_cygheap NO_COPY *cygheap = (init_cygheap *) &cygheap_at_start;
void NO_COPY *cygheap_max;
extern "C" char _cygheap_mid[] __attribute__((section(".cygheap")));
@@ -33,11 +38,11 @@ extern "C" char _cygheap_end[];
static NO_COPY muto cygheap_protect;
struct cygheap_entry
{
int type;
struct cygheap_entry *next;
char data[0];
};
{
int type;
struct cygheap_entry *next;
char data[0];
};
#define NBUCKETS (sizeof (cygheap->buckets) / sizeof (cygheap->buckets[0]))
#define N0 ((_cmalloc_entry *) NULL)
@@ -150,7 +155,7 @@ extern "C" void __stdcall
cygheap_init ()
{
cygheap_protect.init ("cygheap_protect");
if (!cygheap)
if (cygheap == &cygheap_at_start)
{
cygheap = (init_cygheap *) memset (_cygheap_start, 0,
_cygheap_mid - _cygheap_start);