diff options
author | Greg Lewis <glewis@FreeBSD.org> | 2016-06-13 05:56:01 +0800 |
---|---|---|
committer | Greg Lewis <glewis@FreeBSD.org> | 2016-06-13 05:56:01 +0800 |
commit | d1729116380e332624cf9c473b98a5c3e9e00f12 (patch) | |
tree | 3b4be448935acf5e6636fcaca9cbfaa06c50c7bf /java/openjdk8 | |
parent | b13b21cc6ce59f2fc823a5a98e1ac860a14f1388 (diff) | |
download | freebsd-ports-gnome-d1729116380e332624cf9c473b98a5c3e9e00f12.tar.gz freebsd-ports-gnome-d1729116380e332624cf9c473b98a5c3e9e00f12.tar.zst freebsd-ports-gnome-d1729116380e332624cf9c473b98a5c3e9e00f12.zip |
. Use poll() rather than select() on BSD to avoid crashes during network
timeouts. This is forwarded ported from OpenJDK 7.
. Bump PORTREVISION for this fix.
PR: 210191
Submitted by: Andrew Smith <iamasmith.home@gmail.com>
Diffstat (limited to 'java/openjdk8')
-rw-r--r-- | java/openjdk8/Makefile | 1 | ||||
-rw-r--r-- | java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c | 85 |
2 files changed, 86 insertions, 0 deletions
diff --git a/java/openjdk8/Makefile b/java/openjdk8/Makefile index 8ab358b9b8a5..3ea1ebbd7e6d 100644 --- a/java/openjdk8/Makefile +++ b/java/openjdk8/Makefile @@ -2,6 +2,7 @@ PORTNAME= openjdk PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//} +PORTREVISION= 1 CATEGORIES= java devel MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \ https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \ diff --git a/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c b/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c new file mode 100644 index 000000000000..2fc1736ff280 --- /dev/null +++ b/java/openjdk8/files/patch-jdk-src-solaris-native-java-net-bsd_close.c @@ -0,0 +1,85 @@ +--- ./jdk/src/solaris/native/java/net/bsd_close.c Fri Apr 15 03:53:39 2016 +0100 ++++ ./jdk/src/solaris/native/java/net/bsd_close.c Sun May 01 21:26:40 2016 -0700 +@@ -345,6 +345,76 @@ + * signal other than our wakeup signal. + */ + int NET_Timeout(int s, long timeout) { ++/* ++ * On MacOS X, poll(2) is not working correctly, so a select(2) based ++ * implementation is preferred. See ++ * ++ * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7131399 ++ * ++ * However, on FreeBSD, the select(2) based implementation can cause ++ * crashes under load and poll(2) is preferred. See ++ * ++ * http://docs.freebsd.org/cgi/getmsg.cgi?fetch=215525+0+current/freebsd-java ++ * ++ * Other *BSD will use poll(2) for now, but please adjust as appropriate. ++ */ ++#ifndef __APPLE__ ++ long prevtime = 0, newtime; ++ struct timeval t; ++ fdEntry_t *fdEntry = getFdEntry(s); ++ ++ /* ++ * Check that fd hasn't been closed. ++ */ ++ if (fdEntry == NULL) { ++ errno = EBADF; ++ return -1; ++ } ++ ++ /* ++ * Pick up current time as may need to adjust timeout ++ */ ++ if (timeout > 0) { ++ gettimeofday(&t, NULL); ++ prevtime = t.tv_sec * 1000 + t.tv_usec / 1000; ++ } ++ ++ for(;;) { ++ struct pollfd pfd; ++ int rv; ++ threadEntry_t self; ++ ++ /* ++ * Poll the fd. If interrupted by our wakeup signal ++ * errno will be set to EBADF. ++ */ ++ pfd.fd = s; ++ pfd.events = POLLIN | POLLERR; ++ ++ startOp(fdEntry, &self); ++ rv = poll(&pfd, 1, timeout); ++ endOp(fdEntry, &self); ++ ++ /* ++ * If interrupted then adjust timeout. If timeout ++ * has expired return 0 (indicating timeout expired). ++ */ ++ if (rv < 0 && errno == EINTR) { ++ if (timeout > 0) { ++ gettimeofday(&t, NULL); ++ newtime = t.tv_sec * 1000 + t.tv_usec / 1000; ++ timeout -= newtime - prevtime; ++ if (timeout <= 0) { ++ return 0; ++ } ++ prevtime = newtime; ++ } ++ } else { ++ return rv; ++ } ++ ++ } ++#else + long prevtime = 0, newtime; + struct timeval t, *tp = &t; + fd_set fds; +@@ -431,4 +501,5 @@ + } + + } ++#endif + } |