Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Mar 2001 18:33:53 -0700 (MST)
From:      Nate Williams <nate@yogotech.com>
To:        "Jeroen C. van Gelderen" <jeroen@vangelderen.org>
Cc:        Nate Williams <nate@yogotech.com>, FreeBSD Java <freebsd-java@FreeBSD.ORG>, Ari Suutari <ari@suutari.iki.fi>
Subject:   Re: Are syscall wrappers needed in JNI?
Message-ID:  <15006.63617.145790.5705@nomad.yogotech.com>
In-Reply-To: <3A9EF71F.A13189C6@vangelderen.org>
References:  <3A9AE85F.C6F06D96@vangelderen.org> <15002.60084.89087.467979@nomad.yogotech.com> <3A9EF71F.A13189C6@vangelderen.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Sorry for the delay in response but I've been busy hacking
> JNI :-(
> 
> Nate Williams wrote:
> > 
> > > So... I'm hoping that someone here has the magic knowledge in
> > > his/her brain... How does one properly use libc from within Java?
> > 
> > You can't in the current JDK1.1 stuff.  
> 
> I take it you meant to say JDK 1.2 beta as well? Or not? 

Since it also uses green threads, then it has the same limitations.

> Ari Suutari mailed me this reply (fwd with permission):
> 
> ------------------------------------------------
> Jeroen C. van Gelderen wrote:
> > I had a look at the FreeBSD CommAPI implementation. It seems 
> > to just mark it's filedescriptors as O_NONBLOCK and uses the 
> > plain system calls from then on. 
> > 
> 
>     I think this is because the .so is dynamically loaded into
>     JVM, which contains necessary wrappers, ie. "poll" isn't
>     the actual system call in this environment, it is the wrapper
>     that does all kinds of things before doing "poll". 
> 
>     This is the case at least for JDK 1.2.2. I did some research
>     on this one because the FreeBSD comm api used "select", for
>     which there wasn't a wrapper at some time (don't know about
>     the current situation). This caused the JVM to hang in weird
>     way sometimes. I replaced "select" with "poll", which had
>     a wrapper inside JVM and everything worked very well after that.
> 
>         Ari S.
> ------------------------------------------------
> 
> Your statement and his seem to contradict each other. Could
> either of you clarify matters here?

Interesting enough, from my memory, select is wrapped in the JVM, but
poll was not.  My suspicion is that the wrapping was causing problems,
and his modification to use 'poll' caused it to call the native poll,
instead of the wrapped 'select' version, which can cause problems.


Nate


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15006.63617.145790.5705>