* cygheap.cc (init_cheap): Move username initialization.
(cygheap_init): Here. * shared_info.h (mount_info): Add a sys_mount_table_counter field. (shared_info): Ditto. * path.cc (mount_info::conv_to_win32_path): Check that our mount table is in sync with the system mount table and reinitialize it if not. (mount_info::add_reg_mount): Bump sys_mount_table counters if the system mount table changes. (mount_info::del_reg_mount): Ditto. (mount_info::write_cygdrive_info_to_registry): Ditto. (mount_info::remove_cygdrive_info_from_registry): Ditto.
This commit is contained in:
parent
2a6fc028ba
commit
9a089f21ea
|
@ -1,3 +1,17 @@
|
||||||
|
Sun Jan 28 01:18:22 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* cygheap.cc (init_cheap): Move username initialization.
|
||||||
|
(cygheap_init): Here.
|
||||||
|
* shared_info.h (mount_info): Add a sys_mount_table_counter field.
|
||||||
|
(shared_info): Ditto.
|
||||||
|
* path.cc (mount_info::conv_to_win32_path): Check that our mount table
|
||||||
|
is in sync with the system mount table and reinitialize it if not.
|
||||||
|
(mount_info::add_reg_mount): Bump sys_mount_table counters if the
|
||||||
|
system mount table changes.
|
||||||
|
(mount_info::del_reg_mount): Ditto.
|
||||||
|
(mount_info::write_cygdrive_info_to_registry): Ditto.
|
||||||
|
(mount_info::remove_cygdrive_info_from_registry): Ditto.
|
||||||
|
|
||||||
Sun Jan 28 00:28:30 2001 Christopher Faylor <cgf@cygnus.com>
|
Sun Jan 28 00:28:30 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
Throughout, change 'cygwin_shared.mount' to 'mount_table'.
|
Throughout, change 'cygwin_shared.mount' to 'mount_table'.
|
||||||
|
|
|
@ -32,14 +32,6 @@ init_cheap ()
|
||||||
if (!cygheap)
|
if (!cygheap)
|
||||||
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
|
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
|
||||||
cygheap_max = cygheap + 1;
|
cygheap_max = cygheap + 1;
|
||||||
|
|
||||||
char username[MAX_USER_NAME];
|
|
||||||
DWORD username_len = MAX_USER_NAME;
|
|
||||||
|
|
||||||
if (!GetUserName (username, &username_len))
|
|
||||||
cygheap->user.set_name ("unknown");
|
|
||||||
else
|
|
||||||
cygheap->user.set_name (username);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define pagetrunc(x) ((void *) (((DWORD) (x)) & ~(4096 - 1)))
|
#define pagetrunc(x) ((void *) (((DWORD) (x)) & ~(4096 - 1)))
|
||||||
|
@ -75,6 +67,14 @@ cygheap_init ()
|
||||||
{
|
{
|
||||||
cygheap_protect = new_muto (FALSE, "cygheap_protect");
|
cygheap_protect = new_muto (FALSE, "cygheap_protect");
|
||||||
_csbrk (0);
|
_csbrk (0);
|
||||||
|
|
||||||
|
char username[MAX_USER_NAME];
|
||||||
|
DWORD username_len = MAX_USER_NAME;
|
||||||
|
|
||||||
|
if (!GetUserName (username, &username_len))
|
||||||
|
cygheap->user.set_name ("unknown");
|
||||||
|
else
|
||||||
|
cygheap->user.set_name (username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copyright (C) 1997, 2000 DJ Delorie */
|
/* Copyright (C) 1997, 2000 DJ Delorie */
|
||||||
|
|
|
@ -979,6 +979,11 @@ mount_info::conv_to_win32_path (const char *src_path, char *win32_path,
|
||||||
char *full_win32_path, DWORD &devn, int &unit,
|
char *full_win32_path, DWORD &devn, int &unit,
|
||||||
unsigned *flags)
|
unsigned *flags)
|
||||||
{
|
{
|
||||||
|
while (sys_mount_table_counter < cygwin_shared->sys_mount_table_counter)
|
||||||
|
{
|
||||||
|
init ();
|
||||||
|
sys_mount_table_counter++;
|
||||||
|
}
|
||||||
int src_path_len = strlen (src_path);
|
int src_path_len = strlen (src_path);
|
||||||
int trailing_slash_p = (src_path_len > 1
|
int trailing_slash_p = (src_path_len > 1
|
||||||
&& SLASH_P (src_path[src_path_len - 1]));
|
&& SLASH_P (src_path[src_path_len - 1]));
|
||||||
|
@ -1485,6 +1490,9 @@ mount_info::add_reg_mount (const char * native_path, const char * posix_path, un
|
||||||
if (res != ERROR_SUCCESS)
|
if (res != ERROR_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
res = subkey.set_int ("flags", mountflags);
|
res = subkey.set_int ("flags", mountflags);
|
||||||
|
|
||||||
|
sys_mount_table_counter++;
|
||||||
|
cygwin_shared->sys_mount_table_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* Success! */
|
return 0; /* Success! */
|
||||||
|
@ -1502,7 +1510,7 @@ mount_info::del_reg_mount (const char * posix_path, unsigned flags)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if ((flags & MOUNT_SYSTEM) == 0) /* Delete from user registry */
|
if (!(flags & MOUNT_SYSTEM)) /* Delete from user registry */
|
||||||
{
|
{
|
||||||
reg_key reg_user (KEY_ALL_ACCESS,
|
reg_key reg_user (KEY_ALL_ACCESS,
|
||||||
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
|
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
|
||||||
|
@ -1510,6 +1518,8 @@ mount_info::del_reg_mount (const char * posix_path, unsigned flags)
|
||||||
}
|
}
|
||||||
else /* Delete from system registry */
|
else /* Delete from system registry */
|
||||||
{
|
{
|
||||||
|
sys_mount_table_counter++;
|
||||||
|
cygwin_shared->sys_mount_table_counter++;
|
||||||
reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
|
reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
|
||||||
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
|
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
|
||||||
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
|
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
|
||||||
|
@ -1586,6 +1596,12 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign
|
||||||
/* Determine whether to modify user or system cygdrive path prefix. */
|
/* Determine whether to modify user or system cygdrive path prefix. */
|
||||||
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
|
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
|
||||||
|
|
||||||
|
if (flags & MOUNT_SYSTEM)
|
||||||
|
{
|
||||||
|
sys_mount_table_counter++;
|
||||||
|
cygwin_shared->sys_mount_table_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
|
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
|
||||||
HKEY_LOCAL_MACHINE. */
|
HKEY_LOCAL_MACHINE. */
|
||||||
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
|
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
|
||||||
|
@ -1621,8 +1637,7 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign
|
||||||
appropriate:
|
appropriate:
|
||||||
1. setting user path prefix, or
|
1. setting user path prefix, or
|
||||||
2. overwriting (a previous) system path prefix */
|
2. overwriting (a previous) system path prefix */
|
||||||
if ((flags & MOUNT_SYSTEM) == 0 ||
|
if (!(flags & MOUNT_SYSTEM) || (mount_table->cygdrive_flags & MOUNT_SYSTEM))
|
||||||
(mount_table->cygdrive_flags & MOUNT_SYSTEM) != 0)
|
|
||||||
{
|
{
|
||||||
slashify (cygdrive_prefix, mount_table->cygdrive, 1);
|
slashify (cygdrive_prefix, mount_table->cygdrive, 1);
|
||||||
mount_table->cygdrive_flags = flags;
|
mount_table->cygdrive_flags = flags;
|
||||||
|
@ -1638,6 +1653,12 @@ mount_info::remove_cygdrive_info_from_registry (const char *cygdrive_prefix, uns
|
||||||
/* Determine whether to modify user or system cygdrive path prefix. */
|
/* Determine whether to modify user or system cygdrive path prefix. */
|
||||||
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
|
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
|
||||||
|
|
||||||
|
if (flags & MOUNT_SYSTEM)
|
||||||
|
{
|
||||||
|
sys_mount_table_counter++;
|
||||||
|
cygwin_shared->sys_mount_table_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
|
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
|
||||||
HKEY_LOCAL_MACHINE. */
|
HKEY_LOCAL_MACHINE. */
|
||||||
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
|
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
|
||||||
|
@ -1728,7 +1749,7 @@ sort_by_posix_name (const void *a, const void *b)
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
/* need to select between user and system mount to same POSIX path */
|
/* need to select between user and system mount to same POSIX path */
|
||||||
if ((bp->flags & MOUNT_SYSTEM) == 0) /* user mount */
|
if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1764,7 +1785,7 @@ sort_by_native_name (const void *a, const void *b)
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
/* need to select between user and system mount to same POSIX path */
|
/* need to select between user and system mount to same POSIX path */
|
||||||
if ((bp->flags & MOUNT_SYSTEM) == 0) /* user mount */
|
if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -47,6 +47,7 @@ class mount_info
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DWORD version;
|
DWORD version;
|
||||||
|
DWORD sys_mount_table_counter;
|
||||||
int nmounts;
|
int nmounts;
|
||||||
mount_item mount[MAX_MOUNTS];
|
mount_item mount[MAX_MOUNTS];
|
||||||
|
|
||||||
|
@ -138,14 +139,14 @@ public:
|
||||||
class shared_info
|
class shared_info
|
||||||
{
|
{
|
||||||
DWORD inited;
|
DWORD inited;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int heap_chunk_in_mb;
|
int heap_chunk_in_mb;
|
||||||
unsigned heap_chunk_size (void);
|
DWORD sys_mount_table_counter;
|
||||||
|
|
||||||
tty_list tty;
|
tty_list tty;
|
||||||
delqueue_list delqueue;
|
delqueue_list delqueue;
|
||||||
void initialize (void);
|
void initialize (void);
|
||||||
|
unsigned heap_chunk_size (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern shared_info *cygwin_shared;
|
extern shared_info *cygwin_shared;
|
||||||
|
|
Loading…
Reference in New Issue