O_CLOEXEC, dup3 et al.; see http://udrepper.livejournal.com/20407.html. tschwinge once worked on this, posted patches to libc-alpha. This works needs to be resumed and finished.

Add tests from Linux kernel commit messages for t/dup3 et al.

Validate completeness according to https://wiki.freebsd.org/AtomicCloseOnExec or a similar list.

In http://lwn.net/Articles/417421/ an interesting point is made: you [may] want some file descriptor to still be open if 'exec' fails, but you don't want it to be open after the exec succeeds. I'm not sure whether our current O_CLOEXEC implementation adheres to that.