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/syscalls.cc | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'winsup/cygwin/syscalls.cc') diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index f42c9e126..3945912f3 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -38,6 +38,8 @@ details. */ #include "security.h" #include "cygheap.h" +SYSTEM_INFO system_info; + /* Close all files and process any queued deletions. Lots of unix style applications will open a tmp file, unlink it, but never call close. This function is called by _exit to @@ -835,7 +837,7 @@ chmod (const char *path, mode_t mode) NULL, &uid, &gid); if (win32_path.file_attributes () & FILE_ATTRIBUTE_DIRECTORY) mode |= S_IFDIR; - if (! set_file_attribute (win32_path.has_acls (), + if (!set_file_attribute (win32_path.has_acls (), win32_path.get_win32 (), uid, gid, mode, cygheap->user.logsrv ()) @@ -1233,8 +1235,8 @@ _rename (const char *oldpath, const char *newpath) return -1; } - if (! writable_directory (real_old.get_win32 ()) - || ! writable_directory (real_new.get_win32 ())) + if (!writable_directory (real_old.get_win32 ()) + || !writable_directory (real_new.get_win32 ())) { syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath); return -1; @@ -1360,15 +1362,9 @@ getdtablesize () extern "C" size_t getpagesize () { - static DWORD sys_page_size = 0; - - if (!sys_page_size) - { - SYSTEM_INFO si; - GetSystemInfo(&si); - sys_page_size = si.dwPageSize; - } - return (int)sys_page_size; + if (!system_info.dwPageSize) + GetSystemInfo(&system_info); + return (int) system_info.dwPageSize; } /* FIXME: not all values are correct... */ @@ -1952,8 +1948,7 @@ chroot (const char *newroot) goto done; } char buf[MAX_PATH + 1]; - ret = cygwin_shared->mount.conv_to_posix_path (path.get_win32 (), - buf, 0); + ret = mount_table->conv_to_posix_path (path.get_win32 (), buf, 0); if (ret) { set_errno (ret); -- cgit v1.2.3