Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-10-24 13:19:58 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-10-24 13:19:58 +0400
commitb3480fbefbcf44d95dbf47d3e25e1eb6e1bb725a (patch)
treeffaa4e5dffe93755a99b7cee53d85d6cfbd1c6b2 /winsup/cygwin/shared.cc
parent31d2bedc585420092eb53895c5f5646651f13215 (diff)
* shared.cc (open_shared): Fix memory reservation of essential shared
memory regions. Drop delta computations since delta is always 0 in non-relocated case. Add a comment.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r--winsup/cygwin/shared.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index b38beb971..b98c13651 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -293,19 +293,19 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
if (*m == SH_CYGWIN_SHARED && offsets[0])
{
- ptrdiff_t delta = (caddr_t) shared - (caddr_t) off_addr (0);
- offsets[0] = (caddr_t) shared - (caddr_t) cygwin_hmodule;
- for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
+ /* Reserve subsequent shared memory areas in non-relocated case only.
+ There's no good reason to reserve the console shmem, because it's
+ not yet known if we will allocate it at all. */
+ for (int i = SH_USER_SHARED; i < SH_SHARED_CONSOLE; i++)
{
- unsigned size = offsets[i] - offsets[i + 1];
- offsets[i] += delta;
+ DWORD size = offsets[i - 1] - offsets[i];
if (!VirtualAlloc (off_addr (i), size, MEM_RESERVE, PAGE_NOACCESS))
continue; /* oh well */
}
- offsets[SH_TOTAL_SIZE] += delta;
}
- debug_printf ("name %W, n %d, shared %p (wanted %p), h %p, *m %d", mapname, n, shared, addr, shared_h, *m);
+ debug_printf ("name %W, n %d, shared %p (wanted %p), h %p, *m %d",
+ mapname, n, shared, addr, shared_h, *m);
return shared;
}