aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/cygheap.cc23
2 files changed, 23 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d47a7a7..7b7a9dc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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
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