changeset 1228:8ce80b4e9a73

2008-11-28 Gary Benson <gbenson@redhat.com> PR icedtea/265: * patches/icedtea-6728542-epoll.patch: New file. * Makefile.am (ICEDTEA_PATCHES): Apply the above. * HACKING: Document the above.
author Gary Benson <gbenson@redhat.com>
date Fri, 28 Nov 2008 10:44:51 -0500
parents 11c9f28891ca
children 0da756c744c9
files ChangeLog HACKING Makefile.am patches/icedtea-6728542-epoll.patch
diffstat 4 files changed, 101 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 28 09:41:20 2008 -0500
+++ b/ChangeLog	Fri Nov 28 10:44:51 2008 -0500
@@ -1,3 +1,10 @@
+2008-11-28  Gary Benson  <gbenson@redhat.com>
+
+	PR icedtea/265:
+	* patches/icedtea-6728542-epoll.patch: New file.
+	* Makefile.am (ICEDTEA_PATCHES): Apply the above.
+	* HACKING: Document the above.
+
 2008-11-28  Gary Benson  <gbenson@redhat.com>
 
 	PR icedtea/261:
--- a/HACKING	Fri Nov 28 09:41:20 2008 -0500
+++ b/HACKING	Fri Nov 28 10:44:51 2008 -0500
@@ -74,6 +74,7 @@
 * icedtea-display-mode-changer.patch: Add extra test class.
 * icedtea-testenv.patch: Provide public reachable machines for net/nio tests.
 * icedtea-samejvm-safe.patch: Add samejvmsafe dirs to TEST.ROOT.
+* icedtea-6728542-epoll.patch: Make EPoll work on non-x86 platforms. (PR265)
 
 The following patches are only applied to OpenJDK6 in IcedTea6:
 
@@ -95,7 +96,7 @@
   don't run sun.awt.X11.ToBin, explicitly pull in timezone data and rt.jar in javac
   calls, replace hexadecimal floating point literals with decimal variants in
   java.lang.Double and java.lang.Float.
-* icedtea-ecj-pr261.patch: Adds a couple of classes that are omitted from rt.jar.
+* icedtea-ecj-pr261.patch: Adds a couple of classes that are omitted from rt.jar. (PR261)
 
 The following patches are only applied for IcedTea builds using the zero-assembler:
 
--- a/Makefile.am	Fri Nov 28 09:41:20 2008 -0500
+++ b/Makefile.am	Fri Nov 28 10:44:51 2008 -0500
@@ -541,7 +541,8 @@
 	patches/icedtea-6761856-freetypescaler.patch \
 	patches/icedtea-display-mode-changer.patch \
 	patches/icedtea-testenv.patch \
-	patches/icedtea-samejvm-safe.patch
+	patches/icedtea-samejvm-safe.patch \
+	patches/icedtea-6728542-epoll.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6728542-epoll.patch	Fri Nov 28 10:44:51 2008 -0500
@@ -0,0 +1,90 @@
+
+# HG changeset patch
+# User alanb
+# Date 1219738992 -3600
+# Node ID 2a5377a6492e1738b4310c400d041a0f94071abf
+# Parent 872241636752db4f3c8401242a2dfe9f4ee38615
+6728542: (se) epoll based SelectorProvider should be portable to platforms other than x86 and x64
+Reviewed-by: sherman
+
+--- openjdk/jdk/make/java/nio/mapfile-linux	Mon Aug 25 08:11:08 2008 -0700
++++ openjdk/jdk/make/java/nio/mapfile-linux	Tue Aug 26 09:23:12 2008 +0100
+@@ -18,6 +18,8 @@ SUNWprivate_1.1 {
+ 		Java_sun_nio_ch_EPollArrayWrapper_fdLimit;
+ 		Java_sun_nio_ch_EPollArrayWrapper_init;
+ 		Java_sun_nio_ch_EPollArrayWrapper_interrupt;
++		Java_sun_nio_ch_EPollArrayWrapper_offsetofData;
++		Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent;
+                 Java_sun_nio_ch_FileChannelImpl_close0;
+                 Java_sun_nio_ch_FileChannelImpl_force0;
+                 Java_sun_nio_ch_FileChannelImpl_initIDs;
+--- openjdk/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Mon Aug 25 08:11:08 2008 -0700
++++ openjdk/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Tue Aug 26 09:23:12 2008 +0100
+@@ -69,11 +69,11 @@ class EPollArrayWrapper {
+     static final int EPOLL_CTL_MOD      = 3;
+ 
+     // Miscellaneous constants
+-    static final short SIZE_EPOLLEVENT  = 12;
+-    static final short EVENT_OFFSET     = 0;
+-    static final short DATA_OFFSET      = 4;
+-    static final short FD_OFFSET        = 4;
+-    static final int   NUM_EPOLLEVENTS  = Math.min(fdLimit(), 8192);
++    static final int SIZE_EPOLLEVENT  = sizeofEPollEvent();
++    static final int EVENT_OFFSET     = 0;
++    static final int DATA_OFFSET      = offsetofData();
++    static final int FD_OFFSET        = DATA_OFFSET;
++    static final int NUM_EPOLLEVENTS  = Math.min(fdLimit(), 8192);
+ 
+     // Base address of the native pollArray
+     private final long pollArrayAddress;
+@@ -280,6 +280,8 @@ class EPollArrayWrapper {
+     private native void epollCtl(int epfd, int opcode, int fd, int events);
+     private native int epollWait(long pollAddress, int numfds, long timeout,
+                                  int epfd) throws IOException;
++    private static native int sizeofEPollEvent();
++    private static native int offsetofData();
+     private static native int fdLimit();
+     private static native void interrupt(int fd);
+     private static native void init();
+--- openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	Mon Aug 25 08:11:08 2008 -0700
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	Tue Aug 26 09:23:12 2008 +0100
+@@ -48,10 +48,18 @@ typedef union epoll_data {
+     __uint64_t u64;
+ } epoll_data_t;
+ 
++
++/* x86-64 has same alignment as 32-bit */
++#ifdef __x86_64__
++#define EPOLL_PACKED __attribute__((packed))
++#else
++#define EPOLL_PACKED
++#endif
++
+ struct epoll_event {
+     __uint32_t events;  /* Epoll events */
+     epoll_data_t data;  /* User data variable */
+-} __attribute__ ((__packed__));
++} EPOLL_PACKED;
+ 
+ #ifdef  __cplusplus
+ }
+@@ -143,6 +151,18 @@ Java_sun_nio_ch_EPollArrayWrapper_fdLimi
+     return (jint)rlp.rlim_max;
+ }
+ 
++JNIEXPORT jint JNICALL
++Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent(JNIEnv* env, jclass this)
++{
++    return sizeof(struct epoll_event);
++}
++
++JNIEXPORT jint JNICALL
++Java_sun_nio_ch_EPollArrayWrapper_offsetofData(JNIEnv* env, jclass this)
++{
++    return offsetof(struct epoll_event, data);
++}
++
+ JNIEXPORT void JNICALL
+ Java_sun_nio_ch_EPollArrayWrapper_epollCtl(JNIEnv *env, jobject this, jint epfd,
+                                            jint opcode, jint fd, jint events)
+