Losing features of JVM_Open, e.g. CLOEXEC

Martin Buchholz martinrb at google.com
Thu Oct 30 17:15:10 UTC 2014


Here's the state of the world:
- the Unix designers made a design mistake that file descriptors are
inherited by subprocesses by default.
- all library code (almost all the code in the universe, including the
JDK) needs to coexist with foreign code that might fork+exec at any
time
- to ensure that file descriptors don't leak into subprocesses,
(almost) all library calls that create file descriptors must ensure
that they have the close-on-exec bit set.  (yes, this has been broken
for a long time)
- this is difficult enough that all creations of file descriptors must
be wrapped using some kind of common infrastructure
- JVM_Open (aka os::open) was terrible infrastructure (essentially
undocumented) but at least it *was* infrastructure
- we need openjdk-level or at least core-libraries-level native
infrastructure, a place to put things like os::open and readFully.  A
project-wide commitment



More information about the core-libs-dev mailing list