libc/winsup/cygwin/shared.cc

288 lines
7.6 KiB
C++
Raw Normal View History

2000-02-17 20:38:33 +01:00
/* shared.cc: shared data area support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
2000-02-17 20:38:33 +01:00
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
2000-02-17 20:38:33 +01:00
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <grp.h>
#include <pwd.h>
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
Add "path.h" include throughout, where needed. Use new path_conv methods and operators to simplify testing for directory and attributes, throughout. * path.h (path_conv::exists): New method. (path_conv::has_attribute): Ditto. (path_conv::isdir): Ditto. (path_conv::DWORD &): New operator. (path_conv::int &): Ditto. * dir.cc (rmdir): Eliminate a goto. * dtable.cc (dtable::build_fhandler): Accept opt and suffix info for path_conv.check. Return fh == NULL on path_conv error. Pass unit to set_name as appropriate. (dtable::reset_unix_path_name): New method. * dtable.h (dtable): Declare new method. Reflect arg changes to build_fhandler. * fhandler.cc (fhandler_disk_dummy_name): Eliminate. (fhandler_base::set_name): Expect paths to be NULL. Build unix_path_name from win32_path_name when it is a device. (fhandler_base::reset_unix_path_name): New method. (fhandler_base::raw_read): Report EISDIR when ERROR_INVALID_FUNCTION or ERROR_INVALID_PARAMETER and reading a directory. (fhandler_disk_file::fstat): Don't call stat_dev since we should now never be calling fhandler_disk_file methods with devices. (fhandler_base::fhandler_base): Clear {unix,win32}_path_name. (fhandler_base::~fhandler_base): Always free {unix,win32}_path_name. (fhandler_disk_file::fhandler_disk_file): Remove set_no_free_names kludge. (fhandler_disk_file::open): Ditto. * fhandler.h (fhandler_base::no_free_names): Eliminate. (fhandler_base::set_no_free_names): Ditto. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Don't set unix_path_name here. * path.cc (fchdir): Lock fd table throughout. Use new dtable::reset_unix_path_name method to reset path. * syscalls.cc (stat_worker): Reorganize to always call fstat method. Pass path_conv method to fhandler_*::open. (chroot): Elminate a goto.
2001-10-01 06:10:07 +02:00
#include "path.h"
#include "dtable.h"
#include "cygerrno.h"
#include "cygheap.h"
#include "heap.h"
* Makefile.in: Autogenerate some header files which provide magic numbers. Force dependencies for files which depend on autogenerated headers to ensure that they are always built. * child_info.h (child_info): Add new fields to accommodate new magic number header stuff. * dcrt0.cc: Rely on "child_info_magic.h" to ensure that correct child_info magic numbers are used. (dll_crt0_1): Temporarily remove _cygwin_testing_magic test. (_dll_crt0): Do more testing on magic numbers from fork_info structure. Call "multiple_cygwin_problem" where appropriate. (multiple_cygwin_problem): Rename from multiple_cygwin_die. Issue a warning or die, as appropriate based on cygwin version/magic number mismatch. * pinfo.cc (pinfo::exit): Don't attempt to dereference `this' if it doesn't exist. This can happen when a fatal error occurs early in process initialization. * shared.cc: Rely on "shared_info_magic.h" to accommodate that new magic number header stuff. (shared_info::initialize): Use new magic number stuff, for shared region. (memory_init): Ditto, for mount table. * shared_info.h: Accomodate new magic number stuff for shared region and mount table. * sigproc.cc: Rely on "child_info_magic.h" to accommodate new magic number header stuff. (init_child_info): Initialize new fields in child_info) to accomodate magic numbers. * winsup.h: Rename multiple_cygwin_die to multiple_cygwin_problem. * include/cygwin/version.h: Define macros for manipulating version magic. * cygmagic: New shell script for generating magic numbers.
2001-12-26 05:53:34 +01:00
#include "shared_info_magic.h"
#include "registry.h"
#include "cygwin_version.h"
#include "child_info.h"
2000-02-17 20:38:33 +01:00
shared_info NO_COPY *cygwin_shared;
mount_info NO_COPY *mount_table;
HANDLE NO_COPY cygwin_mount_h;
2000-02-17 20:38:33 +01:00
char * __stdcall
shared_name (char *ret_buf, const char *str, int num)
2000-02-17 20:38:33 +01:00
{
extern bool _cygwin_testing;
2000-02-17 20:38:33 +01:00
__small_sprintf (ret_buf, "%s%s.%s.%d",
wincap.has_terminal_services () ? "Global\\" : "",
cygwin_version.shared_id, str, num);
if (_cygwin_testing)
strcat (ret_buf, cygwin_version.dll_build_date);
return ret_buf;
2000-02-17 20:38:33 +01:00
}
#define page_const (65535)
#define pround(n) (((size_t) (n) + page_const) & ~page_const)
static char *offsets[] =
{
(char *) cygwin_shared_address,
(char *) cygwin_shared_address
+ pround (sizeof (shared_info)),
(char *) cygwin_shared_address
+ pround (sizeof (shared_info))
+ pround (sizeof (mount_info)),
(char *) cygwin_shared_address
+ pround (sizeof (shared_info))
+ pround (sizeof (mount_info))
+ pround (sizeof (console_state)),
(char *) cygwin_shared_address
+ pround (sizeof (shared_info))
+ pround (sizeof (mount_info))
+ pround (sizeof (console_state))
+ pround (sizeof (_pinfo))
};
2000-02-17 20:38:33 +01:00
void * __stdcall
open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
shared_locations m, PSECURITY_ATTRIBUTES psa)
2000-02-17 20:38:33 +01:00
{
void *shared;
void *addr;
if (!wincap.needs_memory_protection ())
addr = NULL;
else
{
addr = offsets[m];
(void) VirtualFree (addr, 0, MEM_RELEASE);
}
if (!size)
return addr;
2000-02-17 20:38:33 +01:00
if (!shared_h)
{
char *mapname;
char map_buf[MAX_PATH];
2000-02-17 20:38:33 +01:00
if (!name)
mapname = NULL;
else
{
mapname = shared_name (map_buf, name, n);
2000-02-17 20:38:33 +01:00
shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
TRUE, mapname);
}
if (!shared_h &&
!(shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa,
PAGE_READWRITE, 0, size, mapname)))
api_fatal ("CreateFileMapping, %E. Terminating.");
2000-02-17 20:38:33 +01:00
}
shared = (shared_info *)
MapViewOfFileEx (shared_h, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0, addr);
2000-02-17 20:38:33 +01:00
if (!shared)
{
/* Probably win95, so try without specifying the address. */
shared = (shared_info *) MapViewOfFileEx (shared_h,
FILE_MAP_READ|FILE_MAP_WRITE,
0, 0, 0, 0);
#ifdef DEBUGGING
if (wincap.is_winnt ())
system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
#endif
2000-02-17 20:38:33 +01:00
}
if (!shared)
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.
2001-01-28 06:51:15 +01:00
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h);
2000-02-17 20:38:33 +01:00
if (m == SH_CYGWIN_SHARED && wincap.needs_memory_protection ())
{
unsigned delta = (char *) shared - offsets[0];
offsets[0] = (char *) shared;
for (int i = SH_CYGWIN_SHARED + 1; i < SH_TOTAL_SIZE; i++)
{
unsigned size = offsets[i + 1] - offsets[i];
offsets[i] += delta;
if (!VirtualAlloc (offsets[i], size, MEM_RESERVE, PAGE_NOACCESS))
continue; /* oh well */
}
offsets[SH_TOTAL_SIZE] += delta;
#if 0
if (!child_proc_info && wincap.needs_memory_protection ())
for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000)
VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS);
#endif
}
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.
2001-01-28 06:51:15 +01:00
debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
2000-02-17 20:38:33 +01:00
return shared;
}
void
user_shared_initialize ()
{
char name[UNLEN + 1] = "";
if (wincap.has_security ())
{
cygsid tu (cygheap->user.sid ());
tu.string (name);
}
else
strcpy (name, cygheap->user.name ());
if (cygwin_mount_h) /* Reinit */
{
if (!UnmapViewOfFile (mount_table))
debug_printf("UnmapViewOfFile %E");
if (!ForceCloseHandle (cygwin_mount_h))
debug_printf("CloseHandle %E");
cygwin_mount_h = NULL;
}
mount_table = (mount_info *) open_shared (name, MOUNT_VERSION,
cygwin_mount_h, sizeof (mount_info),
SH_MOUNT_TABLE, &sec_none);
debug_printf ("opening mount table for '%s' at %p", name,
mount_table);
ProtectHandleINH (cygwin_mount_h);
debug_printf ("mount table version %x at %p", mount_table->version, mount_table);
/* Initialize the Cygwin per-user mount table, if necessary */
if (!mount_table->version)
{
mount_table->version = MOUNT_VERSION_MAGIC;
debug_printf ("initializing mount table");
mount_table->cb = sizeof (*mount_table);
if (mount_table->cb != MOUNT_INFO_CB)
system_printf ("size of mount table region changed from %u to %u",
MOUNT_INFO_CB, mount_table->cb);
mount_table->init (); /* Initialize the mount table. */
}
else if (mount_table->version != MOUNT_VERSION_MAGIC)
multiple_cygwin_problem ("mount", mount_table->version, MOUNT_VERSION);
else if (mount_table->cb != MOUNT_INFO_CB)
multiple_cygwin_problem ("mount table size", mount_table->cb, MOUNT_INFO_CB);
}
2000-02-17 20:38:33 +01:00
void
shared_info::initialize ()
2000-02-17 20:38:33 +01:00
{
DWORD sversion = (DWORD) InterlockedExchange ((LONG *) &version, SHARED_VERSION_MAGIC);
if (!sversion)
{
/* Initialize the queue of deleted files. */
delqueue.init ();
/* Initialize tty table. */
tty.init ();
}
else
2000-02-17 20:38:33 +01:00
{
if (version != SHARED_VERSION_MAGIC)
{
multiple_cygwin_problem ("shared", version, SHARED_VERSION_MAGIC);
InterlockedExchange ((LONG *) &version, sversion);
}
while (!cb)
low_priority_sleep (0); // Should be hit only very very rarely
}
/* Initialize the Cygwin heap, if necessary */
if (!cygheap)
{
cygheap_init ();
cygheap->user.init ();
2000-02-17 20:38:33 +01:00
}
heap_init ();
if (!sversion)
cb = sizeof (*this); // Do last, after all shared memory initializion
2000-02-17 20:38:33 +01:00
if (cb != SHARED_INFO_CB)
system_printf ("size of shared memory region changed from %u to %u",
SHARED_INFO_CB, cb);
2000-02-17 20:38:33 +01:00
}
void __stdcall
memory_init ()
2000-02-17 20:38:33 +01:00
{
getpagesize ();
/* Initialize general shared memory */
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.
2001-01-28 06:51:15 +01:00
HANDLE shared_h = cygheap ? cygheap->shared_h : NULL;
cygwin_shared = (shared_info *) open_shared ("shared",
CYGWIN_VERSION_SHARED_DATA,
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.
2001-01-28 06:51:15 +01:00
shared_h,
sizeof (*cygwin_shared),
SH_CYGWIN_SHARED);
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.
2001-01-28 06:51:15 +01:00
cygwin_shared->initialize ();
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.
2001-01-28 06:51:15 +01:00
cygheap->shared_h = shared_h;
* debug.h (handle_list): Move here from debug.cc. Add "inherit" flag functionality. * cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk. (_csbrk): Reorganize to not assume first allocation is <= 1 page. (cygheap_setup_for_child): Mark protected handle as inheritable. * cygheap.h (cygheap_debug): New struct. (init_cygheap): Add new structure when debugging. * dcrt0.cc (dll_crt0_1): Remove call to debug_init. Close ppid_handle here, if appropriate. Don't protect subproc_ready, since it is already protected in the parent. Call memory_init prior to ProtectHandle to ensure that cygheap is set up. Call debug_fixup_after_fork_exec when appropriate. (_dll_crt0): Don't close ppid_handle here. * debug.cc: Use cygheap debug structure rather than static elements throughout. (add_handle): Don't issue a warning if attempt to protect handle in exactly the same way from exactly the same place. Add pid info to warning output. Accept additional argument controlling whether handle is to be inherited. Add pid to stored information. (debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork. Reorganize to avoid erroneously skipping handles. (mark_closed): Add pid info to warning output. (setclexec): Rename from setclexec_pid. * fhandler.cc (fhandler_base::get_default_fmode): Minor reorg. (fhandler_base::fstat): Add debugging output. (fhandler_base::set_inheritance): Call setclexec rather than setclexec_pid. (fhandler_base::fork_fixup): Ditto. * fhandler_console.cc (get_tty_stuff): Mark protected handle as inheritable. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * tty.cc (tty::make_pipes): Ditto. (tty::common_init): Ditto. * fork.cc (fork_parent): Ditto. (fork_child): Close protected handles with correct name. Remove debug_fixup_after_fork call. * fhandler_socket.cc (fhandler_socket::create_secret_event): Mark protected handle as inheritable/non-inheritable, as appropriate. * shared.cc (memory_init): Mark protected handle as inheritable. Call debug_init here. * sigproc.cc (wait_sig): Close protected handle with correct name. * spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as inheritable. * exceptions.cc (debugger_command): Try to run dumper.exe, if found. * syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup since path is already resolved.
2002-07-13 22:00:27 +02:00
ProtectHandleINH (cygheap->shared_h);
user_shared_initialize ();
2000-02-17 20:38:33 +01:00
}
unsigned
shared_info::heap_chunk_size ()
{
if (!heap_chunk)
{
/* Fetch misc. registry entries. */
reg_key reg (KEY_READ, NULL);
/* Note that reserving a huge amount of heap space does not result in
the use of swap since we are not committing it. */
/* FIXME: We should not be restricted to a fixed size heap no matter
what the fixed size is. */
heap_chunk = reg.get_int ("heap_chunk_in_mb", 0);
if (!heap_chunk) {
reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL);
heap_chunk = r1.get_int ("heap_chunk_in_mb", 384);
}
if (heap_chunk < 4)
heap_chunk = 4 * 1024 * 1024;
else
heap_chunk <<= 20;
if (!heap_chunk)
heap_chunk = 384 * 1024 * 1024;
debug_printf ("fixed heap size is %u", heap_chunk);
}
return heap_chunk;
2000-02-17 20:38:33 +01:00
}