diff options
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 (); |