Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2015 18:17:12 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r391177 - in head/java/openjdk8: . files
Message-ID:  <201507021817.t62IHCIM006948@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Thu Jul  2 18:17:12 2015
New Revision: 391177
URL: https://svnweb.freebsd.org/changeset/ports/391177

Log:
  - Fix broken preprocessor directives.
  - Use sysctl(3) instead of procfs(5) when we need executable path from PID.
  
  MFH:		2015Q3

Added:
  head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp   (contents, props changed)
  head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp   (contents, props changed)
  head/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c   (contents, props changed)
Modified:
  head/java/openjdk8/Makefile

Modified: head/java/openjdk8/Makefile
==============================================================================
--- head/java/openjdk8/Makefile	Thu Jul  2 18:13:48 2015	(r391176)
+++ head/java/openjdk8/Makefile	Thu Jul  2 18:17:12 2015	(r391177)
@@ -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 \

Added: head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-os_bsd.cpp	Thu Jul  2 18:17:12 2015	(r391177)
@@ -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
+ 

Added: head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/openjdk8/files/patch-hotspot-src-os-bsd-vm-vmError_bsd.cpp	Thu Jul  2 18:17:12 2015	(r391177)
@@ -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;
+     }

Added: head/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/openjdk8/files/patch-jdk-src-solaris-bin-java_md_solinux.c	Thu Jul  2 18:17:12 2015	(r391177)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507021817.t62IHCIM006948>