* cygprops.h: New file.

* 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.
	* globals.cc: Include cygprops.h.
	(_RDATA): Move slightly and add comment.
	(cygwin_props): Define.
	* 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.  Invalidate
	installation_key depending of value of disable_key property.  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/cygwin/version.h: Bump API minor number.
	(CYGWIN_INFO_INSTALLATIONS_NAME): Add.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_INSTKEY.
This commit is contained in:
Corinna Vinschen
2009-10-31 13:24:06 +00:00
parent 7c16c02dbb
commit 526b0fbca3
13 changed files with 220 additions and 62 deletions

View File

@@ -13,6 +13,7 @@ details. */
#include "winsup.h"
#include "cygtls.h"
#include "perprocess.h"
#include "cygprops.h"
#include "thread.h"
#include <malloc.h>
#include <cygwin/version.h>
@@ -72,6 +73,9 @@ char NO_COPY almost_null[1];
char *old_title;
/* Define globally used, but readonly variables using the _RDATA attribute. */
#define _RDATA __attribute__ ((section(".rdata")))
/* Heavily-used const UNICODE_STRINGs are defined here once. The idea is a
speed improvement by not having to initialize a UNICODE_STRING every time
we make a string comparison. The strings are not defined as const,
@@ -83,7 +87,6 @@ char *old_title;
{ Length: sizeof (_s) - sizeof (WCHAR), \
MaximumLength: sizeof (_s), \
Buffer: (PWSTR) (_s) }
#define _RDATA __attribute__ ((section(".rdata")))
UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
@@ -102,9 +105,22 @@ UNICODE_STRING _RDATA ro_u_sunwnfs = _ROU (L"SUNWNFS");
UNICODE_STRING _RDATA ro_u_udf = _ROU (L"UDF");
UNICODE_STRING _RDATA ro_u_unixfs = _ROU (L"UNIXFS");
UNICODE_STRING _RDATA ro_u_volume = _ROU (L"\\??\\Volume{");
#undef _RDATA
#undef _ROU
/* Cygwin properties are meant to be readonly data placed in the DLL, but
which can be changed by external tools to make adjustments to the
behaviour of a DLL based on the binary of the DLL itself. This is
different from $CYGWIN since it only affects that very DLL, not all
DLLs which have access to the $CYGWIN environment variable. */
cygwin_props_t _RDATA cygwin_props =
{
CYGWIN_PROPS_MAGIC,
sizeof (cygwin_props_t),
0
};
#undef _RDATA
extern "C"
{
/* This is an exported copy of environ which can be used by DLLs