This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Large processes fix

On Fri, Dec 31, 2004 at 11:28:15PM +0200, Eizenberg Ariel wrote:
>The original code in open_shared() runs as follows:
>Hope this clears it up.

Since the situation which triggers this invalidates the assumption
that the shared memory will be loaded in the same place in cygwin children,
it doesn't seem like there is any reason to use offsets after the failure.

So, something like the below would be less intrusive, I think.

Does this have the desired effect?


RCS file: /cvs/src/src/winsup/cygwin/,v
retrieving revision 1.84
diff -u -p -r1.84
---	3 Dec 2004 02:00:37 -0000	1.84
+++	1 Jan 2005 17:20:03 -0000
@@ -79,7 +79,7 @@ open_shared (const char *name, int n, HA
   void *shared;
   void *addr;
-  if (!wincap.needs_memory_protection ())
+  if (!wincap.needs_memory_protection () && offsets[0])
     addr = NULL;
@@ -116,12 +116,13 @@ open_shared (const char *name, int n, HA
       if (wincap.is_winnt ())
 	system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
+      offsets[0] = NULL;
   if (!shared)
     api_fatal ("MapViewOfFileEx '%s'(%p), %E.  Terminating.", name, shared_h);
-  if (m == SH_CYGWIN_SHARED && wincap.needs_memory_protection ())
+  if (m == SH_CYGWIN_SHARED && offsets[0] && wincap.needs_memory_protection ())
       unsigned delta = (char *) shared - offsets[0];
       offsets[0] = (char *) shared;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]