diff options
author | Christopher Faylor <me@cgf.cx> | 2001-08-20 15:58:16 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-08-20 15:58:16 +0000 |
commit | b1d0b9073c7213ebb7d5c316a7b16c5feef811e5 (patch) | |
tree | e64d93a80e72d14e2194f8b09086c1119d3ecf94 /winsup/cygwin/cygheap.cc | |
parent | 538eaed7792638896c1b6566fbd498d6e3b6ca40 (diff) | |
download | newlib-b1d0b9073c7213ebb7d5c316a7b16c5feef811e5.zip newlib-b1d0b9073c7213ebb7d5c316a7b16c5feef811e5.tar.gz newlib-b1d0b9073c7213ebb7d5c316a7b16c5feef811e5.tar.bz2 |
* 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.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index f0efabf..4db829f 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 |