hg: bsd-port/bsd-port/jdk: . Merge all of the special *BSD version of closeDescriptors() with the
kurt at intricatesoftware.com
Tue Nov 11 20:33:53 PST 2008
With respect to the issue OpenBSD has, it is very operating system
specific. We still have a userland library that simulates threading
using various tricks like making all file descriptors non-blocking
and emulating blocking behavior.
The workaround for OpenBSD in closeDescriptors is only applicable
to OpenBSD since the rest of the supported OS's have kernel supported
threads. What it does is prevent the child process from resetting the
file descriptors back to blocking directly before execv's another
program. If the child resets them to blocking, the next time the
parent does a read on them it will block and wedge the userland
thread library (think deadlock).
I would not suggest this work-around be generally applicable based
on the presence of _thread_sys_closefrom since it only applies to
OpenBSD's particular issues.
Work continues on kernel based thread for OpenBSD and I'm looking
forward to when any OS specific work-arounds can be removed.
Martin Buchholz wrote:
> Looks good to me,
> but I am tempted to try very hard to avoid constructs of the form
> #ifdef OS_FLAVOR
> At startup time (in a static init method),
> you can determine whether /proc/self/fd is a directory and
> contains only entries that look like smallish integers.
> Similarly for /dev/fd.
> If we can assume dlopen/dlsym,
> we could dynamically check for the presence of
> And if all else fails, we can simply loop up to some maximum.
> One way to only use readdir64 if available is to use readdir64
> only if _LFS64_LARGEFILE is defined to 1, else fall back to readdir.
> On Tue, Nov 11, 2008 at 19:08, <glewis at eyesbeyond.com> wrote:
>> Changeset: c20eddeb23e3
>> Author: glewis at misty.eyesbeyond.com
>> Date: 2008-11-11 19:07 -0800
>> URL: http://hg.openjdk.java.net/bsd-port/bsd-port/jdk/rev/c20eddeb23e3
>> . Merge all of the special *BSD version of closeDescriptors() with the
>> Linux and Solaris, save for OpenBSD. OpenBSD had its own version of
>> closeDescriptors() and based on the comments in the code the issues
>> that lead to it being separate still apply.
>> This fixes exec'ing external programmes on FreeBSD and Mac OS X at
>> least and reduces the number of variants of this function from 3 to 2.
>> This is different from submitted version in that it keeps the OpenBSD
>> version. It would be good to remove that, but we need someone to test
>> on OpenBSD before doing so.
>> Submitted by: Michael Franz <mvfranz at gmail.com>
>> ! src/solaris/native/java/lang/UNIXProcess_md.c
More information about the bsd-port-dev