On 01/02/2013 17:45, Martin Buchholz wrote:
Yes, the current Process code deals fairly well with other people's
file descriptors that are not close-on-exec. But this code is
brittle, and long-term it would be cleaner for all open's in the jdk
to use O_CLOEXEC by default. We can probably never remove the Process
code that closes all file descriptors, because native user code could
also create file descriptors. In the near term, until all the
posixoid systems we (might) run on support O_CLOEXEC, it seems better
to leave this code as is. Or for general cleanliness, add O_CLOEXEC
by reflex whenever opening a file, without expectation that users will
ever see the benefit, unless they roll their own fork-exec.
There are lots of places in the JDK that open files or sockets, java.io
is just one. It may be better if we separate this from Dan's clean-up
and decide (as part of a separate piece of work) whether we want
everywhere to enable close-on-exec on its file descriptors or just leave
it to Process.exec as we do now.
-Alan