diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9a84d09c0..156210b69 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-10-18 Christopher Faylor + + * fork.cc (fork_child): Move mmap initialization. + * shared.cc (shared_info::heap_chunk_size): Store info as megabytes. + Search HKEY_LOCAL_MACHINE as well as HKEY_CURRENT_USER. + * shared_info.h (shared_info::initial_heap_size): Change element name + to reflect new functionality. + * strace.cc (strace::hello): Report on initial heap size. + 2002-10-18 Thomas Pfaff * thread.cc (verifyable_object_isvalid): Test for a valid object diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index c3045c4b9..0d57bc41e 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -280,14 +280,14 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) cygheap->fdtab.fixup_after_fork (hParent); ProtectHandleINH (hParent); + if (fixup_mmaps_after_fork (hParent)) + api_fatal ("recreate_mmaps_after_fork_failed"); + pinfo_fixup_after_fork (); signal_fixup_after_fork (); MALLOC_CHECK; - if (fixup_mmaps_after_fork (hParent)) - api_fatal ("recreate_mmaps_after_fork_failed"); - /* If we haven't dynamically loaded any dlls, just signal the parent. Otherwise, load all the dlls, tell the parent that we're done, and wait for the parent to fill in the. diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 59ca3494b..45d51c362 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -223,7 +223,8 @@ memory_init () unsigned shared_info::heap_chunk_size () { - if (!heap_chunk_in_mb) + unsigned val; + if (!initial_heap_size) { /* Fetch misc. registry entries. */ @@ -234,13 +235,20 @@ shared_info::heap_chunk_size () /* FIXME: We should not be restricted to a fixed size heap no matter what the fixed size is. */ - heap_chunk_in_mb = reg.get_int ("heap_chunk_in_mb", 256); - if (heap_chunk_in_mb < 4) - { - heap_chunk_in_mb = 4; - reg.set_int ("heap_chunk_in_mb", heap_chunk_in_mb); - } + initial_heap_size = reg.get_int ("heap_chunk_in_mb", 0); + if (!initial_heap_size) { + reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", + CYGWIN_INFO_CYGNUS_REGISTRY_NAME, + CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL); + initial_heap_size = reg.get_int ("heap_chunk_in_mb", 384); + } + + if (initial_heap_size < 4) + initial_heap_size = 4 * 1024 * 1024; + else + initial_heap_size <<= 20; + debug_printf ("fixed heap size is %u", initial_heap_size); } - return heap_chunk_in_mb << 20; + return initial_heap_size; } diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index a39275e49..c93fd6762 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -138,7 +138,7 @@ public: #define SHARED_INFO_CB 47112 -#define CURR_SHARED_MAGIC 0x29eb8ccdU +#define CURR_SHARED_MAGIC 0xd9e0bc22U /* NOTE: Do not make gratuitous changes to the names or organization of the below class. The layout is checksummed to determine compatibility between @@ -148,7 +148,7 @@ class shared_info DWORD version; DWORD cb; public: - int heap_chunk_in_mb; + unsigned initial_heap_size; DWORD sys_mount_table_counter; tty_list tty; diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 506d44ec9..cb367afeb 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -19,6 +19,7 @@ details. */ #include "cygwin_version.h" #include "hires.h" #include "cygthread.h" +#include "shared_info.h" #define PROTECT(x) x[sizeof (x)-1] = 0 #define CHECK(x) if (x[sizeof (x)-1] != 0) { small_printf ("array bound exceeded %d\n", __LINE__); ExitProcess (1); } @@ -57,6 +58,7 @@ strace::hello () cygwin_version.api_major, cygwin_version.api_minor); prntf (1, NULL, "DLL build: %s", cygwin_version.dll_build_date); prntf (1, NULL, "OS version: Windows %s", wincap.osname ()); + prntf (1, NULL, "Heap size: %u", cygwin_shared->heap_chunk_size ()); prntf (1, NULL, "**********************************************"); } }