diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-07-26 15:59:39 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-07-26 15:59:39 +0000 |
commit | 5faa48850f4e40c09fa9353b4e4cfbef43c7d9e0 (patch) | |
tree | 855583a1ee274969f7f04163cdc74d7294362ebd /winsup/cygwin/shared.cc | |
parent | 020a7b4711d9e5ea0922eb940080e2c01933a08a (diff) | |
download | cygnal-5faa48850f4e40c09fa9353b4e4cfbef43c7d9e0.tar.gz cygnal-5faa48850f4e40c09fa9353b4e4cfbef43c7d9e0.tar.bz2 cygnal-5faa48850f4e40c09fa9353b4e4cfbef43c7d9e0.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r-- | winsup/cygwin/shared.cc | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index c491708e3..c88706a12 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -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 (); |