* cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT.

This commit is contained in:
Christopher Faylor 2001-08-20 15:58:16 +00:00
parent 538eaed779
commit b1d0b9073c
2 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,7 @@
Mon Aug 20 11:56:19 2001 Christopher Faylor <cgf@cygnus.com>
* cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT.
Thu Aug 16 09:38:59 2001 Jason Tishler <jason@tishler.net>
* fhandler_socket.cc (fhandler_socket::create_secret_event): Relax

View File

@ -51,9 +51,24 @@ static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
inline static void
init_cheap ()
{
if (!iswinnt)
{
cygheap = (init_cygheap *) VirtualAlloc (NULL, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
if (!cygheap)
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
}
else
{
HANDLE h;
h = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_none, PAGE_READWRITE,
0, CYGHEAPSIZE, NULL);
if (!h)
api_fatal ("CreateFileMapping failed, %E");
cygheap = (init_cygheap *) MapViewOfFile (h, FILE_MAP_WRITE, 0, 0, 0);
if (!cygheap)
api_fatal ("Couldn't allocate shared memory for cygwin heap, %E");
CloseHandle (h);
}
cygheap_max = cygheap + 1;
}