From 41391cb2bba626aeb1e6ab7f65eb87eec6f93f1a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 27 Jun 2007 17:08:19 +0000 Subject: [PATCH] * shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info. (CURR_SHARED_MAGIC): Ditto. (class shared_info): Add heap_slop_inited member. * shared.cc (shared_info::heap_slop_size): Use heap_slop_inited to track initializing heap_slop since 0 is a valid value for heap_slop. Drop useless < 0 consideration. --- winsup/cygwin/ChangeLog | 9 +++++++++ winsup/cygwin/shared.cc | 9 +++------ winsup/cygwin/shared_info.h | 5 +++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 67b007087..c10960341 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2007-06-27 Corinna Vinschen + + * shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info. + (CURR_SHARED_MAGIC): Ditto. + (class shared_info): Add heap_slop_inited member. + * shared.cc (shared_info::heap_slop_size): Use heap_slop_inited to + track initializing heap_slop since 0 is a valid value for heap_slop. + Drop useless < 0 consideration. + 2007-06-27 Eric Blake * assert.cc (__assert_func): New function, to match newlib header diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 553caa2ba..fd9b87e5c 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -262,7 +262,7 @@ memory_init () unsigned shared_info::heap_slop_size () { - if (!heap_slop) + if (!heap_slop_inited) { /* Fetch from registry, first user then local machine. */ for (int i = 0; i < 2; i++) @@ -273,11 +273,8 @@ shared_info::heap_slop_size () break; heap_slop = wincap.heapslop (); } - - if (heap_slop < 0) - heap_slop = 0; - else - heap_slop <<= 20; + heap_slop <<= 20; + heap_slop_inited = true; } return heap_slop; diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index d9b37d72a..c99917306 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -143,9 +143,9 @@ public: cygwin_version.api_minor) #define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION) -#define SHARED_INFO_CB 19988 +#define SHARED_INFO_CB 19992 -#define CURR_SHARED_MAGIC 0x87c42d1eU +#define CURR_SHARED_MAGIC 0xb7048a88U /* NOTE: Do not make gratuitous changes to the names or organization of the below class. The layout is checksummed to determine compatibility between @@ -156,6 +156,7 @@ class shared_info DWORD cb; public: unsigned heap_chunk; + bool heap_slop_inited; unsigned heap_slop; DWORD sys_mount_table_counter;