* cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
* fhandler_tape.cc (mt): Define as DLL shared area in .cygwin_dll_common instead of as dynamically allocated area. Change referencing throughout. * mtinfo.h (mt_h): Remove entirely. (mt): Remove extern declaration. * shared.cc (cygwin_shared_area): New global cygwin_shared variable located in .cygwin_dll_common. (offsets): Define shared region addresses descending from cygwin_shared_address. (open_shared): Replace usage of SH_CYGWIN_SHARED by SH_USER_SHARED. (memory_init): Set cygwin_shared just by pointing to cygwin_shared_area. * shared_info.h (shared_locations): Remove SH_CYGWIN_SHARED and SH_MTINFO. (cygwin_shared_address): Define as DLL start address. * tty.h (tty_min::tty_min): Remove constructor.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* shared.cc: shared data area support.
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Red Hat, Inc.
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@@ -29,6 +29,7 @@ details. */
|
||||
#include "child_info.h"
|
||||
#include "mtinfo.h"
|
||||
|
||||
static shared_info cygwin_shared_area __attribute__((section (".cygwin_dll_common"), shared));
|
||||
shared_info NO_COPY *cygwin_shared;
|
||||
user_info NO_COPY *user_shared;
|
||||
HANDLE NO_COPY cygwin_user_h;
|
||||
@@ -50,27 +51,16 @@ shared_name (char *ret_buf, const char *str, int num)
|
||||
|
||||
static char *offsets[] =
|
||||
{
|
||||
(char *) cygwin_shared_address,
|
||||
(char *) cygwin_shared_address
|
||||
+ pround (sizeof (shared_info)),
|
||||
- pround (sizeof (user_info))
|
||||
- pround (sizeof (console_state))
|
||||
- pround (sizeof (_pinfo)),
|
||||
(char *) cygwin_shared_address
|
||||
+ pround (sizeof (shared_info))
|
||||
+ pround (sizeof (user_info)),
|
||||
- pround (sizeof (console_state))
|
||||
- pround (sizeof (_pinfo)),
|
||||
(char *) cygwin_shared_address
|
||||
+ pround (sizeof (shared_info))
|
||||
+ pround (sizeof (user_info))
|
||||
+ pround (sizeof (console_state)),
|
||||
- pround (sizeof (_pinfo)),
|
||||
(char *) cygwin_shared_address
|
||||
+ pround (sizeof (shared_info))
|
||||
+ pround (sizeof (user_info))
|
||||
+ pround (sizeof (console_state))
|
||||
+ pround (sizeof (_pinfo)),
|
||||
(char *) cygwin_shared_address
|
||||
+ pround (sizeof (shared_info))
|
||||
+ pround (sizeof (user_info))
|
||||
+ pround (sizeof (console_state))
|
||||
+ pround (sizeof (_pinfo))
|
||||
+ pround (sizeof (mtinfo))
|
||||
};
|
||||
|
||||
void * __stdcall
|
||||
@@ -134,11 +124,11 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
||||
if (!shared)
|
||||
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", mapname, shared_h);
|
||||
|
||||
if (m == SH_CYGWIN_SHARED && offsets[0] && wincap.needs_memory_protection ())
|
||||
if (m == SH_USER_SHARED && offsets[0] && wincap.needs_memory_protection ())
|
||||
{
|
||||
unsigned delta = (char *) shared - offsets[0];
|
||||
offsets[0] = (char *) shared;
|
||||
for (int i = SH_CYGWIN_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
||||
for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
||||
{
|
||||
unsigned size = offsets[i + 1] - offsets[i];
|
||||
offsets[i] += delta;
|
||||
@@ -244,16 +234,8 @@ memory_init ()
|
||||
cygheap->user.init ();
|
||||
}
|
||||
|
||||
/* Initialize general shared memory */
|
||||
shared_locations sh_cygwin_shared = SH_CYGWIN_SHARED;
|
||||
cygwin_shared = (shared_info *) open_shared ("shared",
|
||||
CYGWIN_VERSION_SHARED_DATA,
|
||||
cygheap->shared_h,
|
||||
sizeof (*cygwin_shared),
|
||||
sh_cygwin_shared);
|
||||
|
||||
cygwin_shared = &cygwin_shared_area;
|
||||
cygwin_shared->initialize ();
|
||||
ProtectHandleINH (cygheap->shared_h);
|
||||
|
||||
user_shared_initialize (false);
|
||||
mtinfo_init ();
|
||||
|
Reference in New Issue
Block a user