Attached is what I ended up committing.
The only difference from the original patch is that I use the rlim_max
value instead of the flim_cur value. This will yield the same result
unless someone has been doing funny things with the limit. In which
case we should use the rlim_max value in case there are any vestigial
descriptors left open above the current limit.
Tested on x86_64-pc-linux-gnu (FC6) with no regressions found.
2007-03-22 David Daney <ddaney@avtrex.com>
PR libgcj/31228
* configure.ac: Add checks for getrlimit and sys/resource.h.
* include/posix.h (_Jv_platform_close_on_exec): Remove.
* include/config.h.in: Regenerate.
* configure: Regenerate.
* gnu/java/nio/channels/natFileChannelPosix.cc (open): Remove call to
_Jv_platform_close_on_exec;
* gnu/java/net/natPlainSocketImplPosix.cc (create): Likewise.
(accept): Likewise.
* gnu/java/net/natPlainDatagramSocketImplPosix.cc (create):Likewise.
* java/lang/natPosixProcess.cc: Include sys/resource.h.
(nativeSpawn): Close all file descriptors. Don't set FD_CLOEXEC on
pipes.