This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Avoid collisions between parallel installations of Cygwin


Hi,

this is sort of a follow-up to a mail from Earnie:
http://cygwin.com/ml/cygwin-developers/2009-05/msg00042.html

Actually, Red Hat has a customer who contracted us to make exactly that
change.  The request is to allow multiple Cygwin installations on the
same machine, so that process trees started from different installations
don't interfere with each other.

The idea of this change is obvious.  Third-party products using Cygwin
can run in their own, encapsulated installation directory without having
anything to do with a Cygwin net distro installation.  Different Cygwin
installations on the same machine are encapsulated and don't see the
processes from other Cygwin installations.  The potential advantage for
us is, that this will drop the number of 3PP influenced puzzled cygwin
user emails on the Cygwin list.

The basic problem which has to be solved to get this working is to avoid
collisions of the names of globally shared objects within the multiple
Cygwin process trees.  Affected objects are shared memory regions, tty
names, pipe names, and the names of any other IPC object.  Last but not
least, a Cygserver started from one installation should not collide with
a Cygserver started from another installation.

So, along the lines of what Earnie already did in MSYS, the below patch
will introduce an installation hash value.

At startup, the first process in a Cygwin 1.7 process tree already
fetches its own path and evaluates the installation root directory.  The
additional step, which is the core of the below patch, is to generate an
installation hash value (the "installation key"), which in turn can be
used when creating any shared object.  This is already a lot simpler in
1.7 as it had been in 1.5 and earlier, since all functions to create IPC
objects have been rewritten (in kernel32.cc) to create these objects in
a Cygwin 1.7-specific subdirectory in the native NT object namespace.
So, in the first place, the extension to the existing mechanism is to
change the name of this subdirectory, so that it's based on the
installation key value additionally.

This simple change already covers all IPC objects, except for pipes.  So
a second part of the patch is to add the installation key to the names
of all pipes generated in Cygwin.  This also includes ttys.  Therefore,
with this change can have different Cygwin installations, even a
1.5-based installation, using the same pseudo ttys.  A mintty in one
installation using /dev/tty0 will not collide with another mintty from
another installation using /dev/tty0.  So this also fixes the problem
reported in http://cygwin.com/ml/cygwin/2009-09/msg00892.html

And then there's Cygserver.  The only named IPC object used by Cygserver
is the pipe used to communicate with the Cygwin DLL of client processes.
Using the installation key for the pipe's name would be most helpful.
To allow this, there's a new cygwin_internal call which returns the
installation key.  This is used by Cygserver to generate the
installation dependent pipe name.

Last, but not least, there's always a chance that somebody tries to exec
a Cygwin process from the /bin directory of another Cygwin installation.
This will result in loading "the other" Cygwin DLL for the child
process.  Tricky, given that this requires process interaction, while
the whole idea of the change is to avoid interaction.  So this case is
still not supported and the result is not determined.  It might work,
but you can also easily see the friendly "multiple Cygwin" error message
instead.  The rule is, keep separate Cygwin installations separate.

Per the contract, the patch has been fully tested in a test environment,
including test protocol, so I'm pretty confident that it works as
advertised.

Patch below.

Here are the questions.

- Does anything speak against the idea of the patch?

- Does anybody see a problem with the patch?

- Anything else?


Thanks,
Corinna


cygserver ChangeLog:

	* transport_pipes.h (PIPE_NAME_PREFIX): New define.
	(PIPE_NAME_SUFFIX): Ditto.
	(class transport_layer_pipes): Convert _pipe_name from char pointer
	to wchar_t array.
	* transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
	Accommodate the fact that _pipe_name is a wchar_t array, rather than
	a char pointer.
	(transport_layer_pipes::transport_layer_pipes): Initialize _pipe_name
	with variable pipe name based in installation key fetched from Cygwin
	DLL.
	(transport_layer_pipes::accept): Call CreateNamedPipeW explicitely.
	(transport_layer_pipes::connect): Call CreateFileW and WaitNamedPipeW
	explicitely.

