Date: Sun, 25 Nov 2001 14:15:18 -0800 From: Joe Kelsey <joe@zircon.seattle.wa.us> To: freebsd-java@freebsd.org Subject: libjavaplugin_oji et al. Message-ID: <15361.28022.743975.723093@zircon.zircon.seattle.wa.us>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hello all!
I have gotten the new java plugin to load and start, and even print out
traces! However, it still doesn't work completely correctly.
Currently, it seems to get hung up in the polling between Java and X,
deep in the bowels of awt. I have no idea why this is occurring; anyone
with hints is welcome to throw in their two cents worth.
Here is my current set of patches, produced by diffing my running
version of j2sdk1.3.1 with the original from Sun. It does *not* work to
use this as the jdk131.patches in the port, due to some unknown
difficulty in the port patch process. Hopefully, Greg can work these
into his current patch set.
The changes I had to make are as follows:
Green Threads issues:
schedule.c hits a sysAssert when setting the sigprocmask. I added
FreeBSD to the $ifndef to comment out the call to sysAssert:
--- j2sdk1.3.1.orig/src/solaris/hpi/green_threads/src/schedule.c Sun May 6 05:27:20 2001
+++ j2sdk1.3.1/src/solaris/hpi/green_threads/src/schedule.c Thu Nov 22 12:50:08 2001
@@ -55,7 +55,7 @@
{
sigset_t old;
green_sigprocmask(SIG_SETMASK, &MACHDEP(tid)->signalMask, &old);
-#ifndef __linux__
+#if !(defined(__linux__) || defined(__NetBSD__) || defined __FreeBSD__)
sysAssert(memcmp(&MACHDEP(self)->signalMask, &old, sizeof old) == 0);
#endif
}
signals.c does not find the address of sigprocmask correctly, as
evidenced by my new comment:
--- j2sdk1.3.1.orig/src/solaris/hpi/green_threads/src/signals.c Sun May 6 05:27:20 2001
+++ j2sdk1.3.1/src/solaris/hpi/green_threads/src/signals.c Thu Nov 22 10:19:04 2001
@@ -594,12 +594,32 @@
if (func == NULL) {
#ifndef RTLD_NEXT
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
+ void *dlMain = dlopen("/usr/lib/libc.so", RTLD_LAZY);
+ func = (fn_t *)dlsym(dlMain, "sigprocmask");
+#else
dlMain = dlopen("/lib/libc.so.6", RTLD_LAZY);
func = (fn_t *)dlsym(dlMain, "__sigprocmask");
+#endif
#elif defined(__solaris__)
func = (fn_t *)dlsym(RTLD_NEXT, "_sigprocmask");
#else
func = (fn_t *)dlsym(RTLD_NEXT, "sigprocmask");
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
+ /*
+ * Something like 80% of all cases are handled by the RTLD_NEXT
+ * call to dlsym above. However, in java_vm (part of the plugin
+ * for Mozilla) libc happens to be loaded *before* libhpi, thus
+ * making the use of RTLD_NEXT fail. Therefore, if the call above
+ * fails, we try again using RTLD_DEFAULT.
+ *
+ * You may wonder why we don't just replace the RTLD_NEXT above
+ * with RTLD_DEFAULT. Well, at least on FreeBSD it doesn't work
+ * and causes normal things like javah to dump core.
+ */
+ if (func == NULL)
+ func = (fn_t *)dlsym(RTLD_DEFAULT, "sigprocmask");
+#endif
#endif
}
Many locations in the make hierarchy attempt to create shared libraries
with built-in references to libjvm. This does not work on FreeBSD, due
to problems with rtld-elf. The solution is to find every Makefile
associated with a shared library and insert the following fragment:
ifeq ($(PLATFORM),bsd)
JVMLIB =
endif
I have tracked down every Makefile and patched them. The patches are
interspersed with other bsd-related patches.
The result is that the plugin successfully loads and starts. However,
it does not get very far. I get the trace for the Plugin class
starting, and the comment about browser proxy configuration, but then a
lot of font properties not found before it seems to hang in the X
polling loop (at least that is where it ends up every time I interrupt
it!)
If anyone wants to help out, I would appreciate it. Bill, if you can
put together a patch set for native threads, I would love to try the
plugin on it and see if that solves my problems.
/Joe
[-- Attachment #2 --]
8m<