Date: Thu, 2 May 2002 15:22:38 +0200 (CEST) From: Stephan Thesing <thesing@cs.uni-sb.de> To: freebsd-java@freebsd.org Subject: JDK1.3.1p6 and NetBSD-current Message-ID: <200205021322.g42DMcr12437@gargoyle.cs.uni-sb.de>
next in thread | raw e-mail | index | archive | help
Hello,
having played with patchset 6 on NetBSD/i386-1.5ZC (current), I have observed
some problems:
- compile problems (i.e. gethostent() is not defined on NetBSD), as already
observed by someone else on this list
- signal related: one place uses dlopen() and dlsym() for "sigprocmask"
which, unfortunately is the old compatibility one for NetBSD <=1.3, using
the wrong type arg:
some time ago the sigset_t in NetBSD changed from one `int' to an array
of four `int's.
For compatibility, the sigprocmask() still uses one `int', while the new
function is __sigprocmask14() (the include files do some renaming so that
newly compiled programs use __sigprocmask14() automatically)
- `appletviewer' or the Java Plugin for mozilla dumps core by receiving an
SIGFPE.
This problem is caused by the different layout of the `sigjmp_buf' argument
passed to the sigsetjmp/siglongjmp() calls (which are involved in thread
switching in green_threads, I guess). The Floating point unit control word
is stored in the sigjmp_buf at slot BSD_FPU_MASK (defined to `7' in
j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h) and
restored from there.
In the same sigjmp_buf the signal mask of the process is stored at offset 6,
but as pointed out before, this mask is four ints long in NetBSD>=1.4, thus
overwrites the FPU control word, causing `interesting' effects when it is
later restored, resulting in FPE signals being sent later.
This only seems to happen if several threads are running, so it does not
occur during normal use of java or the bootstrap via the freshly build
javac.
Attached is a patch that seems to work on NetBSD/i386-current so far that I can
use the java plugin and appletviewer.
It replaces the argument to dlsym() for sigprocmask(), replaces the
gethostent() et.al. calls to
appropriate replacements and changes the place where the FPU control word is
saved/restored from in the sigsetjmp/siglongjmp() frame to 11 (which seems to
be free at the moment).
No attempt was made to make this work for NetBSD<1.4, which seems to be no
longer actively supported anyhow.
Could someone please look at this and comment on its usefulness?
Best regards....
Stephan
------------------- SNIP -----------------------
--- j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h.orig Mon Apr 29 13:47:05 2002
+++ j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h Thu May 2 11:40:31 2002
@@ -27,9 +27,15 @@
#endif
} lj_ucontext_t;
+
#if defined(i386)
# if defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD__ < 4))
-#define BSD_FPU_MASK 7
+#if defined(__NetBSD__)
+/* NetBSD uses slot 7 for its extended signal mask */
+#define BSD_FPU_MASK 11
+#else
+#define BSD_FPU_MASK 7
+#endif
#define BSD_SIGNAL_MASK 6
# else
#define BSD_FPU_MASK 6
@@ -102,6 +108,7 @@
__asm__ ("frstor %0"::"m" (*fdata)); \
} \
}
+
#elif defined(alpha)
#define getcontext(lj_ucontextp) { \
sigsetjmp((lj_ucontextp)->jmpbuf, -1); \
--- j2sdk1.3.1/src/solaris/hpi/green_threads/src/signals.c.orig Mon Apr 29 13:47:05 2002
+++ j2sdk1.3.1/src/solaris/hpi/green_threads/src/signals.c Thu May 2 10:02:37 2002
@@ -596,7 +596,13 @@
#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");
+ func = (fn_t *)dlsym(dlMain,
+#if defined(__NetBSD__)
+ "__sigprocmask14"
+#else
+ "sigprocmask"
+#endif
+ );
#else
dlMain = dlopen("/lib/libc.so.6", RTLD_LAZY);
func = (fn_t *)dlsym(dlMain, "__sigprocmask");
--- j2sdk1.3.1/src/solaris/native/java/net/InetAddressImpl.c.orig Mon Apr 29 13:47:05 2002
+++ j2sdk1.3.1/src/solaris/native/java/net/InetAddressImpl.c Tue Apr 23 01:14:21 2002
@@ -368,7 +368,13 @@
HOST_R_RETURN
gethostent_r(struct hostent *hptr, HOST_R_ARGS) {
- struct hostent *he = gethostent();
+ struct hostent *he =
+#if defined(__NetBSD__)
+_gethtent()
+#else
+gethostent()
+#endif
+;
HOST_R_ERRNO;
@@ -385,7 +391,11 @@
sethostent_r(int stay_open)
#endif
{
+#if defined(__NetBSD__)
+ _sethtent(stay_open);
+#else
sethostent(stay_open);
+#endif
#ifdef HOST_R_SET_RESULT
return (HOST_R_SET_RESULT);
#endif
----------------------- SNIP ------------------------
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?200205021322.g42DMcr12437>