cygwin ChangeLog:

	* dtable.cc (handle_to_fn): Add check for correct installation_key
	string in object name for pipes and ttys.
	* external.cc (cygwin_internal): Add CW_GET_INSTKEY to allow fetching
	the installation_key from cygserver.
	* fhandler_fifo.cc (fhandler_fifo::fifo_name): Add installation_key
	to fifo name.
	* mount.cc (mount_info::init): Accommodate the fact that
	installation_root is now a global variable in DLL common shared memory,
	rather than a member of cygwin_shared.
	* pipe.cc (fhandler_pipe::create_selectable): Add installation_key to
	pipe name.
	* shared.cc (installation_root): Define here for storage in DLL
	common shared memory.
	(installation_key): Ditto.
	(installation_key_buf): Ditto.
	(init_installation_root): Convert from shared_info method to ordinary
	function.  Add initializing installation_key.  Add comment to explain.
	(get_shared_parent_dir): Add installation_key to directory name.
	(get_session_parent_dir): Ditto.
	(shared_info::initialize): Move call to init_installation_root from
	here...
	(memory_init): ...to here.  Add debug output to print installation root
	and installation key.  Add comment to explain why.
	* shared_info.h (SHARED_INFO_CB): Recalculate.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Remove definition of installation_root and
	declaration of init_installation_root.
	(init_installation_root): Declare.
	(installation_root): Declare.
	(installation_key): Declare.
	* uinfo.cc (pwdgrp::load): Accommodate the fact that installation_root
	is now a global variable in DLL common shared memory.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_INSTKEY.


Index: cygserver/transport_pipes.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygserver/transport_pipes.cc,v
retrieving revision 1.10
diff -u -p -r1.10 transport_pipes.cc
--- cygserver/transport_pipes.cc	15 Sep 2004 10:17:53 -0000	1.10
+++ cygserver/transport_pipes.cc	12 Oct 2009 16:02:17 -0000
@@ -1,6 +1,6 @@
 /* transport_pipes.cc
 
-   Copyright 2001, 2002, 2003, 2004 Red Hat Inc.
+   Copyright 2001, 2002, 2003, 2004, 2009 Red Hat Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
@@ -23,6 +23,8 @@ details. */
 #include <netdb.h>
 #include <pthread.h>
 #include <unistd.h>
+#include <wchar.h>
+#include <sys/cygwin.h>
 
 #include "cygerrno.h"
 #include "transport.h"
@@ -65,24 +67,33 @@ initialise_pipe_instance_lock ()
 #ifndef __INSIDE_CYGWIN__
 
 transport_layer_pipes::transport_layer_pipes (const HANDLE hPipe)
-  : _pipe_name (""),
-    _hPipe (hPipe),
+  : _hPipe (hPipe),
     _is_accepted_endpoint (true),
     _is_listening_endpoint (false)
 {
   assert (_hPipe);
   assert (_hPipe != INVALID_HANDLE_VALUE);
-
+  _pipe_name[0] = L'\0';
 }
 
 #endif /* !__INSIDE_CYGWIN__ */
 
 transport_layer_pipes::transport_layer_pipes ()
-  : _pipe_name ("\\\\.\\pipe\\cygwin_lpc"),
-    _hPipe (NULL),
+  : _hPipe (NULL),
     _is_accepted_endpoint (false),
     _is_listening_endpoint (false)
 {
+#ifdef __INSIDE_CYGWIN__
+  extern WCHAR installation_key_buf[18];
+  wcpcpy (wcpcpy (wcpcpy (_pipe_name, PIPE_NAME_PREFIX), installation_key_buf),
+	  PIPE_NAME_SUFFIX);
+#else
+  wchar_t cyg_instkey[18];
+
+  wchar_t *p = wcpcpy (_pipe_name, PIPE_NAME_PREFIX);
+  if (cygwin_internal (CW_GET_INSTKEY, cyg_instkey))
+    wcpcpy (wcpcpy (p, cyg_instkey), PIPE_NAME_SUFFIX);
+#endif
 }
 
 transport_layer_pipes::~transport_layer_pipes ()
