Date: Mon, 26 Feb 2001 19:35:59 -0400 From: "Jeroen C. van Gelderen" <jeroen@vangelderen.org> To: FreeBSD Java <freebsd-java@freebsd.org> Subject: Are syscall wrappers needed in JNI? Message-ID: <3A9AE85F.C6F06D96@vangelderen.org>
index | next in thread | raw e-mail
Hi,
I'm currently working on some native code libraries for our
very own FreeBSD JDK 1.2. Sun of course provides near zero
documentation for JNI and especially no documentation
regarding native code interaction with the threading model
so this is a less than pleasant experience...
My JNI library uses sockets and reads and writes on those
things. I'm left wondering how one actually properly calls
these libc functions in the face of the JVM threading model.
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.
The native code backing java.net.SocketImpl on the other hand
wraps all it's calls with an INTERRUPT_IO macro[1] which seems
to be neccessary for correct operation of the JVM threads.
None of the above two options seems to be documented but the
java.net approach is not really feasible without calling private
and undocumented JVM functions.
So... I'm hoping that someone here has the magic knowledge in
his/her brain... How does one properly use libc from within Java?
TIA,
Jeroen
[1] It is an indirect call to JVM_Listen which calls sysListen
which is defined as INTERRUPT_IO(int, listen(fd, count)) in
freebsd/hpi/green_threads/src/sys_api_td.c.
--
Jeroen C. van Gelderen - jeroen@vangelderen.org
"If I could save the Union without freeing any slave I would do it;
and if I could save it by freeing some and leaving others alone I
would also do that." -- Abraham Lincoln, August 22, 1862
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A9AE85F.C6F06D96>
