This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Improvements to fork handling (4/5)
- From: Ryan Johnson <ryan dot johnson at cs dot utoronto dot ca>
- To: cygwin-patches at cygwin dot com
- Date: Wed, 11 May 2011 14:32:51 -0400
- Subject: Improvements to fork handling (4/5)
Hi all,
This patch rewrites dll_list::load_after fork. The new version
eliminates reserve_upto() and release_upto(), which were expensive (the
process repeats for each dll) and buggy (release_upto could free
allocations reserve_upto did not make). Instead, the effect of
reserve_upto is achieved by recursively attempting to load each dll in
its proper place and calling reserve_at before retrying; each
reservation's location is kept on the stack throughout and release_at
calls are made only when the recursion unwinds after all dlls have
loaded. Further, the code (again exploiting image introspection from
patch #2) pre-reserves all space needed by each DLL_LOAD before starting
the normal load process. This allows us to detect early whether Windows
clobbered something from the start (allowing retry) and also ensures
that the needed address space is not clobbered by later calls to
reserve_at or by dlls allocating resources.
Ryan
Attachment:
fork-dll-load.patch
Description: Text document
Attachment:
fork-dll-load.changes
Description: Text document