@@ -124,7 +135,7 @@ transport_layer_pipes::accept (bool *con
   const bool first_instance = (pipe_instance == 0);
 
   const HANDLE accept_pipe =
-    CreateNamedPipe (_pipe_name,
+    CreateNamedPipeW (_pipe_name,
 		     (PIPE_ACCESS_DUPLEX
 		      | (first_instance ? FILE_FLAG_FIRST_PIPE_INSTANCE : 0)),
 		     (PIPE_TYPE_BYTE | PIPE_WAIT),
@@ -270,13 +281,13 @@ transport_layer_pipes::connect ()
 
   while (rc)
     {
-      _hPipe = CreateFile (_pipe_name,
-			   GENERIC_READ | GENERIC_WRITE,
-			   FILE_SHARE_READ | FILE_SHARE_WRITE,
-			   &sec_all_nih,
-			   OPEN_EXISTING,
-			   SECURITY_IMPERSONATION,
-			   NULL);
+      _hPipe = CreateFileW (_pipe_name,
+			    GENERIC_READ | GENERIC_WRITE,
+			    FILE_SHARE_READ | FILE_SHARE_WRITE,
+			    &sec_all_nih,
+			    OPEN_EXISTING,
+			    SECURITY_IMPERSONATION,
+			    NULL);
 
       if (_hPipe != INVALID_HANDLE_VALUE)
 	{
@@ -302,7 +313,7 @@ transport_layer_pipes::connect ()
        * with ERROR_FILE_NOT_FOUND.
        */
       while (retries != MAX_WAIT_NAMED_PIPE_RETRY
-	     && !(rc = WaitNamedPipe (_pipe_name, WAIT_NAMED_PIPE_TIMEOUT)))
+	     && !(rc = WaitNamedPipeW (_pipe_name, WAIT_NAMED_PIPE_TIMEOUT)))
 	{
 	  if (GetLastError () == ERROR_FILE_NOT_FOUND)
 	    Sleep (0);		// Give the server a chance.
Index: cygserver/transport_pipes.h
===================================================================
RCS file: /cvs/src/src/winsup/cygserver/transport_pipes.h,v
retrieving revision 1.1
diff -u -p -r1.1 transport_pipes.h
--- cygserver/transport_pipes.h	19 Nov 2003 18:49:41 -0000	1.1
+++ cygserver/transport_pipes.h	12 Oct 2009 16:02:17 -0000
@@ -13,6 +13,9 @@ details. */
 #ifndef _TRANSPORT_PIPES_H
 #define _TRANSPORT_PIPES_H
 
+#define PIPE_NAME_PREFIX	L"\\\\.\\pipe\\cygwin-"
+#define PIPE_NAME_SUFFIX	L"-lpc"
+
 /* Named pipes based transport, for security on NT */
 class transport_layer_pipes : public transport_layer_base
 {
@@ -36,7 +39,7 @@ public:
   virtual ~transport_layer_pipes ();
 
 private:
-  const char *const _pipe_name;
+  wchar_t _pipe_name[40];
   HANDLE _hPipe;
   const bool _is_accepted_endpoint;
   bool _is_listening_endpoint;
Index: cygwin/dtable.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/dtable.cc,v
retrieving revision 1.206
diff -u -p -r1.206 dtable.cc
--- cygwin/dtable.cc	22 Sep 2009 04:09:02 -0000	1.206
+++ cygwin/dtable.cc	12 Oct 2009 16:02:18 -0000
@@ -929,6 +929,14 @@ handle_to_fn (HANDLE h, char *posix_fn)
 	  if (wcsncmp (w32, L"cygwin-", WCLEN (L"cygwin-")) != 0)
 	    return false;
 	  w32 += WCLEN (L"cygwin-");
+	  /* Check for installation key and trailing dash. */
+	  if (wcsncmp (w32, installation_key.Buffer,
+	      installation_key.Length / sizeof (WCHAR)) != 0)
+	    return false;
+	  w32 += installation_key.Length / sizeof (WCHAR);
+	  if (*w32 != L'-')
+	    return false;
+	  ++w32;
 	  bool istty = wcsncmp (w32, L"tty", WCLEN (L"tty")) == 0;
 	  if (istty)
 	    decode_tty (posix_fn, w32 + WCLEN (L"tty"));
Index: cygwin/external.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/external.cc,v
retrieving revision 1.108
diff -u -p -r1.108 external.cc
--- cygwin/external.cc	6 Oct 2009 21:51:16 -0000	1.108
+++ cygwin/external.cc	12 Oct 2009 16:02:18 -0000
@@ -413,6 +413,12 @@ cygwin_internal (cygwin_getinfo_types t,
 	  int useTerminateProcess = va_arg (arg, int);
 	  exit_process (status, !!useTerminateProcess); /* no return */
 	}
+      case CW_GET_INSTKEY:
+	{
+	  extern WCHAR installation_key_buf[18];
+	  PWCHAR dest = va_arg (arg, PWCHAR);
+	  wcscpy (dest, installation_key_buf);
+	}
 
       default:
 	break;
Index: cygwin/fhandler_fifo.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_fifo.cc,v
retrieving revision 1.35
diff -u -p -r1.35 fhandler_fifo.cc
--- cygwin/fhandler_fifo.cc	24 Jul 2009 20:54:33 -0000	1.35
+++ cygwin/fhandler_fifo.cc	12 Oct 2009 16:02:18 -0000
@@ -19,6 +19,7 @@
 #include "cygheap.h"
 #include "sigproc.h"
 #include "cygtls.h"
+#include "shared_info.h"
 
 fhandler_fifo::fhandler_fifo ():
   wait_state (fifo_unknown), dummy_client (NULL)
@@ -58,8 +59,8 @@ char *
 fhandler_fifo::fifo_name (char *buf)
 {
   /* Generate a semi-unique name to associate with this fifo. */
-  __small_sprintf (buf, "\\\\.\\pipe\\__cygfifo__%08x_%016X",
-		   get_dev (), get_ino ());
+  __small_sprintf (buf, "\\\\.\\pipe\\__cygfifo__%S_%08x_%016X",
+		   &installation_key, get_dev (), get_ino ());
   return buf;
 }
 
Index: cygwin/mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/mount.cc,v
retrieving revision 1.50
diff -u -p -r1.50 mount.cc
--- cygwin/mount.cc	25 Aug 2009 11:27:03 -0000	1.50
+++ cygwin/mount.cc	12 Oct 2009 16:02:18 -0000
@@ -350,7 +350,7 @@ mount_info::init ()
   PWCHAR pathend;
   WCHAR path[PATH_MAX];
 
-  pathend = wcpcpy (path, cygwin_shared->installation_root);
+  pathend = wcpcpy (path, installation_root);
   create_root_entry (path);
   pathend = wcpcpy (pathend, L"\\etc\\fstab");
 
Index: cygwin/pipe.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/pipe.cc,v
retrieving revision 1.117
diff -u -p -r1.117 pipe.cc
--- cygwin/pipe.cc	17 Aug 2009 12:45:51 -0000	1.117
+++ cygwin/pipe.cc	12 Oct 2009 16:02:19 -0000
@@ -21,6 +21,7 @@ details. */
 #include "dtable.h"
 #include "cygheap.h"
 #include "pinfo.h"
+#include "shared_info.h"
 
 fhandler_pipe::fhandler_pipe ()
   : fhandler_base (), popen_pid (0), overlapped (NULL)
@@ -217,6 +218,10 @@ fhandler_pipe::create_selectable (LPSECU
     psize = PIPE_BUF;
 
   char pipename[MAX_PATH] = PIPE_INTRO;
+  __small_sprintf (pipename, PIPE_INTRO "%S-", &installation_key);
+  const size_t len = sizeof (PIPE_INTRO)
+		     + installation_key.Length / sizeof (WCHAR);
+
   /* FIXME: Eventually make ttys work with overlapped I/O. */
   DWORD overlapped = name ? 0 : FILE_FLAG_OVERLAPPED;
 
@@ -228,10 +233,10 @@ fhandler_pipe::create_selectable (LPSECU
     {
       static volatile ULONG pipe_unique_id;
       if (!name)
-	__small_sprintf (pipename + strlen(PIPE_INTRO), "pipe-%p-%p", myself->pid,
+	__small_sprintf (pipename + len, "pipe-%p-%p", myself->pid,
 			InterlockedIncrement ((LONG *) &pipe_unique_id));
       else
-	strcpy (pipename + strlen(PIPE_INTRO), name);
+	strcpy (pipename + len, name);
 
       debug_printf ("CreateNamedPipe: name %s, size %lu", pipename, psize);
 
Index: cygwin/shared.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/shared.cc,v
retrieving revision 1.127
diff -u -p -r1.127 shared.cc
--- cygwin/shared.cc	8 Jun 2009 03:53:40 -0000	1.127
+++ cygwin/shared.cc	12 Oct 2009 16:02:19 -0000
@@ -32,6 +32,60 @@ user_info NO_COPY *user_shared;
 HANDLE NO_COPY cygwin_shared_h;
 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));
+
+/* Use absolute path of cygwin1.dll to derive the Win32 dir which
+   is our installation_root.  Note that we can't handle Cygwin installation
+   root dirs of more than 4K path length.  I assume that's ok...
+
+   This function also generates the installation_key value.  It's a 64 bit
+   hash value based on the path of the Cygwin DLL itself.  It's subsequently
+   used when generating shared object names.  Thus, different Cygwin
+   installations generate different object names and so are 
+   */
+void
+init_installation_root ()
+{
+  if (!GetModuleFileNameW (cygwin_hmodule, installation_root, PATH_MAX))
+    api_fatal ("Can't initialize Cygwin installation root dir.\n"
+	       "GetModuleFileNameW(%p, %p, %u), %E",
+	       cygwin_hmodule, installation_root, PATH_MAX);
+  PWCHAR p = installation_root;
+  if (wcsncmp (p, L"\\\\?\\", 4))	/* No long path prefix. */
+    {
+      if (!wcsncasecmp (p, L"\\\\", 2))	/* UNC */
+	{
+	  p = wcpcpy (p, L"\\??\\UN");
+	  GetModuleFileNameW (cygwin_hmodule, p, PATH_MAX - 6);
+	  *p = L'C';
+	}
+      else
+	{
+	  p = wcpcpy (p, L"\\??\\");
+	  GetModuleFileNameW (cygwin_hmodule, p, PATH_MAX - 4);
+	}
+    }
+  installation_root[1] = L'?';
+
+  RtlInitEmptyUnicodeString (&installation_key, installation_key_buf,
+			     sizeof installation_key_buf);
+  RtlInt64ToHexUnicodeString (hash_path_name (0, installation_root),
+			      &installation_key, FALSE);
+
+  PWCHAR w = wcsrchr (installation_root, L'\\');
+  if (w)
+    {
+      *w = L'\0';
+      w = wcsrchr (installation_root, L'\\');
+    }
+  if (!w)
+    api_fatal ("Can't initialize Cygwin installation root dir.\n"
+	       "Invalid DLL path");
+  *w = L'\0';
+}
+
 /* This function returns a handle to the top-level directory in the global
    NT namespace used to implement global objects including shared memory. */
 
@@ -46,9 +100,10 @@ get_shared_parent_dir ()
   if (!dir)
     {
       WCHAR bnoname[MAX_PATH];
-      __small_swprintf (bnoname, L"\\BaseNamedObjects\\%s%s",
+      __small_swprintf (bnoname, L"\\BaseNamedObjects\\%s%s-%S",
 			cygwin_version.shared_id,
-			_cygwin_testing ? cygwin_version.dll_build_date : "");
+			_cygwin_testing ? cygwin_version.dll_build_date : "",
+			&installation_key);
       RtlInitUnicodeString (&uname, bnoname);
       InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
 				  NULL, everyone_sd (CYG_SHARED_DIR_ACCESS));
@@ -79,9 +134,10 @@ get_session_parent_dir ()
 	{
 	  WCHAR bnoname[MAX_PATH];
 	  __small_swprintf (bnoname,
-			    L"\\Sessions\\BNOLINKS\\%d\\%s%s",
+			    L"\\Sessions\\BNOLINKS\\%d\\%s%s-%S",
 			    psi.SessionId, cygwin_version.shared_id,
-			    _cygwin_testing ? cygwin_version.dll_build_date : "");
+			    _cygwin_testing ? cygwin_version.dll_build_date : "",
+			    &installation_key);
 	  RtlInitUnicodeString (&uname, bnoname);
 	  InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF,
 				      NULL, everyone_sd(CYG_SHARED_DIR_ACCESS));
@@ -270,46 +326,6 @@ shared_destroy ()
   UnmapViewOfFile (user_shared);
 }
 
-/* Use absolute path of cygwin1.dll to derive the Win32 dir which
-   is our installation root.  Note that we can't handle Cygwin installation
-   root dirs of more than 4K path length.  I assume that's ok... */
-void
-shared_info::init_installation_root ()
-{
-  if (!GetModuleFileNameW (cygwin_hmodule, installation_root, PATH_MAX))
-    api_fatal ("Can't initialize Cygwin installation root dir.\n"
-	       "GetModuleFileNameW(%p, %p, %u), %E",
-	       cygwin_hmodule, installation_root, PATH_MAX);
-  PWCHAR p = installation_root;
-  if (wcsncmp (p, L"\\\\?\\", 4))	/* No long path prefix. */
-    {
-      if (!wcsncasecmp (p, L"\\\\", 2))	/* UNC */
-	{
-	  p = wcpcpy (p, L"\\??\\UN");
-	  GetModuleFileNameW (cygwin_hmodule, p, PATH_MAX - 6);
-	  *p = L'C';
-	}
-      else
-	{
-	  p = wcpcpy (p, L"\\??\\");
-	  GetModuleFileNameW (cygwin_hmodule, p, PATH_MAX - 4);
-	}
-    }
-  installation_root[1] = L'?';
-
-  PWCHAR w = wcsrchr (installation_root, L'\\');
-  if (w)
-    {
-      *w = L'\0';
-      w = wcsrchr (installation_root, L'\\');
-    }
-  if (!w)
-    api_fatal ("Can't initialize Cygwin installation root dir.\n"
-	       "Invalid DLL path");
-
-  *w = L'\0';
-}
-
 /* Initialize obcaseinsensitive.  Default to case insensitive on pre-XP. */
 void
 shared_info::init_obcaseinsensitive ()
@@ -349,7 +365,6 @@ shared_info::initialize ()
 
   if (!sversion)
     {
-      init_installation_root ();/* Initialize installation root dir. */
       init_obcaseinsensitive ();/* Initialize obcaseinsensitive. */
       tty.init ();		/* Initialize tty table.  */
       mt.initialize ();		/* Initialize shared tape information. */
@@ -373,6 +388,10 @@ 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",
@@ -380,6 +399,11 @@ 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. */
+  debug_printf ("Installation root: <%W> key: <%S>",
+		installation_root, &installation_key);
   cygwin_shared->initialize ();
   user_shared_create (false);
 }
Index: cygwin/shared_info.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/shared_info.h,v
retrieving revision 1.84
diff -u -p -r1.84 shared_info.h
--- cygwin/shared_info.h	8 Jun 2009 03:53:40 -0000	1.84
+++ cygwin/shared_info.h	12 Oct 2009 16:02:19 -0000
@@ -29,9 +29,9 @@ public:
 				  cygwin_version.api_minor)
 #define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
 
-#define SHARED_INFO_CB 39328
+#define SHARED_INFO_CB 31136
 
-#define CURR_SHARED_MAGIC 0x22f9ff0bU
+#define CURR_SHARED_MAGIC 0x18da899eU
 
 #define USER_VERSION	1	// increment when mount table changes and
 #define USER_VERSION_MAGIC CYGWIN_VERSION_MAGIC (USER_MAGIC, USER_VERSION)
@@ -51,12 +51,10 @@ class shared_info
   DWORD sys_mount_table_counter;
   tty_list tty;
   LONG last_used_bindresvport;
-  WCHAR installation_root[PATH_MAX];
   DWORD obcaseinsensitive;
   mtinfo mt;
 
   void initialize ();
-  void init_installation_root ();
   void init_obcaseinsensitive ();
   unsigned heap_chunk_size ();
   unsigned heap_slop_size ();
@@ -105,4 +103,6 @@ void *__stdcall open_shared (const WCHAR
 			     DWORD access = FILE_MAP_READ | FILE_MAP_WRITE);
 extern void user_shared_create (bool reinit);
 extern void user_shared_initialize ();
-
+extern void init_installation_root ();
+extern WCHAR installation_root[PATH_MAX];
+extern UNICODE_STRING installation_key;
Index: cygwin/uinfo.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/uinfo.cc,v
retrieving revision 1.168
diff -u -p -r1.168 uinfo.cc
--- cygwin/uinfo.cc	6 May 2009 11:52:20 -0000	1.168
+++ cygwin/uinfo.cc	12 Oct 2009 16:02:19 -0000
@@ -514,13 +514,13 @@ pwdgrp::load (const wchar_t *rel_path)
   curr_lines = 0;
 
   if (!path &&
-      !(path = (PWCHAR) malloc ((wcslen (cygwin_shared->installation_root)
+      !(path = (PWCHAR) malloc ((wcslen (installation_root)
 				 + wcslen (rel_path) + 1) * sizeof (WCHAR))))
     {
       paranoid_printf ("malloc (%W) failed", rel_path);
       goto out;
     }
-  wcpcpy (wcpcpy (path, cygwin_shared->installation_root), rel_path);
+  wcpcpy (wcpcpy (path, installation_root), rel_path);
   RtlInitUnicodeString (&upath, path);
 
   InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL);
Index: cygwin/include/sys/cygwin.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/sys/cygwin.h,v
retrieving revision 1.81
diff -u -p -r1.81 cygwin.h
--- cygwin/include/sys/cygwin.h	6 Oct 2009 21:51:17 -0000	1.81
+++ cygwin/include/sys/cygwin.h	12 Oct 2009 16:02:19 -0000
@@ -143,7 +143,8 @@ typedef enum
     CW_SET_DOS_FILE_WARNING,
     CW_SET_PRIV_KEY,
     CW_SETERRNO,
-    CW_EXIT_PROCESS
+    CW_EXIT_PROCESS,
+    CW_GET_INSTKEY
   } cygwin_getinfo_types;
 
 #define CW_NEXTPID	0x80000000	/* or with pid to get next one */


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]