jdk14 patches
Greg Lewis
glewis at eyesbeyond.com
Wed Oct 8 17:50:30 PDT 2003
Hi all,
Attached is a set of patches for the jdk14 port. These should fix a number
of well known bugs, including getting things compiling on -CURRENT.
Assuming:
1) Someone confirms these do actually get things compiling on -CURRENT.
2) Patchset 4 doesn't come out (*).
3) They get a positive review from Alexey (or no response).
Then I'll commit the patches in a weeks time.
If not, then hopefully collecting them together like this will at least
help some people. I am currently running these changes at work, FWIW.
Alexey, please take a look at these. The changes to the Makefile and
installation of preferences files are independent of patchset 4.
* I don't know when patchset 4 is coming out. Please direct questions
about this to Alexey.
--
Greg Lewis Email : glewis at eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : glewis at FreeBSD.org
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /var/fcvs/ports/java/jdk14/Makefile,v
retrieving revision 1.60
diff -u -r1.60 Makefile
--- Makefile 1 Oct 2003 16:14:20 -0000 1.60
+++ Makefile 8 Oct 2003 21:49:45 -0000
@@ -43,6 +43,7 @@
# workaround to handle both 'zip' and 'tar.gz' distfiles
USE_ZIP= YES
+USE_REINPLACE= YES
EXTRACT_ONLY= ${SRCFILE}
ONLY_FOR_ARCHS= i386
@@ -74,6 +75,13 @@
PLIST_SUB+= DEBUG:=""
.endif
+PTHREAD_FILES= hotspot/build/bsd/makefiles/gcc.make \
+ hotspot/build/bsd/makefiles/vm.make \
+ j2se/make/common/Defs.gmk \
+ j2se/make/common/Program.gmk \
+ j2se/make/common/Defs-bsd.gmk \
+ j2se/make/java/hpi/native/Makefile
+
.include <bsd.port.pre.mk>
# Check for JDK sources
@@ -150,6 +158,11 @@
${CHMOD} -R u+w * && \
${PATCH} -p0 < ${WRKDIR}/jdk14.patches
+post-patch:
+ @for file in ${PTHREAD_FILES}; do \
+ ${REINPLACE_CMD} -e "s:-pthread:${PTHREAD_LIBS}:g; s:-lc_r:${PTHREAD_LIBS}:g" ${WRKDIR}/$${file}; \
+ done
+
.if !defined(NATIVE_BOOTSTRAP)
ECHO_MSG=echo
pre-build:
@@ -217,5 +230,8 @@
post-install:
@${LOCALBASE}/bin/registervm "${PREFIX}/jdk${JDK_VERSION}/bin/java # FREEBSD-JDK${JDK_VERSION}"
+ @${SED} -e "s:%%JRE_HOME%%:${PREFIX}/jdk${JDK_VERSION}/jre:g" \
+ < ${FILESDIR}/pkg-install.in > ${PKGINSTALL}
+ @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /var/fcvs/ports/java/jdk14/pkg-plist,v
retrieving revision 1.16
diff -u -r1.16 pkg-plist
--- pkg-plist 8 May 2003 23:53:06 -0000 1.16
+++ pkg-plist 1 Oct 2003 14:36:44 -0000
@@ -461,6 +461,8 @@
jdk%%JDK_VERSION%%/include/jni.h
jdk%%JDK_VERSION%%/include/jvmdi.h
jdk%%JDK_VERSION%%/include/jvmpi.h
+jdk%%JDK_VERSION%%/jre/.systemPrefs/.system.lock
+jdk%%JDK_VERSION%%/jre/.systemPrefs/.systemRootModFile
jdk%%JDK_VERSION%%/jre/CHANGES
jdk%%JDK_VERSION%%/jre/COPYRIGHT
jdk%%JDK_VERSION%%/jre/LICENSE
@@ -1157,6 +1159,7 @@
@dirrm jdk%%JDK_VERSION%%/jre/lib/zi/Pacific
@dirrm jdk%%JDK_VERSION%%/jre/lib/zi
@dirrm jdk%%JDK_VERSION%%/jre/lib
+ at dirrm jdk%%JDK_VERSION%%/jre/.systemPrefs
@dirrm jdk%%JDK_VERSION%%/jre
@dirrm jdk%%JDK_VERSION%%/lib
@dirrm jdk%%JDK_VERSION%%/man/man1
Index: files/patch-DefaultSelectorProvider.java
===================================================================
RCS file: files/patch-DefaultSelectorProvider.java
diff -N files/patch-DefaultSelectorProvider.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-DefaultSelectorProvider.java 8 Oct 2003 19:02:21 -0000
@@ -0,0 +1,31 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java 8 Jun 2002 04:46:35 -0000 1.1
++++ ../../j2se/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java 7 Jun 2003 07:44:32 -0000 1.2
+@@ -27,14 +27,20 @@
+ * Returns the default SelectorProvider.
+ */
+ public static SelectorProvider create() {
+- PrivilegedAction pa
+- = new GetPropertyAction("os.version");
++ PrivilegedAction pa = new GetPropertyAction("os.name");
+ String result = (String) AccessController.doPrivileged(pa);
+- String[] numbers = result.split("\\.", 0);
+- if (numbers[1].compareTo("7") < 0)
++ if (result.equals("SunOS")) {
++ pa = new GetPropertyAction("os.version");
++ result = (String) AccessController.doPrivileged(pa);
++ String[] numbers = result.split("\\.", 0);
++ if (numbers[1].compareTo("7") < 0)
++ return new sun.nio.ch.PollSelectorProvider();
++ else
++ return new sun.nio.ch.DevPollSelectorProvider();
++ }
++ else {
+ return new sun.nio.ch.PollSelectorProvider();
+- else
+- return new sun.nio.ch.DevPollSelectorProvider();
++ }
+ }
+
+ }
Index: files/patch-FileChannelImpl.c
===================================================================
RCS file: files/patch-FileChannelImpl.c
diff -N files/patch-FileChannelImpl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-FileChannelImpl.c 8 Oct 2003 19:05:00 -0000
@@ -0,0 +1,55 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c 6 Jun 2003 15:31:42 -0000 1.5
++++ ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c 8 Sep 2003 08:19:29 -0000 1.7
+@@ -170,6 +170,8 @@
+ #include <sys/sendfile.h>
+ #elif defined(_BSD_SOURCE)
+ #include <sys/socket.h>
++#include <errno.h>
++#include <stdlib.h>
+ #endif
+
+ JNIEXPORT int JNICALL
+@@ -188,13 +190,38 @@
+ #elif defined(__FreeBSD__)
+ /*
+ * XXXBSD: make sure that we're returning what java class may understand
++ *
++ * XXXBSD: I'd prefer to have it implemented with sendfile(), but since
++ * FreeBSD's sendfile() is only supposed to be used in file->socket
++ * schema we need to provide some kind of fall-back operation, if
++ * sendfile() failed with ENOTSOCK error only.
+ */
++ void *buf;
+ off_t offset = (off_t)position;
+- int n = sendfile(dstFD, srcFD, offset, (size_t)count, NULL, NULL, 0);
+- if (n < 0) {
++ int r, w;
++
++ buf = malloc(4096);
++ if (buf == NULL) {
++ JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
++ return (0);
++ }
++
++ while ((r = pread(srcFD, buf, 4096, offset)) > 0) {
++ w = write(dstFD, buf, r);
++ if (w == -1)
++ break;
++ offset += w;
++ }
++ free(buf);
++
++ /*
++ * XXXBSD: there're potential problems with NBIO fd's. Check it.
++ */
++ if (r == -1 || w == -1) {
++ fprintf(stderr, "%d %d %d %d %d\n", srcFD, dstFD, r, w, errno);
+ JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+ }
+- return n;
++ return (offset - (off_t)position);
+ #else
+ return IOS_UNSUPPORTED;
+ #endif
Index: files/patch-Inet6AddressImpl.c
===================================================================
RCS file: files/patch-Inet6AddressImpl.c
diff -N files/patch-Inet6AddressImpl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-Inet6AddressImpl.c 8 Oct 2003 19:01:07 -0000
@@ -0,0 +1,21 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/native/java/net/Inet6AddressImpl.c.orig Sat Aug 23 23:44:36 2003
++++ ../../j2se/src/solaris/native/java/net/Inet6AddressImpl.c Sat Aug 23 23:45:08 2003
+@@ -14,6 +14,7 @@
+ #include <strings.h>
+ #include <stdlib.h>
+ #include <ctype.h>
++#include <unistd.h>
+
+ #include "jvm.h"
+ #include "jni_util.h"
+@@ -26,7 +27,7 @@
+ #define NI_MAXHOST 1025
+ #endif
+
+-#ifndef __GLIBC__
++#if !defined(__GLIBC__) && !defined(__FreeBSD__)
+ /* gethostname() is in libc.so but I can't find a header file for it */
+ extern int gethostname(char *buf, int buf_len);
+ #endif
Index: files/patch-jni.cpp
===================================================================
RCS file: files/patch-jni.cpp
diff -N files/patch-jni.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-jni.cpp 8 Oct 2003 19:01:25 -0000
@@ -0,0 +1,108 @@
+$FreeBSD$
+
+--- ../../hotspot/src/share/vm/prims/jni.cpp 23 Jan 2003 12:48:13 -0000 1.1.1.2
++++ ../../hotspot/src/share/vm/prims/jni.cpp 6 Aug 2003 20:56:29 -0000 1.2
+@@ -902,7 +902,7 @@
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap, CHECK_0); \
+ va_end(args); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -912,7 +912,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -922,7 +922,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherArray ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_VIRTUAL, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END
+
+ // the runtime type of subword integral basic types is integer
+@@ -976,7 +976,7 @@
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_0); \
+ va_end(args); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -986,7 +986,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -996,7 +996,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherArray ap(methodID, args); \
+ jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END
+
+ // the runtime type of subword integral basic types is integer
+@@ -1051,7 +1051,7 @@
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
+ va_end(args); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -1061,7 +1061,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherVaArg ap(methodID, args); \
+ jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END \
+ \
+ \
+@@ -1071,7 +1071,7 @@
+ JavaValue jvalue(Tag); \
+ JNI_ArgumentPusherArray ap(methodID, args); \
+ jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
+- return (ResultType)(jvalue._value.##unionType); \
++ return (ResultType)(jvalue._value.unionType); \
+ JNI_END
+
+ // the runtime type of subword integral basic types is integer
+@@ -1204,7 +1204,7 @@
+ /* and creates a ResetNoHandleMark. */ \
+ if (jvmdi::enabled()) { \
+ jvalue field_value; \
+- field_value.##unionType = value; \
++ field_value.unionType = value; \
+ o = jvmdi::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
+ } \
+ o->Fieldname##_field_put(offset, value); \
+@@ -1333,7 +1333,7 @@
+ /* jni_SetField_probe() assumes that is okay to create handles. */ \
+ if (jvmdi::enabled()) { \
+ jvalue field_value; \
+- field_value.##unionType = value; \
++ field_value.unionType = value; \
+ jvmdi::jni_SetField_probe(thread, NULL, NULL, id->holder(), fieldID, true, SigType, (jvalue *)&field_value); \
+ } \
+ id->holder()-> Fieldname##_field_put (id->offset(), value); \
+Index: hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp
+===================================================================
+RCS file: /var/jcvs/javasrc_1_4_scsl/hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp,v
+retrieving revision 1.1.1.2
+retrieving revision 1.2
Index: files/patch-jvmdiInterfaceSupport.hpp
===================================================================
RCS file: files/patch-jvmdiInterfaceSupport.hpp
diff -N files/patch-jvmdiInterfaceSupport.hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-jvmdiInterfaceSupport.hpp 8 Oct 2003 19:01:48 -0000
@@ -0,0 +1,18 @@
+$FreeBSD$
+
+--- ../../hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp 23 Jan 2003 12:48:15 -0000 1.1.1.2
++++ ../../hotspot/src/share/vm/runtime/jvmdiInterfaceSupport.hpp 6 Aug 2003 20:55:55 -0000 1.2
+@@ -24,7 +24,7 @@
+ result_type JNICALL methodName signature { \
+ JavaThread* thread = (JavaThread*) ThreadLocalStorage::thread(); \
+ TransitionClass __tiv(thread); \
+- __ENTRY(result_type, methodName##signature, thread) \
++ __ENTRY(result_type, methodName signature, thread) \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ debug_only(const char* const _jvmdi_methodName_ = #methodName;) \
+ debug_only(bool _trace_ = trace; ); \
+Index: hotspot/src/share/vm/runtime/mutexLocker.cpp
+===================================================================
+RCS file: /var/jcvs/javasrc_1_4_scsl/hotspot/src/share/vm/runtime/mutexLocker.cpp,v
+retrieving revision 1.1.1.2
+retrieving revision 1.2
Index: files/patch-mutexLocker.cpp
===================================================================
RCS file: files/patch-mutexLocker.cpp
diff -N files/patch-mutexLocker.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-mutexLocker.cpp 8 Oct 2003 19:01:58 -0000
@@ -0,0 +1,13 @@
+$FreeBSD$
+
+--- ../../hotspot/src/share/vm/runtime/mutexLocker.cpp 23 Jan 2003 12:48:15 -0000 1.1.1.2
++++ ../../hotspot/src/share/vm/runtime/mutexLocker.cpp 6 Aug 2003 20:55:15 -0000 1.2
+@@ -95,7 +95,7 @@
+ #endif
+
+ #define def(var, type, pri, vm_block) \
+- var = new type(Mutex::##pri, #var, vm_block)
++ var = new type(Mutex::pri, #var, vm_block)
+
+ void mutex_init() {
+ def(Event_lock , Mutex , event, true ); // allow to lock in VM
Index: files/patch-nio::Makefile
===================================================================
RCS file: files/patch-nio::Makefile
diff -N files/patch-nio::Makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-nio::Makefile 8 Oct 2003 19:02:11 -0000
@@ -0,0 +1,13 @@
+$FreeBSD$
+
+--- ../../j2se/make/java/nio/Makefile 15 Feb 2003 14:45:49 -0000 1.4
++++ ../../j2se/make/java/nio/Makefile 24 Aug 2003 05:37:04 -0000
+@@ -131,7 +131,7 @@
+
+ # XXXBSD: really need it for BSD ?
+ ifeq ($(PLATFORM), bsd)
+-OTHER_CFLAGS += -Werror
++#OTHER_CFLAGS += -Werror
+ OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH)$(SUFFIX) -ljava$(SUFFIX) -lnet$(SUFFIX)
+ endif
+
Index: files/pkg-install.in
===================================================================
RCS file: files/pkg-install.in
diff -N files/pkg-install.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/pkg-install.in 1 Oct 2003 14:31:17 -0000
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# System preference location
+PREFS_LOCATION=%%JRE_HOME%%
+
+# Set up system preferences during post install
+if [ "$2" = "POST-INSTALL" ]; then
+ if [ ! -d "${PREFS_LOCATION}/.systemPrefs" ] ; then
+ mkdir -m 755 "${PREFS_LOCATION}/.systemPrefs"
+ fi
+ if [ ! -f "${PREFS_LOCATION}/.systemPrefs/.system.lock" ] ; then
+ touch "${PREFS_LOCATION}/.systemPrefs/.system.lock"
+ chmod 644 "${PREFS_LOCATION}/.systemPrefs/.system.lock"
+ fi
+ if [ ! -f "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile" ] ; then
+ touch "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile"
+ chmod 644 "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile"
+ fi
+fi
More information about the freebsd-java
mailing list