From 2a6fc028badee6ab9a4df2b1b395dbb701d965fb Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 28 Jan 2001 05:51:15 +0000 Subject: 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. --- winsup/cygwin/shared_info.h | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/shared_info.h') diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index 4b4b2f82f..047c7ffcd 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -40,12 +40,13 @@ public: scheme should be satisfactory for a long while yet. */ #define MAX_MOUNTS 30 +#define MOUNT_VERSION 0x01010102 + class reg_key; class mount_info { - int posix_sorted[MAX_MOUNTS]; - int native_sorted[MAX_MOUNTS]; public: + DWORD version; int nmounts; mount_item mount[MAX_MOUNTS]; @@ -61,7 +62,11 @@ public: char cygdrive[MAX_PATH]; size_t cygdrive_len; unsigned cygdrive_flags; +private: + int posix_sorted[MAX_MOUNTS]; + int native_sorted[MAX_MOUNTS]; +public: /* Increment when setting up a reg_key if mounts area had to be created so we know when we need to import old mount tables. */ int had_to_create_mount_areas; @@ -135,9 +140,6 @@ class shared_info DWORD inited; public: - /* FIXME: Doesn't work if more than one user on system. */ - mount_info mount; - int heap_chunk_in_mb; unsigned heap_chunk_size (void); @@ -147,11 +149,20 @@ public: }; extern shared_info *cygwin_shared; -extern HANDLE cygwin_shared_h; -extern HANDLE console_shared_h; +extern mount_info *mount_table; +extern HANDLE cygwin_mount_h; void __stdcall shared_init (void); void __stdcall shared_terminate (void); +#define shared_align_past(p) \ + ((char *) (system_info.dwAllocationGranularity * \ + (((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \ + system_info.dwAllocationGranularity))) + +#define cygwin_shared_address ((void *) 0xa000000) +#define mount_table_address shared_align_past (cygwin_shared) +#define cygheap_address shared_align_past ((mount_info *) shared_align_past (cygwin_shared)) + char *__stdcall shared_name (const char *, int); void *__stdcall open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr); -- cgit v1.2.3