On Wed, Dec 21, 2011 at 08:42:58PM +0100, Martin Husemann wrote: > Ok, I will give it a closer look (but that will take a few days).
I finished this now, and indeed the result is a lot less intrusive. New patches/files at: ftp.netbsd.org:/pub/NetBSD/misc/martin/posix_spawn/newfiles_20120104.tar.gz ftp.netbsd.org:/pub/NetBSD/misc/martin/posix_spawn/posix_spawn_20120104.diff.gz The main change is the idea from yamt to avoid changing nearly all file descriptor functions. The child process now does a small lockstep dance with the parent (child in "spawn_return()", parent in "sys_posix_spawn()"). The parent handles all copyin beforehand and adds the result to the data passed to the child. The child then operates on the filedescriptor and scheduler/signal changing data, does the final part of the exec and signals the parent (passing back an error code if needed). The parent then cleans up and returns, while the child exits to userland for the first time. Further changes include a lot of locking fixes (especially in error branches), and the tests have been atf'fied, extended, fixed and integrated. Now I'm going to play with some benchmarks and post results here (also investigating vfork vs. the kernel implementation of posix_spawn). Martin
