Unable to start process using Runtime - Solved
Martin Buchholz
martinrb at google.com
Sun Oct 26 17:29:24 PDT 2008
Hmmmm.... I'm having second thoughts about whether it's worth the effort to
try to push bsd support into OpenJDK. That sort of effort would be easier with
a configure layer. The IcedTea team is moving in that direction.
The most portable approach to finding /proc/self/fd or /dev/fd is to do
the detection once at runtime.
In pseudocode:
final static String fdDir;
static {
if (new File("/proc/self/fd").isDirectory()) fdDir = "/proc/self/fd";
else if (new File("/dev/fd").isDirectory()) fdDir = "/dev/fd";
else fdDir = null;
}
And then use that value at runtime.
I definitely think getting rid of the heuristic GUESS_FINISHED
is worthwhile. Any failures with this heuristic will be rare,
unpredictable, and almost undebuggable for mortals.
And will only happen in production at 3am.
I'm surprised the BSDs don't all have readdir64 and friends.
Here's a case where configure would be useful.
Or, since a Solaris bug is being worked around,
one could make the use of readdir64 conditional
on whether compiling for solaris.
Martin
On Sun, Oct 26, 2008 at 16:52, Michael Franz <mvfranz at gmail.com> wrote:
> Martin,
>
> I think I have found a way we can use the closeDescriptor version that is
> used by Solaris and Linux for OS X (and probably the other BSD versions).
>
> OS X uses /dev/fd instead of /proc/self/fd. I think the other BSD version
> also use /dev/fd. This patch removes a few functions and hopefully makes
> the code cleaner.
>
> Let me know what you think and if it still works on your platform.
>
> Michael
>
> On Sun, Oct 26, 2008 at 8:58 AM, Michael Franz <mvfranz at gmail.com> wrote:
>>
>> Martin,
>>
>> I can take a deeper look at the problem and let you know what I come up
>> with.
>>
>> Michael
>>
>> On Sat, Oct 25, 2008 at 10:15 PM, Martin Buchholz <martinrb at google.com>
>> wrote:
>>>
>>> Michael,
>>>
>>> That looks like a fine patch to the BSD version of UNIXProcess_md.c,
>>> but my idea was to avoid having to have a BSD version of this file
>>> at all. The hope is eventually to have BSD support integrated into the
>>> standard OpenJDK sources, hopefully without special case code
>>> specifically for BSDs.
>>>
>>> Martin
>>>
>>> On Sat, Oct 25, 2008 at 13:55, Michael Franz <mvfranz at gmail.com> wrote:
>>> > Martin,
>>> >
>>> > Here are the changes that work for OS X.
>>> >
>>> > Michael
>>> >
>>> >
>>> > On Sat, Oct 25, 2008 at 12:47 PM, Martin Buchholz <martinrb at google.com>
>>> > wrote:
>>> >>
>>> >> Hi Michael,
>>> >>
>>> >> I am the author of the changes to UNIXProcess_md.c.
>>> >> File descriptor 3 is used to communicate any cause of failure
>>> >> back to the parent process.
>>> >>
>>> >> One might think that the openjdk7 code would work on
>>> >> BSD because if the standard way of opening /proc/self/fd,
>>> >> it falls back to closing all descriptors up to sysconf(_SC_OPEN_MAX),
>>> >> which one would think the BSDs would have implemented.
>>> >>
>>> >> In any case, even if the current jdk7 code doesn't work on BSD,
>>> >> it should be easy to create a small patch to it that would be
>>> >> portable to more Unix systems, that could be accepted upstream.
>>> >> I would be willing to review.
>>> >>
>>> >> Martin
>>> >
>>> >
>>
>
>
More information about the bsd-port-dev
mailing list