Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-03-09 19:07:15 +0300
committerChristopher Faylor <me@cgf.cx>2010-03-09 19:07:15 +0300
commite8190d8fbf0071f1ad596ae2adb6826ddaf21d9c (patch)
tree967bb6f95eaaa198ee2695b97c01e21ddca5cced
parent23a6adc2c38454ff01231a82841e9c8a0c09ff45 (diff)
* shared.cc (inst_root_inited): Delete.
* (shared_info::initialize): Reorganize. Move call to init_installation_root here under spinlock control. Move unneeded non-shared_info initialization out of this function. (memory_init): Remove call to init_installation_root. Call heap_init and get_session_parent_dir here.
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/shared.cc40
2 files changed, 25 insertions, 24 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 205e4d57a..1d5f86747 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-09 Christopher Faylor <me.cygwin@cgf.cx>
+
+ * shared.cc (inst_root_inited): Delete.
+ * (shared_info::initialize): Reorganize. Move call to
+ init_installation_root here under spinlock control. Move unneeded
+ non-shared_info initialization out of this function.
+ (memory_init): Remove call to init_installation_root. Call heap_init
+ and get_session_parent_dir here.
+
2010-03-04 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (nt_path_has_executable_suffix): Change storage class of
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index 47fc50ec5..53c3c1894 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -37,7 +37,6 @@ HANDLE NO_COPY cygwin_user_h;
WCHAR installation_root[PATH_MAX] __attribute__((section (".cygwin_dll_common"), shared));
UNICODE_STRING installation_key __attribute__((section (".cygwin_dll_common"), shared));
WCHAR installation_key_buf[18] __attribute__((section (".cygwin_dll_common"), shared));
-static bool inst_root_inited;
/* Use absolute path of cygwin1.dll to derive the Win32 dir which
is our installation_root. Note that we can't handle Cygwin installation
@@ -116,7 +115,6 @@ init_installation_root ()
installation_key.Buffer[0] = L'\0';
}
- inst_root_inited = true;
}
/* This function returns a handle to the top-level directory in the global
@@ -382,7 +380,20 @@ void
shared_info::initialize ()
{
DWORD sversion = (DWORD) InterlockedExchange ((LONG *) &version, SHARED_VERSION_MAGIC);
- if (sversion)
+ if (!sversion)
+ {
+ /* Initialize installation root dir. This is put here just to piggyback on the
+ shared memory spinlock. The installation root does not live in shared_info
+ shared memory. */
+ init_installation_root ();
+ init_obcaseinsensitive ();/* Initialize obcaseinsensitive. */
+ tty.init (); /* Initialize tty table. */
+ mt.initialize (); /* Initialize shared tape information. */
+ debug_printf ("Installation root: <%W> key: <%S>",
+ installation_root, &installation_key);
+ cb = sizeof (*this); /* Do last, after all shared memory initialization */
+ }
+ else
{
if (sversion != SHARED_VERSION_MAGIC)
{
@@ -393,17 +404,6 @@ shared_info::initialize ()
low_priority_sleep (0); // Should be hit only very very rarely
}
- heap_init ();
- get_session_parent_dir (); /* Create session dir if first process. */
-
- if (!sversion)
- {
- init_obcaseinsensitive ();/* Initialize obcaseinsensitive. */
- tty.init (); /* Initialize tty table. */
- mt.initialize (); /* Initialize shared tape information. */
- cb = sizeof (*this); /* Do last, after all shared memory initialization */
- }
-
if (cb != SHARED_INFO_CB)
system_printf ("size of shared memory region changed from %u to %u",
SHARED_INFO_CB, cb);
@@ -421,10 +421,6 @@ memory_init (bool init_cygheap)
cygheap->user.init ();
}
- /* Initialize installation root dir. */
- if (!installation_root[0])
- init_installation_root ();
-
/* Initialize general shared memory */
shared_locations sh_cygwin_shared;
cygwin_shared = (shared_info *) open_shared (L"shared",
@@ -432,13 +428,9 @@ memory_init (bool init_cygheap)
cygwin_shared_h,
sizeof (*cygwin_shared),
sh_cygwin_shared = SH_CYGWIN_SHARED);
- /* Defer debug output printing the installation root and installation key
- up to this point. Debug output except for system_printf requires
- the global shared memory to exist. */
- if (inst_root_inited)
- debug_printf ("Installation root: <%W> key: <%S>",
- installation_root, &installation_key);
cygwin_shared->initialize ();
+ heap_init ();
+ get_session_parent_dir (); /* Create session dir if first process. */
user_shared_create (false);
}