diff options
author | Christopher Faylor <me@cgf.cx> | 2001-01-28 05:51:15 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-01-28 05:51:15 +0000 |
commit | 2a6fc028badee6ab9a4df2b1b395dbb701d965fb (patch) | |
tree | 22d3b565c2f57907367012419b1c63765043d05d /winsup/cygwin/shared.cc | |
parent | 022ce214de829810a9ddd1a747be03ac95185bb1 (diff) | |
download | cygnal-2a6fc028badee6ab9a4df2b1b395dbb701d965fb.tar.gz cygnal-2a6fc028badee6ab9a4df2b1b395dbb701d965fb.tar.bz2 cygnal-2a6fc028badee6ab9a4df2b1b395dbb701d965fb.zip |
Throughout, change 'cygwin_shared.mount' to 'mount_table'.
* child_info.h (child_info): Move shared_h, console_h to cygheap. Add mount_h.
* cygheap.h (init_cygheap): Add shared_h, console_h.
* cygheap.cc (init_cheap): Initialize heap at a fixed location after the shared
memory regions. Initialize cygheap->user name here.
* dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants. Remove
cygheap_init since it is done in shared_init now.
(_dll_crt0): Initialize mount_h, remove shared_h and console_h initialization.
* fhandler_console.cc (console_shared_h): Eliminate.
(get_tty_stuff): Use cygheap->console_h rather than console_shared_h.
* heap.cc (heap_init): Use page size constant calculated earlier in
initialization.
* shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h.
(mount_table_init): New function for initializing a user mount table.
(open_shared_file_map): Use constant for shared memory region. Initialize
cygheap and mount table here.
(open_shared): Improve debugging output.
(shared_info::initialize): Eliminate call to mount.init.
(shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h.
(open_shared_file_map): Eliminate.
* shared_info.h (mount_info): Add a version field.
(shared_align_past): New macro for calculating location for shared memory
regions.
* sigproc.cc (init_child_info): Eliminate shared_h, console_h.
* spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different user.
* syscalls.cc (system_info): New global holding system memory defaults.
(getpagesize): Use system_info.
* uinfo.cc (internal_getlogin): Only fill in user name if nonexistent.
* winsup.h: Declare system_info.
* passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than retrieving
the name again.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r-- | winsup/cygwin/shared.cc | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index fb023e725..71255da8c 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -27,9 +27,8 @@ details. */ cygwin_version.api_minor) shared_info NO_COPY *cygwin_shared = NULL; - -/* The handle of the shared data area. */ -HANDLE cygwin_shared_h = NULL; +mount_info NO_COPY *mount_table = NULL; +HANDLE cygwin_mount_h = NULL; /* General purpose security attribute objects for global use. */ SECURITY_ATTRIBUTES NO_COPY sec_none; @@ -49,15 +48,24 @@ shared_name (const char *str, int num) return buf; } -/* Open the shared memory map. */ -static void __stdcall -open_shared_file_map () +static void +mount_table_init () { - cygwin_shared = (shared_info *) open_shared ("shared", - cygwin_shared_h, - sizeof (*cygwin_shared), - (void *)0xa000000); - ProtectHandle (cygwin_shared); + void *addr = mount_table_address; + debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (), + mount_table_address); + mount_table = (mount_info *) open_shared (cygheap->user.name (), + cygwin_mount_h, sizeof (mount_info), + addr); + ProtectHandle (cygwin_mount_h); + + debug_printf ("mount table version %x at %p", mount_table->version, mount_table); + if (!mount_table->version) + { + mount_table->version = MOUNT_VERSION; + debug_printf ("initializing mount table"); + mount_table->init (); /* Initialize the mount table. */ + } } void * __stdcall @@ -99,9 +107,9 @@ open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr) } if (!shared) - api_fatal ("MapViewOfFileEx, %E. Terminating."); + api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h); - debug_printf ("name %s, shared %p, h %p", name, shared, shared_h); + debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h); /* FIXME: I couldn't find anywhere in the documentation a note about whether the memory is initialized to zero. The code assumes it does @@ -124,9 +132,6 @@ shared_info::initialize () return; } - /* Initialize the mount table. */ - mount.init (); - /* Initialize the queue of deleted files. */ delqueue.init (); @@ -155,16 +160,28 @@ shared_info::initialize () void __stdcall shared_init () { - open_shared_file_map (); - + HANDLE shared_h = cygheap ? cygheap->shared_h : NULL; + cygwin_shared = (shared_info *) open_shared ("shared", + shared_h, + sizeof (*cygwin_shared), + cygwin_shared_address); + if (!cygheap) + cygheap_init (); + + mount_table_init (); + + cygheap->shared_h = shared_h; + ProtectHandle (cygheap->shared_h); cygwin_shared->initialize (); } void __stdcall shared_terminate () { - if (cygwin_shared_h) - ForceCloseHandle (cygwin_shared_h); + if (cygheap->shared_h) + ForceCloseHandle (cygheap->shared_h); + if (cygwin_mount_h) + ForceCloseHandle (cygwin_mount_h); } unsigned @@ -292,4 +309,3 @@ sec_user_nih (PVOID sa_buf, PSID sid2) { return sec_user (sa_buf, sid2, FALSE); } - |