[PATCH] Large processes shared.cc fix

Eizenberg Ariel arielez@cs.huji.ac.il
Sat Jan 1 20:50:00 GMT 2005


This fixes the problem!

Thanks.

On Sat, 1 Jan 2005, Christopher Faylor wrote:

|  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?
|
|  cgf
|
|  Index: shared.cc
|  ===================================================================
|  RCS file: /cvs/src/src/winsup/cygwin/shared.cc,v
|  retrieving revision 1.84
|  diff -u -p -r1.84 shared.cc
|  --- shared.cc	3 Dec 2004 02:00:37 -0000	1.84
|  +++ shared.cc	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;
|     else
|       {
|  @@ -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);
|   #endif
|  +      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;
|
|



More information about the Cygwin-patches mailing list