From owner-svn-ports-head@freebsd.org Thu Jul 2 18:17:14 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F384A993848; Thu, 2 Jul 2015 18:17:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3D861943; Thu, 2 Jul 2015 18:17:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t62IHDYr006953; Thu, 2 Jul 2015 18:17:13 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t62IHCIM006948; Thu, 2 Jul 2015 18:17:12 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201507021817.t62IHCIM006948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 2 Jul 2015 18:17:12 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r391177 - in head/java/openjdk8: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2015 18:17:14 -0000 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 + #include + #include ++#ifdef __FreeBSD__ ++#include ++#include ++#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 + #include + #include ++#ifdef __FreeBSD__ ++#include ++#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 */