* dll_init.cc (dll_list::find_by_modname): New function to search the dll list

for a module name only (no path).
(dll_list::alloc): Initialize newly-added members of struct dll.
(dll_list::append): New function to factor out the append operation
(used by dll_list::topsort).
(dll_list::populate_deps): New function to identify dll dependencies.
(dll_list::topsort): New function to sort the dll list topologically by
dependencies.
(dll_list::topsort_visit): New helper function for the above.
* dll_init.h (dll::ndeps): New class member.
(dll::deps): Ditto.
(dll::modname): Ditto.
(dll_list::find_by_modname): New function related to topsort.
(dll_list::populate_all_deps): Ditto.
(dll_list::populate_deps): Ditto.
(dll_list::topsort): Ditto.
(dll_list::topsort_visit): Ditto.
(dll_list::append): Ditto.
(pefile): New struct allowing simple introspection of dll images.
* fork.cc (fork): Topologically sort the dll list before forking
* child_info.h (CURR_CHILD_INFO_MAGIC): Refresh.
(child_info::refresh_cygheap): New function.
* spawn.cc (spawn_guts): Call refresh_cygheap before creating a new process to
ensure that cygheap_max is up-to-date.
* fork.cc (frok::parent): Ditto.
This commit is contained in:
Christopher Faylor
2011-05-30 06:52:12 +00:00
parent 3a88e09e7f
commit 977ad5434c
6 changed files with 207 additions and 35 deletions

View File

@@ -397,6 +397,7 @@ frok::parent (volatile char * volatile stack_here)
/* Remove impersonation */
cygheap->user.deimpersonate ();
fix_impersonation = true;
ch.refresh_cygheap ();
while (1)
{
@@ -601,7 +602,6 @@ extern "C" int
fork ()
{
frok grouped;
/* No cygheap allocation beyond this point. */
debug_printf ("entering");
grouped.load_dlls = 0;
@@ -635,6 +635,11 @@ fork ()
return -1;
}
/* Put the dll list in topological dependency ordering, in
hopes that the child will have a better shot at loading dlls
properly if it only has to deal with one at a time. */
dlls.topsort ();
ischild = !!setjmp (grouped.ch.jmp);
volatile char * volatile esp;