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>2011-05-30 20:09:29 +0400
committerChristopher Faylor <me@cgf.cx>2011-05-30 20:09:29 +0400
commit6642f7daa369ede921ce92eb819f01dc58b18b30 (patch)
tree21a627aeca43a0dcc93353e22668e71fc259e658 /winsup/cygwin/fork.cc
parent7123c8b1fd92c222613bb1b77ec67d69fbbb9791 (diff)
* dll_init.cc (reserve_upto): Remove.
(release_upto): Ditto. (dll_list::reserve_space): New function to reserve space needed by DLL_LOAD dlls early in the fork process. (dll_list::load_after_fork): Rewrite to use recursion to track reservations it makes while trying to make dlls land where they belong. (dll_list::load_after_fork_impl): New function used by load_after_fork. (dll_list::alloc): Initialize image base field. * dll_init.h (dll_list::prefered_base): New field. (dll_list::reserve_space): Declare new function. (dll_list::load_after_fork): Declare new function. * fork.cc (frok::child): call dll_list::reserve_space early, so we can retry if it fails.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r--winsup/cygwin/fork.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 1dbfebeed..78ba9707b 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -196,6 +196,12 @@ frok::child (volatile char * volatile here)
debug_printf ("child is running. pid %d, ppid %d, stack here %p",
myself->pid, myself->ppid, __builtin_frame_address (0));
+ /* NOTE: Logically this belongs in dll_list::load_after_fork, but by
+ doing it here, before the first sync_with_parent, we can exploit
+ the existing retry mechanism in hopes of getting a more favorable
+ address space layout next time. */
+ dlls.reserve_space ();
+
sync_with_parent ("after longjmp", true);
sigproc_printf ("hParent %p, load_dlls %d", hParent, load_dlls);