From owner-freebsd-java Thu Mar 1 23:24: 3 2001 Delivered-To: freebsd-java@freebsd.org Received: from osku.suutari.iki.fi (osku.syncrontech.com [213.28.98.4]) by hub.freebsd.org (Postfix) with ESMTP id 1D9D837B718 for ; Thu, 1 Mar 2001 23:23:59 -0800 (PST) (envelope-from ari@suutari.iki.fi) Received: from coffee (adsl-nat.syncrontech.com [213.28.98.3]) by osku.suutari.iki.fi (8.9.3/8.9.3) with SMTP id JAA23121; Fri, 2 Mar 2001 09:23:44 +0200 (EET) (envelope-from ari@suutari.iki.fi) Message-ID: <05bd01c0a2e9$a1b669e0$0e05a8c0@coffee> From: "Ari Suutari" To: "Nate Williams" , "Jeroen C. van Gelderen" Cc: "Nate Williams" , "FreeBSD Java" References: <3A9AE85F.C6F06D96@vangelderen.org><15002.60084.89087.467979@nomad.yogotech.com><3A9EF71F.A13189C6@vangelderen.org> <15006.63617.145790.5705@nomad.yogotech.com> Subject: Re: Are syscall wrappers needed in JNI? Date: Fri, 2 Mar 2001 09:23:07 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, > Interesting enough, from my memory, select is wrapped in the JVM, but > poll was not. I was talking about jdk1.2.2. For the version I was starting to use commapi, select was not wrapped, but poll was. You can even find discussion about this on freebsd-java mailing list, I think. If I remember correctly the reason for select not being wrapped was that JVM was internally using poll and thus patchers assumed that there was not need to wrap select. > 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 I think you are wrong on this one. The select was not wrapped and it caused all threads on JVM to block when it was called by JNI code. However, poll was wrapped and changing the JNI code to call it resulted in working system. I even verified this with debugger, the poll call from JNI code really ends up into wrapped poll version inside JVM. It works this way because the loader, when loading .so containing commapi JNI code, looks for function called "poll" and it finds it from JVM main code so it is resolved to that instead of the standard version in libc. What this means that it *IS* safe to call methods that are wrapped by JVM. Anyone can verify all this easily with gdb. Ari S. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message