* 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.
This commit is contained in:
parent
31d2bedc58
commit
b3480fbefb
|
@ -1,3 +1,9 @@
|
||||||
|
2011-10-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2011-10-23 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-10-23 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
|
* fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
|
||||||
|
|
|
@ -293,19 +293,19 @@ open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
|
||||||
|
|
||||||
if (*m == SH_CYGWIN_SHARED && offsets[0])
|
if (*m == SH_CYGWIN_SHARED && offsets[0])
|
||||||
{
|
{
|
||||||
ptrdiff_t delta = (caddr_t) shared - (caddr_t) off_addr (0);
|
/* Reserve subsequent shared memory areas in non-relocated case only.
|
||||||
offsets[0] = (caddr_t) shared - (caddr_t) cygwin_hmodule;
|
There's no good reason to reserve the console shmem, because it's
|
||||||
for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
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];
|
DWORD size = offsets[i - 1] - offsets[i];
|
||||||
offsets[i] += delta;
|
|
||||||
if (!VirtualAlloc (off_addr (i), size, MEM_RESERVE, PAGE_NOACCESS))
|
if (!VirtualAlloc (off_addr (i), size, MEM_RESERVE, PAGE_NOACCESS))
|
||||||
continue; /* oh well */
|
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;
|
return shared;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue