Review request for 5049299
Michael.McMahon at Sun.COM
Tue Jun 30 09:48:05 UTC 2009
Roland McGrath wrote:
>> But...posix_spawn doesn't give you any way to delete *all* file descriptors
>> and if you try to collect them before spawning, there is a race in a
>> multithreaded program.
> This is something you should never want to do. There is notoriously no
> good way to do it on some systems, where getdtablesize() can return
> RLIM_INFINITY and is not proper to use in a loop.
> Use FD_CLOEXEC when you open the descriptor in the first place.
We also need to chdir() before calling exec. And while some descriptors
already have FD_CLOEXEC set, it's not easy to guarantee this for all of
More information about the core-libs-dev