aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2015-07-03 02:17:12 +0800
committerjkim <jkim@FreeBSD.org>2015-07-03 02:17:12 +0800
commit28bdbd7e87d615daae6b37a182e4447e44137c46 (patch)
treeac072eb103a9265ad59f58a53e067f84db698d3d /java
parent4928e65909c09c6da05d7395e5e1cb146d8fcfac (diff)
downloadfreebsd-ports-gnome-28bdbd7e87d615daae6b37a182e4447e44137c46.tar.gz
freebsd-ports-gnome-28bdbd7e87d615daae6b37a182e4447e44137c46.tar.zst
freebsd-ports-gnome-28bdbd7e87d615daae6b37a182e4447e44137c46.zip
- Fix broken preprocessor directives.
- Use sysctl(3) instead of procfs(5) when we need executable path from PID. MFH: 2015Q3
Diffstat (limited to 'java')
-rw-r--r--java/openjdk8/Makefile2
-rw-r--r--java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp31
-rw-r--r--java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp63
-rw-r--r--java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c53
4 files changed, 148 insertions, 1 deletions
diff --git a/java/openjdk8/Makefile b/java/openjdk8/Makefile
index 29013e7a1c80..a04a0b8f1f50 100644
--- a/java/openjdk8/Makefile
+++ b/java/openjdk8/Makefile
@@ -2,7 +2,7 @@
PORTNAME= openjdk
PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//}
-PORTREVISION= 1
+PORTREVISION= 2
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-hotspot-src-os-bsd-vm-os_bsd.cpp b/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp
new file mode 100644
index 000000000000..0e4656cbdedd
--- /dev/null
+++ b/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp
@@ -0,0 +1,31 @@
+--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig
++++ hotspot/src/os/bsd/vm/os_bsd.cpp
+@@ -1234,14 +1234,14 @@
+ pid_t os::Bsd::gettid() {
+ int retval = -1;
+
+-#ifdef __APPLE__ //XNU kernel
++#if defined(__APPLE__) //XNU kernel
+ // despite the fact mach port is actually not a thread id use it
+ // instead of syscall(SYS_thread_selfid) as it certainly fits to u4
+ retval = ::pthread_mach_thread_np(::pthread_self());
+ guarantee(retval != 0, "just checking");
+ return retval;
+
+-#elifdef __FreeBSD__
++#elif defined(__FreeBSD__)
+ #if __FreeBSD_version > 900030
+ return ::pthread_getthreadid_np();
+ #else
+@@ -1249,9 +1249,9 @@
+ thr_self(&tid);
+ return (pid_t)tid;
+ #endif
+-#elifdef __OpenBSD__
++#elif defined(__OpenBSD__)
+ retval = syscall(SYS_getthrid);
+-#elifdef __NetBSD__
++#elif defined(__NetBSD__)
+ retval = (pid_t) _lwp_self();
+ #endif
+
diff --git a/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp b/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp
new file mode 100644
index 000000000000..cb383ca48f37
--- /dev/null
+++ b/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp
@@ -0,0 +1,63 @@
+--- hotspot/src/os/bsd/vm/vmError_bsd.cpp.orig
++++ hotspot/src/os/bsd/vm/vmError_bsd.cpp
+@@ -33,30 +33,50 @@
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ #include <signal.h>
++#ifdef __FreeBSD__
++#include <limits.h>
++#include <sys/sysctl.h>
++#endif
++
++#define GDB_CMD "gdb"
++
++static void set_debugger(char *buf, int buflen) {
++ int pid = os::current_process_id();
++#ifdef __FreeBSD__
++ char cmd[PATH_MAX+1];
++ int name[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid };
++ size_t len = sizeof(cmd);
++ if (sysctl(name, 4, cmd, &len, NULL, 0) == 0 && len > 0) {
++ cmd[len] = '\0';
++ jio_snprintf(buf, buflen, "%s %s %d", GDB_CMD, cmd, pid);
++ } else
++#endif
++ jio_snprintf(buf, buflen, "%s /proc/%d/file %d", GDB_CMD, pid, pid);
++}
+
+ void VMError::show_message_box(char *buf, int buflen) {
+ bool yes;
+ do {
+- error_string(buf, buflen);
+- int len = (int)strlen(buf);
++ intx tid = os::current_thread_id();
++ set_debugger(buf, buflen);
++ int len = (int)strlen(buf) + 1;
++ char *msg = &buf[len];
++ error_string(msg, buflen - len);
++ len += (int)strlen(msg);
+ char *p = &buf[len];
+
+ jio_snprintf(p, buflen - len,
+ "\n\n"
+ "Do you want to debug the problem?\n\n"
+- "To debug, run 'gdb /proc/%d/file %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
+- "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
++ "To debug, run '%s'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
++ "Enter 'yes' to launch " GDB_CMD " automatically (PATH must include " GDB_CMD ")\n"
+ "Otherwise, press RETURN to abort...",
+- os::current_process_id(), os::current_process_id(),
+- os::current_thread_id(), os::current_thread_id());
++ buf, tid, tid);
+
+- yes = os::message_box("Unexpected Error", buf);
++ yes = os::message_box("Unexpected Error", msg);
+
+ if (yes) {
+ // yes, user asked VM to launch debugger
+- jio_snprintf(buf, buflen, "gdb /proc/%d/file %d",
+- os::current_process_id(), os::current_process_id());
+-
+ os::fork_and_exec(buf);
+ yes = false;
+ }
diff --git a/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c b/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c
new file mode 100644
index 000000000000..c858a0c14fc1
--- /dev/null
+++ b/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c
@@ -0,0 +1,53 @@
+--- jdk/src/solaris/bin/java_md_solinux.c.orig
++++ jdk/src/solaris/bin/java_md_solinux.c
+@@ -35,6 +35,9 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <sys/types.h>
++#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#endif
+ #include "manifest_info.h"
+ #include "version_comp.h"
+
+@@ -925,7 +928,7 @@
+ * onwards the filename returned in DL_info structure from dladdr is
+ * an absolute pathname so technically realpath isn't required.
+ * On Linux we read the executable name from /proc/self/exe.
+- * On FreeBSD we read the executable name from /proc/curproc/file.
++ * On FreeBSD, we get the executable name via sysctl(3).
+ * As a fallback, and for platforms other than Solaris, Linux, and
+ * FreeBSD, we use FindExecName to compute the executable name.
+ */
+@@ -954,13 +957,9 @@
+ }
+ }
+ }
+-#elif defined(__linux__) || defined(__FreeBSD__)
++#elif defined(__linux__)
+ {
+-#if defined(__FreeBSD__)
+- const char* self = "/proc/curproc/file";
+-#else
+ const char* self = "/proc/self/exe";
+-#endif
+ char buf[PATH_MAX+1];
+ int len = readlink(self, buf, PATH_MAX);
+ if (len >= 0) {
+@@ -968,6 +967,16 @@
+ exec_path = JLI_StringDup(buf);
+ }
+ }
++#elif defined(__FreeBSD__)
++ {
++ char buf[PATH_MAX+1];
++ int name[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++ size_t len = sizeof(buf);
++ if (sysctl(name, 4, buf, &len, NULL, 0) == 0 && len > 0) {
++ buf[len] = '\0';
++ exec_path = JLI_StringDup(buf);
++ }
++ }
+ #else /* !__solaris__ && !__linux__ && !__FreeBSD__ */
+ {
+ /* Not implemented */