Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-08-20 19:58:16 +0400
committerChristopher Faylor <me@cgf.cx>2001-08-20 19:58:16 +0400
commitb1d0b9073c7213ebb7d5c316a7b16c5feef811e5 (patch)
treee64d93a80e72d14e2194f8b09086c1119d3ecf94 /winsup/cygwin/cygheap.cc
parent538eaed7792638896c1b6566fbd498d6e3b6ca40 (diff)
* cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index f0efabf2f..4db829fce 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -51,10 +51,25 @@ static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
inline static void
init_cheap ()
{
- cygheap = (init_cygheap *) VirtualAlloc (NULL, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
- if (!cygheap)
- api_fatal ("Couldn't reserve space for cygwin's heap, %E");
- cygheap_max = cygheap + 1;
+ 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;
}
void __stdcall