看板 FB_bugs 關於我們 聯絡資訊
>Submitter-Id: current-users >Originator: Kurt Jaeger >Organization: - >Confidential: no >Synopsis: patch to java/openjdk6 to sucessful build >Severity: non-critical >Priority: low >Category: ports >Class: sw-bug >Release: FreeBSD 7.2-STABLE amd64 >Environment: System: FreeBSD f7.opsec.eu 7.2-STABLE FreeBSD 7.2-STABLE #0: Sun Aug 2 22:36:37 CEST 2009 pi@f7.opsec.eu:/usr/obj/usr/src/sys/REFSRV amd64 >Description: java/openjdk6 fails to build due to small glitches in some .gmk files. >How-To-Repeat: cd /usr/ports/java/openjdk6 make >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # files/patch-Release.gmk # files/patch-corba-Defs # files/patch-jdk-Defs # files/patch-set # echo x - files/patch-Release.gmk sed 's/^X//' >files/patch-Release.gmk << '258244522fe01f4cc6ec036b7230a0f1' X--- jdk/make/common/Release.gmk.orig 2009-04-24 09:33:54.000000000 +0200 X+++ jdk/make/common/Release.gmk 2009-08-30 16:20:22.000000000 +0200 X@@ -147,14 +147,13 @@ X tnameserv.1 \ X unpack200.1 X X-ifeq ($(ARCH_DATA_MODEL),32) X+ifeq ($(BUILD_DEPLOY), true) X JRE_MAN_PAGES += javaws.1 X endif X X JDK_MAN_PAGES = \ X $(JRE_MAN_PAGES) \ X appletviewer.1 \ X- apt.1 \ X extcheck.1 \ X idlj.1 \ X jar.1 \ X@@ -193,6 +192,11 @@ X JA_DIRNAME=ja_JP.$(JA_SOURCE_ENCODING) X endif # linux X X+ifeq ($(PLATFORM), bsd) X+ MANBASEDIRS=$(JDK_TOPDIR)/src/bsd/doc $(IMPORTDOCDIR) X+ MAN1SUBDIR = man X+endif X+ X define copy-man-pages X $(MKDIR) -p $1/man/man1 X for manbase in $(MANBASEDIRS:%=%/$(MAN1SUBDIR)) ; do \ X@@ -325,6 +329,12 @@ X SOURCE_DIRS += $(CLOSED_SRC)/share/classes X endif X X+ifeq ($(OS_VENDOR), OpenBSD) X+ FILES_FROM_ARG=-I X+else X+ FILES_FROM_ARG=-T X+endif X+ X X # X # Specific files and directories that will be filtered out from above areas. X@@ -625,7 +635,7 @@ X ($(CD) $(CLASSBINDIR) && \ X $(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \ X -o $@.temp $(ABS_LIBDIR)/classlist $(NOT_RT_JAR_LIST) . ) X- $(MV) $@.temp $@ X+ grep -v hotspot.log $@.temp > $@ X @($(CD) $(CLASSBINDIR) && $(java-vm-cleanup)) X X # Create the rt.jar file list & non-class files list X@@ -982,7 +992,7 @@ X @# generated by the more efficient solaris/windows method of copying files. X @# So for Linux, make use of the -T option (like Solaris' -I option) of X @# obtaining the list of files from a file. MKS tar has no such option. X- ifeq ($(PLATFORM), linux) X+ ifneq (,$(findstring $(PLATFORM), linux bsd)) X for d in $(SOURCE_DIRS); do \ X $(RM) $(ABS_TEMPDIR)/src-files.list; \ X ($(CD) $$d && \ X@@ -995,7 +1005,7 @@ X done ; \ X ) ; \ X if [ -f $(ABS_TEMPDIR)/src-files.list ] ; then \ X- ($(CD) $$d && $(TAR) cf - -T $(ABS_TEMPDIR)/src-files.list ) \ X+ ($(CD) $$d && $(TAR) cf - $(FILES_FROM_ARG) $(ABS_TEMPDIR)/src-files.list ) \ X | ($(CD) $(JDK_IMAGE_DIR)/src && $(TAR) xf -); \ X fi; \ X done 258244522fe01f4cc6ec036b7230a0f1 echo x - files/patch-corba-Defs sed 's/^X//' >files/patch-corba-Defs << 'e738a559a32839256cdadf2282b5e9de' X--- corba/make/common/shared/Defs-java.gmk.orig 2009-08-30 16:23:08.000000000 +0200 X+++ corba/make/common/shared/Defs-java.gmk 2009-08-30 16:23:44.000000000 +0200 X@@ -38,7 +38,7 @@ X # Suspect this may not be needed anymore. X JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline X else X- JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m X+ JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m X endif X X # e738a559a32839256cdadf2282b5e9de echo x - files/patch-jdk-Defs sed 's/^X//' >files/patch-jdk-Defs << '41e29aea459489bb4248ebb6fca98988' X--- jdk/make/common/shared/Defs-java.gmk.orig 2009-08-30 16:26:47.000000000 +0200 X+++ jdk/make/common/shared/Defs-java.gmk 2009-08-30 16:25:58.000000000 +0200 X@@ -42,7 +42,7 @@ X # Suspect this may not be needed anymore. X JAVA_MEM_FLAGS += -Xms$(MAX_VM_MEMORY)m -XX:-Inline X else X- JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m X+ JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m X endif X X # 41e29aea459489bb4248ebb6fca98988 echo x - files/patch-set sed 's/^X//' >files/patch-set << 'd493197f9e6abf9dfcc966db75771261' X/* X * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. X * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. X * X * This code is free software; you can redistribute it and/or modify it X * under the terms of the GNU General Public License version 2 only, as X * published by the Free Software Foundation. X * X * This code is distributed in the hope that it will be useful, but WITHOUT X * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or X * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License X * version 2 for more details (a copy is included in the LICENSE file that X * accompanied this code). X * X * You should have received a copy of the GNU General Public License version X * 2 along with this work; if not, write to the Free Software Foundation, X * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. X * X * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, X * CA 95054 USA or visit www.sun.com if you need additional information or X * have any questions. X * X */ Xdiff -uNpr ../orig/corba/make/common/Defs-bsd.gmk ./corba/make/common/Defs-bsd.gmk X--- ../orig/corba/make/common/Defs-bsd.gmk 2009-05-14 23:40:16.000000000 -0400 X+++ ./corba/make/common/Defs-bsd.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -40,18 +40,12 @@ X # Get shared JDK settings X include $(BUILDDIR)/common/shared/Defs.gmk X X-# Part of INCREMENTAL_BUILD mechanism. X-# Compiler emits things like: path/file.o: file.h X-# We want something like: relative_path/file.o relative_path/file.d: file.h X-CC_DEPEND = -MM X-CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' X- X ifndef PLATFORM_SRC X PLATFORM_SRC = $(TOPDIR)/src/solaris X endif # PLATFORM_SRC X X # platform specific include files X-PLATFORM_INCLUDE_NAME = $(PLATFORM) X+PLATFORM_INCLUDE_NAME = $(OS_NAME) X PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) X X # suffix used for make dependencies files. X@@ -94,6 +88,10 @@ endif X # as the default. X CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN X CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN X+ifeq ($(OS_VENDOR),Apple) X+ # 16-byte stack re-alignment on 32-bit Darwin X+ CFLAGS_REQUIRED_i586 += -mstackrealign X+endif X CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN X CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 X LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 X@@ -168,7 +166,7 @@ ifeq ($(FASTDEBUG), true) X CXXFLAGS_DBG += $(CC_LOWER_OPT) X endif X X-CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \ X+CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -D_ALLBSD_SOURCE $(VERSION_DEFINES) \ X -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT X X ifeq ($(ARCH_DATA_MODEL), 64) X@@ -178,33 +176,15 @@ endif X CPPFLAGS_OPT = X CPPFLAGS_DBG = -DDEBUG X X-ifdef LIBRARY X- # Libraries need to locate other libraries at runtime, and you can tell X- # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) X- # buried inside the .so. The $ORIGIN says to look relative to where X- # the library itself is and it can be followed with relative paths from X- # that. By default we always look in $ORIGIN, optionally we add relative X- # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. X- # On Bsd we add a flag -z origin, not sure if this is necessary, but X- # doesn't seem to hurt. X- # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. X- # Try: 'readelf -d lib*.so' to see these settings in a library. X- # X- LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN X- LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) X-endif X- X-EXTRA_LIBS += -lc X- X-LDFLAGS_DEFS_OPTION = -z defs X-LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) X- X # X # -L paths for finding and -ljava X # X-LDFLAGS_OPT = -Xlinker -O1 X LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) X+ X+ifneq ($(OS_VENDOR), Apple) X+LDFLAGS_OPT = -Xlinker -O1 X LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) X+endif X X # X # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always X@@ -235,13 +215,9 @@ endif X # X LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker X X-# X-# Support for Quantify. X-# X-ifdef QUANTIFY X-QUANTIFY_CMD = quantify X-QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes X-LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) X+# Darwin does not support linker map files. X+ifeq ($(OS_VENDOR), Apple) X+LDNOMAP=true X endif X X # X@@ -270,7 +246,9 @@ override HAVE_ALTZONE = false X override HAVE_FILIOH = false X override HAVE_GETHRTIME = false X override HAVE_GETHRVTIME = false X+ifeq ($(OS_VENDOR),Apple) X override HAVE_SIGIGNORE = true X+endif X override LEX_LIBRARY = -lfl X ifeq ($(STATIC_CXX),true) X override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic X@@ -281,13 +259,9 @@ override LIBPOSIX4 = X override LIBSOCKET = X override LIBTHREAD = X override MOOT_PRIORITIES = true X-override NO_INTERRUPTIBLE_IO = true X-override OPENWIN_HOME = /usr/X11R6 X-ifeq ($(ARCH), amd64) X-override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 X-else X+override NO_INTERRUPTIBLE_IO = false X+override OPENWIN_HOME = $(X11_PATH) X override OPENWIN_LIB = $(OPENWIN_HOME)/lib X-endif X override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER X override SUN_CMM_SUBDIR = X override THREADS_FLAG = native Xdiff -uNpr ../orig/corba/make/common/Defs-linux.gmk ./corba/make/common/Defs-linux.gmk X--- ../orig/corba/make/common/Defs-linux.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/Defs-linux.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -282,7 +282,7 @@ override LIBSOCKET = X override LIBTHREAD = X override MOOT_PRIORITIES = true X override NO_INTERRUPTIBLE_IO = true X-override OPENWIN_HOME = /usr/X11R6 X+override OPENWIN_HOME = $(X11_PATH) X ifeq ($(ARCH), amd64) X override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 X else Xdiff -uNpr ../orig/corba/make/common/Defs.gmk ./corba/make/common/Defs.gmk X--- ../orig/corba/make/common/Defs.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/Defs.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -53,6 +53,24 @@ endif X X _OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH) X X+ifneq ($(PLATFORM), windows) X+ ifdef ALT_X11_PATH X+ X11_PATH = $(ALT_X11_PATH) X+ else X+ X11_PATH = /usr/X11R6 X+ endif X+ X+ ifdef ALT_PACKAGE_PATH X+ PACKAGE_PATH = $(ALT_PACKAGE_PATH) X+ else X+ ifeq ($(PLATFORM), linux) X+ PACKAGE_PATH = /usr X+ else X+ PACKAGE_PATH = /usr/local X+ endif X+ endif X+endif X+ X # X # Get platform definitions X # X@@ -97,6 +115,9 @@ ifdef PROGRAM X LDLIBS_COMMON = -ldl X endif X X+ ifeq ($(PLATFORM), bsd) X+ LDLIBS_COMMON = -pthread X+ endif X endif # PROGRAM X X LDLIBS_COMMON += $(EXTRA_LIBS) Xdiff -uNpr ../orig/corba/make/common/Mapfile-vers.gmk ./corba/make/common/Mapfile-vers.gmk X--- ../orig/corba/make/common/Mapfile-vers.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/Mapfile-vers.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -77,7 +77,7 @@ endif X endif # PLATFORM X X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X X ifeq ($(VARIANT), OPT) X # OPT build MUST have a mapfile? Xdiff -uNpr ../orig/corba/make/common/shared/Compiler-gcc.gmk ./corba/make/common/shared/Compiler-gcc.gmk X--- ../orig/corba/make/common/shared/Compiler-gcc.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/shared/Compiler-gcc.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -99,6 +99,24 @@ ifeq ($(PLATFORM), linux) X X endif X X+ifeq ($(PLATFORM), bsd) X+ # Settings specific to BSD X+ CC = $(COMPILER_PATH)gcc X+ CPP = $(COMPILER_PATH)gcc -E X+ CXX = $(COMPILER_PATH)g++ X+ REQUIRED_CC_VER = 3.3 X+ REQUIRED_GCC_VER = 3.3.* X+ X+# Option used to create a shared library X+ifeq ($(OS_VENDOR), Apple) X+ SHARED_LIBRARY_FLAG = -dynamiclib X+else X+ SHARED_LIBRARY_FLAG = -shared X+endif X+ X+ SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 ) X+endif X+ X ifeq ($(PLATFORM), solaris) X X # Settings specific to Solaris Xdiff -uNpr ../orig/corba/make/common/shared/Compiler.gmk ./corba/make/common/shared/Compiler.gmk X--- ../orig/corba/make/common/shared/Compiler.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/shared/Compiler.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -42,6 +42,11 @@ ifeq ($(PLATFORM), linux) X override CC_VERSION = gcc X endif X X+# BSD uses GNU compilers by default X+ifeq ($(PLATFORM), bsd) X+ override CC_VERSION = gcc X+endif X+ X # Get the compiler specific settings X include $(BUILDDIR)/common/shared/Compiler-$(CC_VERSION).gmk X Xdiff -uNpr ../orig/corba/make/common/shared/Defs-bsd.gmk ./corba/make/common/shared/Defs-bsd.gmk X--- ../orig/corba/make/common/shared/Defs-bsd.gmk 2009-05-14 23:40:16.000000000 -0400 X+++ ./corba/make/common/shared/Defs-bsd.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -54,7 +54,7 @@ $(shell if [ "$1" != "" -a -d "$1" ]; th X endef X X # Location on system where jdk installs might be X-USRJDKINSTANCES_PATH =/opt/java X+USRJDKINSTANCES_PATH =$(PACKAGE_PATH) X X # UNIXCOMMAND_PATH: path to where the most common Unix commands are. X # NOTE: Must end with / so that it could be empty, allowing PATH usage. X@@ -107,7 +107,7 @@ endif X ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined" X DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH)) X else X- DEVTOOLS_PATH =/usr/bin/ X+ DEVTOOLS_PATH =$(PACKAGE_PATH)/bin/ X endif X X # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK. Xdiff -uNpr ../orig/corba/make/common/shared/Defs-utils.gmk ./corba/make/common/shared/Defs-utils.gmk X--- ../orig/corba/make/common/shared/Defs-utils.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/shared/Defs-utils.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -53,6 +53,13 @@ ifeq ($(PLATFORM),linux) X UTILS_DEVTOOL_PATH=$(USRBIN_PATH) X endif X X+ifeq ($(PLATFORM),bsd) X+ UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH) X+ UTILS_USR_BIN_PATH=$(USRBIN_PATH) X+ UTILS_CCS_BIN_PATH=$(USRBIN_PATH) X+ UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH) X+endif X+ X ifeq ($(PLATFORM),solaris) X UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH) X UTILS_USR_BIN_PATH=$(UNIXCOMMAND_PATH) X@@ -209,3 +216,32 @@ ifeq ($(PLATFORM),solaris) X ECHO = /usr/bin/echo X endif X X+# BSD specific X+ifeq ($(PLATFORM),bsd) X+ BASENAME = $(UTILS_USR_BIN_PATH)basename X+ EGREP = $(UTILS_USR_BIN_PATH)egrep X+ EXPR = $(UTILS_COMMAND_PATH)expr X+ FMT = $(UTILS_USR_BIN_PATH)fmt X+ GREP = $(UTILS_USR_BIN_PATH)grep X+ GUNZIP = $(UTILS_USR_BIN_PATH)gunzip X+ ID = $(UTILS_USR_BIN_PATH)id X+ MSGFMT = $(UTILS_DEVTOOL_PATH)msgfmt X+ SED = $(UTILS_USR_BIN_PATH)sed X+ SORT = $(UTILS_USR_BIN_PATH)sort X+ TEST = $(UTILS_COMMAND_PATH)test X+ TOUCH = $(UTILS_USR_BIN_PATH)touch X+ TRUE = $(UTILS_USR_BIN_PATH)true X+ UNAME = $(UTILS_USR_BIN_PATH)uname X+ # BSD OS_VENDOR specific X+ ifeq ($(OS_VENDOR), Apple) X+ NAWK = $(UTILS_USR_BIN_PATH)awk X+ UNZIPSFX = $(UTILS_USR_BIN_PATH)unzipsfx X+ ZIPEXE = $(UTILS_USR_BIN_PATH)zip X+ else X+ UNZIP = $(UTILS_DEVTOOL_PATH)unzip X+ endif X+ ifneq ($(OS_VENDOR), OpenBSD) X+ CPIO = $(UTILS_USR_BIN_PATH)cpio X+ TAR = $(UTILS_USR_BIN_PATH)tar X+ endif X+endif Xdiff -uNpr ../orig/corba/make/common/shared/Platform.gmk ./corba/make/common/shared/Platform.gmk X--- ../orig/corba/make/common/shared/Platform.gmk 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/common/shared/Platform.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -262,6 +262,76 @@ ifeq ($(SYSTEM_UNAME), Linux) X MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2) X endif X X+ifeq ($(SYSTEM_UNAME), FreeBSD) X+ PLATFORM = bsd X+ OS_NAME = freebsd X+ OS_VENDOR = FreeBSD X+ REQUIRED_OS_VERSION = 6.0 X+endif X+ X+ifeq ($(SYSTEM_UNAME), Darwin) X+ PLATFORM = bsd X+ OS_NAME = darwin X+ OS_VENDOR = Apple X+ REQUIRED_OS_VERSION = 8.0 X+endif X+ X+ifeq ($(SYSTEM_UNAME), NetBSD) X+ PLATFORM = bsd X+ OS_NAME = netbsd X+ OS_VENDOR = NetBSD X+ REQUIRED_OS_VERSION = 3.0 X+endif X+ X+ifeq ($(SYSTEM_UNAME), OpenBSD) X+ PLATFORM = bsd X+ OS_NAME = openbsd X+ OS_VENDOR = OpenBSD X+ REQUIRED_OS_VERSION = 4.2 X+endif X+ X+# Platform settings specific to BSD X+ifeq ($(PLATFORM), bsd) X+ OS_VERSION := $(shell uname -r) X+ # Arch and OS name/version X+ mach := $(shell uname -m) X+ archExpr = case "$(mach)" in \ X+ i[3-9]86) \ X+ echo i586 \ X+ ;; \ X+ *) \ X+ echo $(mach) \ X+ ;; \ X+ esac X+ ARCH := $(shell $(archExpr) ) X+ ARCH_FAMILY := $(ARCH) X+ X+ # i586 and sparc are 32 bit, amd64 and sparc64 are 64 X+ ifneq (,$(findstring $(ARCH), i586 sparc)) X+ ARCH_DATA_MODEL=32 X+ else X+ ARCH_DATA_MODEL=64 X+ endif X+ X+ # Need to maintain the jre/lib/i386 location for 32-bit Intel X+ ifeq ($(ARCH), i586) X+ LIBARCH = i386 X+ else X+ LIBARCH = $(ARCH) X+ endif X+ X+ # Value of Java os.arch property X+ ARCHPROP = $(LIBARCH) X+ X+ # Suffix for file bundles used in previous release X+ BUNDLE_FILE_SUFFIX=.tar.gz X+ # Minimum disk space needed as determined by running 'du -sk' on X+ # a fully built workspace. X+ REQUIRED_FREE_SPACE=1500000 X+ # How much RAM does this machine have: X+ MB_OF_MEMORY=$(shell sysctl -n hw.physmem | awk '{print int($$NF / 1048576); }' ) X+endif X+ X # Windows with and without CYGWIN will be slightly different X ifeq ($(SYSTEM_UNAME), Windows_NT) X PLATFORM = windows X@@ -373,7 +443,14 @@ endif X # build machines and adjustments will be made to prevent excessing X # system swapping during the build. X # If we don't know, assume 512. Subtract 128 from MB for VM MAX. X-# Don't set VM max over 1024-128=896. X+# Don't set VM max over 1024-128=896, except on OpenBSD where X+# 736 is the max. X+ifeq ($(OS_VENDOR), OpenBSD) X+ ABS_MAX_MEMORY := "736" X+else X+ ABS_MAX_MEMORY := "896" X+endif X+ X ifneq ($(MB_OF_MEMORY),) X LOW_MEMORY_MACHINE := $(shell \ X if [ $(MB_OF_MEMORY) -le 512 ] ; then \ X@@ -385,7 +462,7 @@ ifneq ($(MB_OF_MEMORY),) X if [ $(MB_OF_MEMORY) -le 1024 ] ; then \ X expr $(MB_OF_MEMORY) '-' 128 ; \ X else \ X- echo "896"; \ X+ echo $(ABS_MAX_MEMORY); \ X fi) X MIN_VM_MEMORY := $(shell \ X if [ $(MAX_VM_MEMORY) -le 128 ] ; then \ Xdiff -uNpr ../orig/corba/make/sun/corba/core/Makefile ./corba/make/sun/corba/core/Makefile X--- ../orig/corba/make/sun/corba/core/Makefile 2009-04-24 03:30:19.000000000 -0400 X+++ ./corba/make/sun/corba/core/Makefile 2009-05-14 23:41:33.000000000 -0400 X@@ -53,11 +53,19 @@ include $(CORBA_JMK_DIRECTORY)sun_corba. X ifdef STANDALONE_CORBA_WS X # FIXUP: What is this all about? X OTHER_LDFLAGS=-L$(BOOTDIR)/jre/lib/$(ARCH) -L$(BOOTDIR)/jre/lib/$(LIBARCH)/native_threads -ljvm X+ifeq ($(PLATFORM), bsd) X+OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(OS_NAME) X+else X OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(PLATFORM) X+endif X else X OTHER_LDLIBS=$(JVMLIB) X+ifeq ($(PLATFORM), bsd) X+OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(OS_NAME) X+else X OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(PLATFORM) X endif X+endif X X X FILES_c = ioser.c Xdiff -uNpr ../orig/hotspot/agent/make/Makefile ./hotspot/agent/make/Makefile X--- ../orig/hotspot/agent/make/Makefile 2009-04-24 03:30:48.000000000 -0400 X+++ ./hotspot/agent/make/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -52,6 +52,9 @@ sun.jvm.hotspot.code \ X sun.jvm.hotspot.compiler \ X sun.jvm.hotspot.debugger \ X sun.jvm.hotspot.debugger.amd64 \ X+sun.jvm.hotspot.debugger.bsd \ X+sun.jvm.hotspot.debugger.bsd.amd64 \ X+sun.jvm.hotspot.debugger.bsd.x86 \ X sun.jvm.hotspot.debugger.cdbg \ X sun.jvm.hotspot.debugger.cdbg.basic \ X sun.jvm.hotspot.debugger.cdbg.basic.amd64 \ X@@ -94,6 +97,9 @@ sun.jvm.hotspot.memory \ X sun.jvm.hotspot.oops \ X sun.jvm.hotspot.runtime \ X sun.jvm.hotspot.runtime.amd64 \ X+sun.jvm.hotspot.runtime.bsd \ X+sun.jvm.hotspot.runtime.bsd_amd64 \ X+sun.jvm.hotspot.runtime.bsd_x86 \ X sun.jvm.hotspot.runtime.ia64 \ X sun.jvm.hotspot.runtime.linux \ X sun.jvm.hotspot.runtime.linux_amd64 \ X@@ -143,6 +149,9 @@ sun/jvm/hotspot/code/*.java \ X sun/jvm/hotspot/compiler/*.java \ X sun/jvm/hotspot/debugger/*.java \ X sun/jvm/hotspot/debugger/amd64/*.java \ X+sun/jvm/hotspot/debugger/bsd/*.java \ X+sun/jvm/hotspot/debugger/bsd/amd64/*.java \ X+sun/jvm/hotspot/debugger/bsd/x86/*.java \ X sun/jvm/hotspot/debugger/cdbg/*.java \ X sun/jvm/hotspot/debugger/cdbg/basic/*.java \ X sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \ X@@ -178,6 +187,9 @@ sun/jvm/hotspot/memory/*.java \ X sun/jvm/hotspot/oops/*.java \ X sun/jvm/hotspot/runtime/*.java \ X sun/jvm/hotspot/runtime/amd64/*.java \ X+sun/jvm/hotspot/runtime/bsd/*.java \ X+sun/jvm/hotspot/runtime/bsd_amd64/*.java \ X+sun/jvm/hotspot/runtime/bsd_x86/*.java \ X sun/jvm/hotspot/runtime/ia64/*.java \ X sun/jvm/hotspot/runtime/linux/*.java \ X sun/jvm/hotspot/runtime/linux_amd64/*.java \ Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c ./hotspot/agent/src/os/bsd/BsdDebuggerLocal.c X--- ../orig/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/BsdDebuggerLocal.c 2009-05-14 23:41:34.000000000 -0400 X@@ -25,6 +25,7 @@ X * X */ X X+#include <stdlib.h> X #include <jni.h> X #include "libproc.h" X X@@ -76,7 +77,7 @@ JNIEXPORT void JNICALL Java_sun_jvm_hots X (JNIEnv *env, jclass cls) { X jclass listClass; X X- if (init_libproc(getenv("LIBSAPROC_DEBUG")) != true) { X+ if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != true) { X THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc"); X } X X@@ -278,7 +279,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jv X bufPtr = (*env)->GetByteArrayElements(env, array, &isCopy); X CHECK_EXCEPTION_(0); X X- err = ps_pdread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes); X+ err = ps_pread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes); X (*env)->ReleaseByteArrayElements(env, array, bufPtr, 0); X return (err == PS_OK)? array : 0; X } X@@ -286,11 +287,10 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jv X JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0 X (JNIEnv *env, jobject this_obj, jint lwp_id) { X X- struct user_regs_struct gregs; X+ struct reg gregs; X jboolean isCopy; X jlongArray array; X jlong *regs; X- int i; X X struct ps_prochandle* ph = get_proc_handle(env, this_obj); X if (get_lwp_regs(ph, lwp_id, &gregs) != true) { X@@ -320,26 +320,27 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv X #ifdef i386 X #define REG_INDEX(reg) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##reg X X- regs[REG_INDEX(GS)] = (uintptr_t) gregs.xgs; X- regs[REG_INDEX(FS)] = (uintptr_t) gregs.xfs; X- regs[REG_INDEX(ES)] = (uintptr_t) gregs.xes; X- regs[REG_INDEX(DS)] = (uintptr_t) gregs.xds; X- regs[REG_INDEX(EDI)] = (uintptr_t) gregs.edi; X- regs[REG_INDEX(ESI)] = (uintptr_t) gregs.esi; X- regs[REG_INDEX(FP)] = (uintptr_t) gregs.ebp; X- regs[REG_INDEX(SP)] = (uintptr_t) gregs.esp; X- regs[REG_INDEX(EBX)] = (uintptr_t) gregs.ebx; X- regs[REG_INDEX(EDX)] = (uintptr_t) gregs.edx; X- regs[REG_INDEX(ECX)] = (uintptr_t) gregs.ecx; X- regs[REG_INDEX(EAX)] = (uintptr_t) gregs.eax; X- regs[REG_INDEX(PC)] = (uintptr_t) gregs.eip; X- regs[REG_INDEX(CS)] = (uintptr_t) gregs.xcs; X- regs[REG_INDEX(SS)] = (uintptr_t) gregs.xss; X+ regs[REG_INDEX(GS)] = (uintptr_t) gregs.r_gs; X+ regs[REG_INDEX(FS)] = (uintptr_t) gregs.r_fs; X+ regs[REG_INDEX(ES)] = (uintptr_t) gregs.r_es; X+ regs[REG_INDEX(DS)] = (uintptr_t) gregs.r_ds; X+ regs[REG_INDEX(EDI)] = (uintptr_t) gregs.r_edi; X+ regs[REG_INDEX(ESI)] = (uintptr_t) gregs.r_esi; X+ regs[REG_INDEX(FP)] = (uintptr_t) gregs.r_ebp; X+ regs[REG_INDEX(SP)] = (uintptr_t) gregs.r_isp; X+ regs[REG_INDEX(EBX)] = (uintptr_t) gregs.r_ebx; X+ regs[REG_INDEX(EDX)] = (uintptr_t) gregs.r_edx; X+ regs[REG_INDEX(ECX)] = (uintptr_t) gregs.r_ecx; X+ regs[REG_INDEX(EAX)] = (uintptr_t) gregs.r_eax; X+ regs[REG_INDEX(PC)] = (uintptr_t) gregs.r_eip; X+ regs[REG_INDEX(CS)] = (uintptr_t) gregs.r_cs; X+ regs[REG_INDEX(SS)] = (uintptr_t) gregs.r_ss; X X #endif /* i386 */ X X #if ia64 X regs = (*env)->GetLongArrayElements(env, array, &isCopy); X+ int i; X for (i = 0; i < NPRGREG; i++ ) { X regs[i] = 0xDEADDEAD; X } X@@ -348,31 +349,31 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv X #ifdef amd64 X #define REG_INDEX(reg) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##reg X X- regs[REG_INDEX(R15)] = gregs.r15; X- regs[REG_INDEX(R14)] = gregs.r14; X- regs[REG_INDEX(R13)] = gregs.r13; X- regs[REG_INDEX(R12)] = gregs.r12; X- regs[REG_INDEX(RBP)] = gregs.rbp; X- regs[REG_INDEX(RBX)] = gregs.rbx; X- regs[REG_INDEX(R11)] = gregs.r11; X- regs[REG_INDEX(R10)] = gregs.r10; X- regs[REG_INDEX(R9)] = gregs.r9; X- regs[REG_INDEX(R8)] = gregs.r8; X- regs[REG_INDEX(RAX)] = gregs.rax; X- regs[REG_INDEX(RCX)] = gregs.rcx; X- regs[REG_INDEX(RDX)] = gregs.rdx; X- regs[REG_INDEX(RSI)] = gregs.rsi; X- regs[REG_INDEX(RDI)] = gregs.rdi; X- regs[REG_INDEX(RIP)] = gregs.rip; X- regs[REG_INDEX(CS)] = gregs.cs; X- regs[REG_INDEX(RSP)] = gregs.rsp; X- regs[REG_INDEX(SS)] = gregs.ss; X- regs[REG_INDEX(FSBASE)] = gregs.fs_base; X- regs[REG_INDEX(GSBASE)] = gregs.gs_base; X- regs[REG_INDEX(DS)] = gregs.ds; X- regs[REG_INDEX(ES)] = gregs.es; X- regs[REG_INDEX(FS)] = gregs.fs; X- regs[REG_INDEX(GS)] = gregs.gs; X+ regs[REG_INDEX(R15)] = gregs.r_r15; X+ regs[REG_INDEX(R14)] = gregs.r_r14; X+ regs[REG_INDEX(R13)] = gregs.r_r13; X+ regs[REG_INDEX(R12)] = gregs.r_r12; X+ regs[REG_INDEX(RBP)] = gregs.r_rbp; X+ regs[REG_INDEX(RBX)] = gregs.r_rbx; X+ regs[REG_INDEX(R11)] = gregs.r_r11; X+ regs[REG_INDEX(R10)] = gregs.r_r10; X+ regs[REG_INDEX(R9)] = gregs.r_r9; X+ regs[REG_INDEX(R8)] = gregs.r_r8; X+ regs[REG_INDEX(RAX)] = gregs.r_rax; X+ regs[REG_INDEX(RCX)] = gregs.r_rcx; X+ regs[REG_INDEX(RDX)] = gregs.r_rdx; X+ regs[REG_INDEX(RSI)] = gregs.r_rsi; X+ regs[REG_INDEX(RDI)] = gregs.r_rdi; X+ regs[REG_INDEX(RIP)] = gregs.r_rip; X+ regs[REG_INDEX(CS)] = gregs.r_cs; X+ regs[REG_INDEX(RSP)] = gregs.r_rsp; X+ regs[REG_INDEX(SS)] = gregs.r_ss; X+// regs[REG_INDEX(FSBASE)] = gregs.fs_base; X+// regs[REG_INDEX(GSBASE)] = gregs.gs_base; X+// regs[REG_INDEX(DS)] = gregs.ds; X+// regs[REG_INDEX(ES)] = gregs.es; X+// regs[REG_INDEX(FS)] = gregs.fs; X+// regs[REG_INDEX(GS)] = gregs.gs; X X #endif /* amd64 */ X Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/Makefile ./hotspot/agent/src/os/bsd/Makefile X--- ../orig/hotspot/agent/src/os/bsd/Makefile 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -22,7 +22,7 @@ X # X # X X-ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi ) X+ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "amd64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi ) X GCC = gcc X X JAVAH = ${JAVA_HOME}/bin/javah X@@ -32,15 +32,16 @@ SOURCES = salibelf.c \ X libproc_impl.c \ X ps_proc.c \ X ps_core.c \ X- BsdDebuggerLocal.c X+ hsearch_r.c \ X+ BsdDebuggerLocal.c X X-INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/bsd X+INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") X X OBJS = $(SOURCES:.c=.o) X X-LIBS = -lthread_db X+LIBS = -lutil -lthread_db X X-CFLAGS = -c -fPIC -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) X+CFLAGS = -c -fPIC -g -Wall -D_ALLBSD_SOURCE -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) X X LIBSA = $(ARCH)/libsaproc.so X X@@ -49,8 +50,7 @@ all: $(LIBSA) X BsdDebuggerLocal.o: BsdDebuggerLocal.c X $(JAVAH) -jni -classpath ../../../build/classes \ X sun.jvm.hotspot.debugger.x86.X86ThreadContext \ X- sun.jvm.hotspot.debugger.sparc.SPARCThreadContext \ X- sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext X+ sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext X $(GCC) $(CFLAGS) $< X X .c.obj: X@@ -64,14 +64,15 @@ $(LIBSA): $(OBJS) mapfile X if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi X $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS) X X-test.o: test.c X+test.o: $(LIBSA) test.c X $(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c X X test: test.o X $(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS) X X clean: X- rm -rf $(LIBSA) X- rm -rf $(OBJS) X- rmdir $(ARCH) X+ rm -f $(LIBSA) X+ rm -f $(OBJS) X+ rm -f test.o X+ -rmdir $(ARCH) X Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/elfmacros.h ./hotspot/agent/src/os/bsd/elfmacros.h X--- ../orig/hotspot/agent/src/os/bsd/elfmacros.h 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/elfmacros.h 2009-05-14 23:41:34.000000000 -0400 X@@ -28,16 +28,19 @@ X #ifndef _ELFMACROS_H_ X #define _ELFMACROS_H_ X X+#define ELF_NHDR Elf_Note X+ X #if defined(_LP64) X #define ELF_EHDR Elf64_Ehdr X #define ELF_SHDR Elf64_Shdr X #define ELF_PHDR Elf64_Phdr X #define ELF_SYM Elf64_Sym X-#define ELF_NHDR Elf64_Nhdr X #define ELF_DYN Elf64_Dyn X #define ELF_ADDR Elf64_Addr X X+#ifndef ELF_ST_TYPE X #define ELF_ST_TYPE ELF64_ST_TYPE X+#endif X X #else X X@@ -45,11 +48,12 @@ X #define ELF_SHDR Elf32_Shdr X #define ELF_PHDR Elf32_Phdr X #define ELF_SYM Elf32_Sym X-#define ELF_NHDR Elf32_Nhdr X #define ELF_DYN Elf32_Dyn X #define ELF_ADDR Elf32_Addr X X+#ifndef ELF_ST_TYPE X #define ELF_ST_TYPE ELF32_ST_TYPE X+#endif X X #endif X Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/hsearch_r.c ./hotspot/agent/src/os/bsd/hsearch_r.c X--- ../orig/hotspot/agent/src/os/bsd/hsearch_r.c 1969-12-31 19:00:00.000000000 -0500 X+++ ./hotspot/agent/src/os/bsd/hsearch_r.c 2009-05-14 23:41:34.000000000 -0400 X@@ -0,0 +1,217 @@ X+/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008 X+ Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#include <errno.h> X+#include <stdlib.h> X+#include <string.h> X+ X+#include <search.h> X+ X+#include "hsearch_r.h" X+ X+#define __set_errno(ERRNO) errno = ERRNO X+ X+/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 X+ [Knuth] The Art of Computer Programming, part 3 (6.4) */ X+ X+ X+/* The reentrant version has no static variables to maintain the state. X+ Instead the interface of all functions is extended to take an argument X+ which describes the current status. */ X+typedef struct _ENTRY X+{ X+ unsigned int used; X+ ENTRY entry; X+} X+_ENTRY; X+ X+ X+/* For the used double hash method the table size has to be a prime. To X+ correct the user given table size we need a prime test. This trivial X+ algorithm is adequate because X+ a) the code is (most probably) called a few times per program run and X+ b) the number is small because the table must fit in the core */ X+static int X+isprime (unsigned int number) X+{ X+ /* no even number will be passed */ X+ unsigned int div = 3; X+ X+ while (div * div < number && number % div != 0) X+ div += 2; X+ X+ return number % div != 0; X+} X+ X+ X+/* Before using the hash table we must allocate memory for it. X+ Test for an existing table are done. We allocate one element X+ more as the found prime number says. This is done for more effective X+ indexing as explained in the comment for the hsearch function. X+ The contents of the table is zeroed, especially the field used X+ becomes zero. */ X+int X+hcreate_r (size_t nel, struct hsearch_data *htab) X+{ X+ /* Test for correct arguments. */ X+ if (htab == NULL) X+ { X+ __set_errno (EINVAL); X+ return 0; X+ } X+ X+ /* There is still another table active. Return with error. */ X+ if (htab->table != NULL) X+ return 0; X+ X+ /* Change nel to the first prime number not smaller as nel. */ X+ nel |= 1; /* make odd */ X+ while (!isprime (nel)) X+ nel += 2; X+ X+ htab->size = nel; X+ htab->filled = 0; X+ X+ /* allocate memory and zero out */ X+ htab->table = (_ENTRY *) calloc (htab->size + 1, sizeof (_ENTRY)); X+ if (htab->table == NULL) X+ return 0; X+ X+ /* everything went alright */ X+ return 1; X+} X+ X+ X+/* After using the hash table it has to be destroyed. The used memory can X+ be freed and the local static variable can be marked as not used. */ X+void X+hdestroy_r (struct hsearch_data *htab) X+{ X+ /* Test for correct arguments. */ X+ if (htab == NULL) X+ { X+ __set_errno (EINVAL); X+ return; X+ } X+ X+ /* Free used memory. */ X+ free (htab->table); X+ X+ /* the sign for an existing table is an value != NULL in htable */ X+ htab->table = NULL; X+} X+ X+ X+/* This is the search function. It uses double hashing with open addressing. X+ The argument item.key has to be a pointer to an zero terminated, most X+ probably strings of chars. The function for generating a number of the X+ strings is simple but fast. It can be replaced by a more complex function X+ like ajw (see [Aho,Sethi,Ullman]) if the needs are shown. X+ X+ We use an trick to speed up the lookup. The table is created by hcreate X+ with one more element available. This enables us to use the index zero X+ special. This index will never be used because we store the first hash X+ index in the field used where zero means not used. Every other value X+ means used. The used field can be used as a first fast comparison for X+ equality of the stored and the parameter value. This helps to prevent X+ unnecessary expensive calls of strcmp. */ X+int X+hsearch_r (ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab) X+{ X+ unsigned int hval; X+ unsigned int count; X+ unsigned int len = strlen (item.key); X+ unsigned int idx; X+ X+ /* Compute an value for the given string. Perhaps use a better method. */ X+ hval = len; X+ count = len; X+ while (count-- > 0) X+ { X+ hval <<= 4; X+ hval += item.key[count]; X+ } X+ X+ /* First hash function: simply take the modul but prevent zero. */ X+ idx = hval % htab->size + 1; X+ X+ if (htab->table[idx].used) X+ { X+ /* Further action might be required according to the action value. */ X+ if (htab->table[idx].used == hval X+ && strcmp (item.key, htab->table[idx].entry.key) == 0) X+ { X+ *retval = &htab->table[idx].entry; X+ return 1; X+ } X+ X+ /* Second hash function, as suggested in [Knuth] */ X+ unsigned int hval2 = 1 + hval % (htab->size - 2); X+ unsigned int first_idx = idx; X+ X+ do X+ { X+ /* Because SIZE is prime this guarantees to step through all X+ available indeces. */ X+ if (idx <= hval2) X+ idx = htab->size + idx - hval2; X+ else X+ idx -= hval2; X+ X+ /* If we visited all entries leave the loop unsuccessfully. */ X+ if (idx == first_idx) X+ break; X+ X+ /* If entry is found use it. */ X+ if (htab->table[idx].used == hval X+ && strcmp (item.key, htab->table[idx].entry.key) == 0) X+ { X+ *retval = &htab->table[idx].entry; X+ return 1; X+ } X+ } X+ while (htab->table[idx].used); X+ } X+ X+ /* An empty bucket has been found. */ X+ if (action == ENTER) X+ { X+ /* If table is full and another entry should be entered return X+ with error. */ X+ if (htab->filled == htab->size) X+ { X+ __set_errno (ENOMEM); X+ *retval = NULL; X+ return 0; X+ } X+ X+ htab->table[idx].used = hval; X+ htab->table[idx].entry = item; X+ X+ ++htab->filled; X+ X+ *retval = &htab->table[idx].entry; X+ return 1; X+ } X+ X+ __set_errno (ESRCH); X+ *retval = NULL; X+ return 0; X+} Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/hsearch_r.h ./hotspot/agent/src/os/bsd/hsearch_r.h X--- ../orig/hotspot/agent/src/os/bsd/hsearch_r.h 1969-12-31 19:00:00.000000000 -0500 X+++ ./hotspot/agent/src/os/bsd/hsearch_r.h 2009-05-14 23:41:34.000000000 -0400 X@@ -0,0 +1,42 @@ X+/* Declarations for System V style searching functions. X+ Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. X+ This file is part of the GNU C Library. X+ X+ The GNU C Library is free software; you can redistribute it and/or X+ modify it under the terms of the GNU Lesser General Public X+ License as published by the Free Software Foundation; either X+ version 2.1 of the License, or (at your option) any later version. X+ X+ The GNU C Library is distributed in the hope that it will be useful, X+ but WITHOUT ANY WARRANTY; without even the implied warranty of X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU X+ Lesser General Public License for more details. X+ X+ You should have received a copy of the GNU Lesser General Public X+ License along with the GNU C Library; if not, write to the Free X+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA X+ 02111-1307 USA. */ X+ X+#ifndef _HSEARCH_R_H_ X+#define _HSEARCH_R_H_ X+ X+#include <search.h> X+ X+struct _ENTRY; X+ X+/* Data type for reentrant functions. */ X+struct hsearch_data X+ { X+ struct _ENTRY *table; X+ unsigned int size; X+ unsigned int filled; X+ }; X+ X+/* Reentrant versions which can handle multiple hashing tables at the X+ same time. */ X+extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval, X+ struct hsearch_data *__htab); X+extern int hcreate_r (size_t __nel, struct hsearch_data *__htab); X+extern void hdestroy_r (struct hsearch_data *__htab); X+ X+#endif /* _HSEARCH_R_H_ */ Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/libproc.h ./hotspot/agent/src/os/bsd/libproc.h X--- ../orig/hotspot/agent/src/os/bsd/libproc.h 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/libproc.h 2009-05-14 23:41:34.000000000 -0400 X@@ -30,7 +30,8 @@ X X #include <unistd.h> X #include <stdint.h> X-#include "proc_service.h" X+#include <machine/reg.h> X+#include <proc_service.h> X X #if defined(sparc) || defined(sparcv9) X /* X@@ -53,14 +54,11 @@ Please note that the bulk of the functio X adds Pgrab__ and some missing stuff. We hide the difference b/w live process and core X file by this interface. X X-1. pthread_id unique in both NPTL & BsdThreads. We store this in X-OSThread::_pthread_id in JVM code. X+1. pthread_id is unique. We store this in OSThread::_pthread_id in JVM code. X X-2. All threads see the same pid when they call getpid() under NPTL. X-Threads receive different pid under BsdThreads. We used to save the result of X-::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id X-was lost under NPTL. Now, we store the result of ::gettid() call in X-OSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is X+2. All threads see the same pid when they call getpid(). X+We used to save the result of ::getpid() call in OSThread::_thread_id. X+Because gettid returns actual pid of thread (lwp id), this is X unique again. We therefore use OSThread::_thread_id as unique identifier. X X 3. There is a unique LWP id under both thread libraries. libthread_db maps pthread_id X@@ -77,19 +75,6 @@ combination of ptrace and /proc calls. X X *************************************************************************************/ X X-#ifdef ia64 X-struct user_regs_struct { X-/* copied from user.h which doesn't define this in a struct */ X- X-#define IA64_REG_COUNT (EF_SIZE/8+32) /* integer and fp regs */ X-unsigned long regs[IA64_REG_COUNT]; /* integer and fp regs */ X-}; X-#endif X- X-#if defined(sparc) || defined(sparcv9) X-#define user_regs_struct pt_regs X-#endif X- X // This C bool type must be int for compatibility with Bsd calls and X // it would be a mistake to equivalence it to C++ bool on many platforms X X@@ -121,7 +106,7 @@ int get_num_threads(struct ps_prochandle X lwpid_t get_lwp_id(struct ps_prochandle* ph, int index); X X // get regs for a given lwp X-bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct user_regs_struct* regs); X+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct reg* regs); X X // get number of shared objects X int get_num_libs(struct ps_prochandle* ph); Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/libproc_impl.c ./hotspot/agent/src/os/bsd/libproc_impl.c X--- ../orig/hotspot/agent/src/os/bsd/libproc_impl.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/libproc_impl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -181,6 +181,9 @@ lib_info* add_lib_info_fd(struct ps_proc X if (newlib->symtab == NULL) { X print_debug("symbol table build failed for %s\n", newlib->name); X } X+ else { X+ print_debug("built symbol table for %s\n", newlib->name); X+ } X X // even if symbol table building fails, we add the lib_info. X // This is because we may need to read from the ELF file for core file X@@ -275,7 +278,7 @@ static int thread_db_callback(const td_t X X print_debug("thread_db : pthread %d (lwp %d)\n", ti.ti_tid, ti.ti_lid); X X- if (ptr->callback(ptr->ph, ti.ti_tid, ti.ti_lid) != true) X+ if (ptr->callback(ptr->ph, (pthread_t)ti.ti_tid, ti.ti_lid) != true) X return TD_ERR; X X return TD_OK; X@@ -327,7 +330,7 @@ lwpid_t get_lwp_id(struct ps_prochandle* X } X X // get regs for a given lwp X-bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, struct user_regs_struct* regs) { X+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs) { X return ph->ops->get_lwp_regs(ph, lwp_id, regs); X } X X@@ -378,11 +381,6 @@ bool find_lib(struct ps_prochandle* ph, X //-------------------------------------------------------------------------- X // proc service functions X X-// get process id X-pid_t ps_getpid(struct ps_prochandle *ph) { X- return ph->pid; X-} X- X // ps_pglobal_lookup() looks up the symbol sym_name in the symbol table X // of the load object object_name in the target process identified by ph. X // It returns the symbol's value as an address in the target process in X@@ -395,17 +393,33 @@ ps_err_e ps_pglobal_lookup(struct ps_pro X } X X // read "size" bytes info "buf" from address "addr" X-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, X+ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr, X void *buf, size_t size) { X return ph->ops->p_pread(ph, (uintptr_t) addr, buf, size)? PS_OK: PS_ERR; X } X X // write "size" bytes of data to debuggee at address "addr" X-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, X+ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr, X const void *buf, size_t size) { X return ph->ops->p_pwrite(ph, (uintptr_t)addr, buf, size)? PS_OK: PS_ERR; X } X X+// fill in ptrace_lwpinfo for lid X+ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) { X+ return ph->ops->get_lwp_info(ph, lwp_id, linfo)? PS_OK: PS_ERR; X+} X+ X+// needed for when libthread_db is compiled with TD_DEBUG defined X+void X+ps_plog (const char *format, ...) X+{ X+ va_list alist; X+ X+ va_start(alist, format); X+ vfprintf(stderr, format, alist); X+ va_end(alist); X+} X+ X // ------------------------------------------------------------------------ X // Functions below this point are not yet implemented. They are here only X // to make the linker happy. X@@ -430,9 +444,12 @@ ps_err_e ps_lgetregs(struct ps_prochandl X return PS_OK; X } X X-// new libthread_db of NPTL seem to require this symbol X-ps_err_e ps_get_thread_area() { X- print_debug("ps_get_thread_area not implemented\n"); X+ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lid) { X+ print_debug("ps_lstop not implemented\n"); X return PS_OK; X } X X+ps_err_e ps_pcontinue(struct ps_prochandle *ph) { X+ print_debug("ps_pcontinue not implemented\n"); X+ return PS_OK; X+} Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/libproc_impl.h ./hotspot/agent/src/os/bsd/libproc_impl.h X--- ../orig/hotspot/agent/src/os/bsd/libproc_impl.h 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/libproc_impl.h 2009-05-14 23:41:34.000000000 -0400 X@@ -50,7 +50,7 @@ typedef struct lib_info { X typedef struct thread_info { X lwpid_t lwp_id; X pthread_t pthread_id; // not used cores, always -1 X- struct user_regs_struct regs; // not for process, core uses for caching regset X+ struct reg regs; // not for process, core uses for caching regset X struct thread_info* next; X } thread_info; X X@@ -74,7 +74,9 @@ typedef struct ps_prochandle_ops { X bool (*p_pwrite)(struct ps_prochandle *ph, X uintptr_t addr, const char *buf , size_t size); X // get integer regset of a thread X- bool (*get_lwp_regs)(struct ps_prochandle* ph, lwpid_t lwp_id, struct user_regs_struct* regs); X+ bool (*get_lwp_regs)(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs); X+ // get info on thread X+ bool (*get_lwp_info)(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo); X } ps_prochandle_ops; X X // the ps_prochandle Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/mapfile ./hotspot/agent/src/os/bsd/mapfile X--- ../orig/hotspot/agent/src/os/bsd/mapfile 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/mapfile 2009-05-14 23:41:34.000000000 -0400 X@@ -43,15 +43,21 @@ SUNWprivate_1.1 { X Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0; X X # proc_service.h functions - to be used by libthread_db X- ps_getpid; X ps_pglobal_lookup; X- ps_pdread; X- ps_pdwrite; X+ ps_pread; X+ ps_pwrite; X+ ps_linfo; X+ ps_plog; X+ X+ # dummy implementations of proc_service.h functions X+ # presumably unused but needed to avoid undefined symbols X+ # export LIBSAPROC_DEBUG=1 to see if actually used X ps_lsetfpregs; X ps_lsetregs; X ps_lgetfpregs; X ps_lgetregs; X- ps_get_thread_area; X+ ps_lstop; X+ ps_lcontinue; X X # used by attach test program X init_libproc; Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/proc_service.h ./hotspot/agent/src/os/bsd/proc_service.h X--- ../orig/hotspot/agent/src/os/bsd/proc_service.h 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/proc_service.h 2009-05-14 23:41:34.000000000 -0400 X@@ -25,6 +25,8 @@ X * X */ X X+#error Should be using system proc_service.h X+ X #ifndef _PROC_SERVICE_H_ X #define _PROC_SERVICE_H_ X X@@ -58,11 +60,11 @@ ps_err_e ps_pglobal_lookup(struct ps_pro X const char *sym_name, psaddr_t *sym_addr); X X // read "size" bytes of data from debuggee at address "addr" X-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, X+ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr, X void *buf, size_t size); X X // write "size" bytes of data to debuggee at address "addr" X-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, X+ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr, X const void *buf, size_t size); X X ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs); Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/ps_core.c ./hotspot/agent/src/os/bsd/ps_core.c X--- ../orig/hotspot/agent/src/os/bsd/ps_core.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/ps_core.c 2009-05-14 23:41:34.000000000 -0400 X@@ -145,6 +145,7 @@ static map_info* add_class_share_map_inf X X map->next = ph->core->class_share_maps; X ph->core->class_share_maps = map; X+ return map; X } X X // Return the map_info for the given virtual address. We keep a sorted X@@ -243,7 +244,7 @@ struct FileMapHeader { X X static bool read_int(struct ps_prochandle* ph, uintptr_t addr, int* pvalue) { X int i; X- if (ps_pdread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) { X+ if (ps_pread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) { X *pvalue = i; X return true; X } else { X@@ -253,7 +254,7 @@ static bool read_int(struct ps_prochandl X X static bool read_pointer(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* pvalue) { X uintptr_t uip; X- if (ps_pdread(ph, (psaddr_t) addr, &uip, sizeof(uip)) == PS_OK) { X+ if (ps_pread(ph, (psaddr_t) addr, &uip, sizeof(uip)) == PS_OK) { X *pvalue = uip; X return true; X } else { X@@ -267,7 +268,7 @@ static bool read_string(struct ps_procha X char c = ' '; X X while (c != '\0') { X- if (ps_pdread(ph, (psaddr_t) addr, &c, sizeof(char)) != PS_OK) X+ if (ps_pread(ph, (psaddr_t) addr, &c, sizeof(char)) != PS_OK) X return false; X if (i < size - 1) X buf[i] = c; X@@ -507,24 +508,30 @@ static bool core_write_data(struct ps_pr X } X X static bool core_get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, X- struct user_regs_struct* regs) { X+ struct reg* regs) { X // for core we have cached the lwp regs from NOTE section X thread_info* thr = ph->threads; X while (thr) { X if (thr->lwp_id == lwp_id) { X- memcpy(regs, &thr->regs, sizeof(struct user_regs_struct)); X+ memcpy(regs, &thr->regs, sizeof(struct reg)); X return true; X } X thr = thr->next; X } X return false; X } X+ X+static bool core_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) { X+ print_debug("core_get_lwp_info not implemented\n"); X+ return false; X+} X X static ps_prochandle_ops core_ops = { X- release: core_release, X- p_pread: core_read_data, X- p_pwrite: core_write_data, X- get_lwp_regs: core_get_lwp_regs X+ .release= core_release, X+ .p_pread= core_read_data, X+ .p_pwrite= core_write_data, X+ .get_lwp_regs= core_get_lwp_regs, X+ .get_lwp_info= core_get_lwp_info X }; X X // read regs and create thread from NT_PRSTATUS entries from core file X@@ -539,52 +546,52 @@ static bool core_handle_prstatus(struct X return false; X X // copy regs X- memcpy(&newthr->regs, prstat->pr_reg, sizeof(struct user_regs_struct)); X+ memcpy(&newthr->regs, &prstat->pr_reg, sizeof(struct reg)); X X if (is_debug()) { X print_debug("integer regset\n"); X #ifdef i386 X // print the regset X- print_debug("\teax = 0x%x\n", newthr->regs.eax); X- print_debug("\tebx = 0x%x\n", newthr->regs.ebx); X- print_debug("\tecx = 0x%x\n", newthr->regs.ecx); X- print_debug("\tedx = 0x%x\n", newthr->regs.edx); X- print_debug("\tesp = 0x%x\n", newthr->regs.esp); X- print_debug("\tebp = 0x%x\n", newthr->regs.ebp); X- print_debug("\tesi = 0x%x\n", newthr->regs.esi); X- print_debug("\tedi = 0x%x\n", newthr->regs.edi); X- print_debug("\teip = 0x%x\n", newthr->regs.eip); X+ print_debug("\teax = 0x%x\n", newthr->regs.r_eax); X+ print_debug("\tebx = 0x%x\n", newthr->regs.r_ebx); X+ print_debug("\tecx = 0x%x\n", newthr->regs.r_ecx); X+ print_debug("\tedx = 0x%x\n", newthr->regs.r_edx); X+ print_debug("\tesp = 0x%x\n", newthr->regs.r_esp); X+ print_debug("\tebp = 0x%x\n", newthr->regs.r_ebp); X+ print_debug("\tesi = 0x%x\n", newthr->regs.r_esi); X+ print_debug("\tedi = 0x%x\n", newthr->regs.r_edi); X+ print_debug("\teip = 0x%x\n", newthr->regs.r_eip); X #endif X X #if defined(amd64) || defined(x86_64) X // print the regset X- print_debug("\tr15 = 0x%lx\n", newthr->regs.r15); X- print_debug("\tr14 = 0x%lx\n", newthr->regs.r14); X- print_debug("\tr13 = 0x%lx\n", newthr->regs.r13); X- print_debug("\tr12 = 0x%lx\n", newthr->regs.r12); X- print_debug("\trbp = 0x%lx\n", newthr->regs.rbp); X- print_debug("\trbx = 0x%lx\n", newthr->regs.rbx); X- print_debug("\tr11 = 0x%lx\n", newthr->regs.r11); X- print_debug("\tr10 = 0x%lx\n", newthr->regs.r10); X- print_debug("\tr9 = 0x%lx\n", newthr->regs.r9); X- print_debug("\tr8 = 0x%lx\n", newthr->regs.r8); X- print_debug("\trax = 0x%lx\n", newthr->regs.rax); X- print_debug("\trcx = 0x%lx\n", newthr->regs.rcx); X- print_debug("\trdx = 0x%lx\n", newthr->regs.rdx); X- print_debug("\trsi = 0x%lx\n", newthr->regs.rsi); X- print_debug("\trdi = 0x%lx\n", newthr->regs.rdi); X- print_debug("\torig_rax = 0x%lx\n", newthr->regs.orig_rax); X- print_debug("\trip = 0x%lx\n", newthr->regs.rip); X- print_debug("\tcs = 0x%lx\n", newthr->regs.cs); X- print_debug("\teflags = 0x%lx\n", newthr->regs.eflags); X- print_debug("\trsp = 0x%lx\n", newthr->regs.rsp); X- print_debug("\tss = 0x%lx\n", newthr->regs.ss); X- print_debug("\tfs_base = 0x%lx\n", newthr->regs.fs_base); X- print_debug("\tgs_base = 0x%lx\n", newthr->regs.gs_base); X- print_debug("\tds = 0x%lx\n", newthr->regs.ds); X- print_debug("\tes = 0x%lx\n", newthr->regs.es); X- print_debug("\tfs = 0x%lx\n", newthr->regs.fs); X- print_debug("\tgs = 0x%lx\n", newthr->regs.gs); X+ print_debug("\tr15 = 0x%lx\n", newthr->regs.r_r15); X+ print_debug("\tr14 = 0x%lx\n", newthr->regs.r_r14); X+ print_debug("\tr13 = 0x%lx\n", newthr->regs.r_r13); X+ print_debug("\tr12 = 0x%lx\n", newthr->regs.r_r12); X+ print_debug("\trbp = 0x%lx\n", newthr->regs.r_rbp); X+ print_debug("\trbx = 0x%lx\n", newthr->regs.r_rbx); X+ print_debug("\tr11 = 0x%lx\n", newthr->regs.r_r11); X+ print_debug("\tr10 = 0x%lx\n", newthr->regs.r_r10); X+ print_debug("\tr9 = 0x%lx\n", newthr->regs.r_r9); X+ print_debug("\tr8 = 0x%lx\n", newthr->regs.r_r8); X+ print_debug("\trax = 0x%lx\n", newthr->regs.r_rax); X+ print_debug("\trcx = 0x%lx\n", newthr->regs.r_rcx); X+ print_debug("\trdx = 0x%lx\n", newthr->regs.r_rdx); X+ print_debug("\trsi = 0x%lx\n", newthr->regs.r_rsi); X+ print_debug("\trdi = 0x%lx\n", newthr->regs.r_rdi); X+ //print_debug("\torig_rax = 0x%lx\n", newthr->regs.orig_rax); X+ print_debug("\trip = 0x%lx\n", newthr->regs.r_rip); X+ print_debug("\tcs = 0x%lx\n", newthr->regs.r_cs); X+ //print_debug("\teflags = 0x%lx\n", newthr->regs.eflags); X+ print_debug("\trsp = 0x%lx\n", newthr->regs.r_rsp); X+ print_debug("\tss = 0x%lx\n", newthr->regs.r_ss); X+ //print_debug("\tfs_base = 0x%lx\n", newthr->regs.fs_base); X+ //print_debug("\tgs_base = 0x%lx\n", newthr->regs.gs_base); X+ //print_debug("\tds = 0x%lx\n", newthr->regs.ds); X+ //print_debug("\tes = 0x%lx\n", newthr->regs.es); X+ //print_debug("\tfs = 0x%lx\n", newthr->regs.fs); X+ //print_debug("\tgs = 0x%lx\n", newthr->regs.gs); X #endif X } X X@@ -826,7 +833,7 @@ static bool read_shared_lib_info(struct X X dyn.d_tag = DT_NULL; X while (dyn.d_tag != DT_DEBUG) { X- if (ps_pdread(ph, (psaddr_t) addr, &dyn, sizeof(ELF_DYN)) != PS_OK) { X+ if (ps_pread(ph, (psaddr_t) addr, &dyn, sizeof(ELF_DYN)) != PS_OK) { X print_debug("can't read debug info from _DYNAMIC\n"); X return false; X } X@@ -836,19 +843,23 @@ static bool read_shared_lib_info(struct X // we have got Dyn entry with DT_DEBUG X debug_base = dyn.d_un.d_ptr; X // at debug_base we have struct r_debug. This has first link map in r_map field X- if (ps_pdread(ph, (psaddr_t) debug_base + FIRST_LINK_MAP_OFFSET, X+ if (ps_pread(ph, (psaddr_t) debug_base + FIRST_LINK_MAP_OFFSET, X &first_link_map_addr, sizeof(uintptr_t)) != PS_OK) { X print_debug("can't read first link map address\n"); X return false; X } X X // read ld_base address from struct r_debug X- if (ps_pdread(ph, (psaddr_t) debug_base + LD_BASE_OFFSET, &ld_base_addr, X+ // XXX: There is no r_ldbase member on BSD X+/* X+ if (ps_pread(ph, (psaddr_t) debug_base + LD_BASE_OFFSET, &ld_base_addr, X sizeof(uintptr_t)) != PS_OK) { X print_debug("can't read ld base address\n"); X return false; X } X ph->core->ld_base_addr = ld_base_addr; X+*/ X+ ph->core->ld_base_addr = 0; X X print_debug("interpreter base address is 0x%lx\n", ld_base_addr); X X@@ -870,14 +881,14 @@ static bool read_shared_lib_info(struct X // address mentioned in shared object and the actual virtual base where runtime X // linker loaded it. We use "base diff" in read_lib_segments call below. X X- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_ADDR_OFFSET, X+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_ADDR_OFFSET, X &lib_base_diff, sizeof(uintptr_t)) != PS_OK) { X print_debug("can't read shared object base address diff\n"); X return false; X } X X // read address of the name X- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_NAME_OFFSET, X+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NAME_OFFSET, X &lib_name_addr, sizeof(uintptr_t)) != PS_OK) { X print_debug("can't read address of shared object name\n"); X return false; X@@ -921,7 +932,7 @@ static bool read_shared_lib_info(struct X } X X // read next link_map address X- if (ps_pdread(ph, (psaddr_t) link_map_addr + LINK_MAP_NEXT_OFFSET, X+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NEXT_OFFSET, X &link_map_addr, sizeof(uintptr_t)) != PS_OK) { X print_debug("can't read next link in link_map\n"); X return false; X@@ -935,7 +946,6 @@ static bool read_shared_lib_info(struct X struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) { X ELF_EHDR core_ehdr; X ELF_EHDR exec_ehdr; X- ELF_EHDR lib_ehdr; X X struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle)); X if (ph == NULL) { Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/ps_proc.c ./hotspot/agent/src/os/bsd/ps_proc.c X--- ../orig/hotspot/agent/src/os/bsd/ps_proc.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/ps_proc.c 2009-05-15 09:49:29.000000000 -0400 X@@ -25,20 +25,22 @@ X * X */ X X+#include <limits.h> X #include <stdio.h> X #include <stdlib.h> X #include <string.h> X #include <errno.h> X+#include <sys/types.h> X+#include <sys/wait.h> X #include <sys/ptrace.h> X+#include <sys/param.h> X+#include <sys/user.h> X+#include <elf.h> X+#include <sys/elf_common.h> X+#include <sys/link_elf.h> X+#include <libutil.h> X #include "libproc_impl.h" X- X-#if defined(x86_64) && !defined(amd64) X-#define amd64 1 X-#endif X- X-#ifndef __WALL X-#define __WALL 0x40000000 // Copied from /usr/include/bsd/wait.h X-#endif X+#include "elfmacros.h" X X // This file has the libproc implementation specific to live process X // For core files, refer to ps_core.c X@@ -57,46 +59,46 @@ static inline uintptr_t align(uintptr_t X // before calling process_read_data. X X static bool process_read_data(struct ps_prochandle* ph, uintptr_t addr, char *buf, size_t size) { X- long rslt; X+ int rslt; X size_t i, words; X uintptr_t end_addr = addr + size; X- uintptr_t aligned_addr = align(addr, sizeof(long)); X+ uintptr_t aligned_addr = align(addr, sizeof(int)); X X if (aligned_addr != addr) { X char *ptr = (char *)&rslt; X errno = 0; X- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0); X+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0); X if (errno) { X- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr); X+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr); X return false; X } X for (; aligned_addr != addr; aligned_addr++, ptr++); X- for (; ((intptr_t)aligned_addr % sizeof(long)) && aligned_addr < end_addr; X+ for (; ((intptr_t)aligned_addr % sizeof(int)) && aligned_addr < end_addr; X aligned_addr++) X *(buf++) = *(ptr++); X } X X- words = (end_addr - aligned_addr) / sizeof(long); X+ words = (end_addr - aligned_addr) / sizeof(int); X X- // assert((intptr_t)aligned_addr % sizeof(long) == 0); X+ // assert((intptr_t)aligned_addr % sizeof(int) == 0); X for (i = 0; i < words; i++) { X errno = 0; X- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0); X- if (errno) { X- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr); X+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0); X+ if (errno) { X+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr); X return false; X } X- *(long *)buf = rslt; X- buf += sizeof(long); X- aligned_addr += sizeof(long); X+ *(int *)buf = rslt; X+ buf += sizeof(int); X+ aligned_addr += sizeof(int); X } X X if (aligned_addr != end_addr) { X char *ptr = (char *)&rslt; X errno = 0; X- rslt = ptrace(PTRACE_PEEKDATA, ph->pid, aligned_addr, 0); X+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0); X if (errno) { X- print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr); X+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr); X return false; X } X for (; aligned_addr != end_addr; aligned_addr++) X@@ -111,45 +113,28 @@ static bool process_write_data(struct ps X return false; X } X X-// "user" should be a pointer to a user_regs_struct X-static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct user_regs_struct *user) { X+// "user" should be a pointer to a reg X+static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct reg *user) { X // we have already attached to all thread 'pid's, just use ptrace call X // to get regset now. Note that we don't cache regset upfront for processes. X-// Bsd on x86 and sparc are different. On x86 ptrace(PTRACE_GETREGS, ...) X-// uses pointer from 4th argument and ignores 3rd argument. On sparc it uses X-// pointer from 3rd argument and ignores 4th argument X-#if defined(sparc) || defined(sparcv9) X-#define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, addr, data) X-#else X-#define ptrace_getregs(request, pid, addr, data) ptrace(request, pid, data, addr) X-#endif X- X-#ifdef _LP64 X-#ifdef PTRACE_GETREGS64 X-#define PTRACE_GETREGS_REQ PTRACE_GETREGS64 X-#endif X-#else X-#if defined(PTRACE_GETREGS) || defined(PT_GETREGS) X-#define PTRACE_GETREGS_REQ PTRACE_GETREGS X-#endif X-#endif /* _LP64 */ X- X-#ifdef PTRACE_GETREGS_REQ X- if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) { X+ if (ptrace(PT_GETREGS, pid, (caddr_t) user, 0) < 0) { X print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid); X return false; X } X return true; X-#else X- print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n"); X- return false; X-#endif X+} X+ X+// fill in ptrace_lwpinfo for lid X+static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) { X+ errno = 0; X+ ptrace(PT_LWPINFO, lwp_id, linfo, sizeof(struct ptrace_lwpinfo)); X X+ return (errno == 0)? true: false; X } X X // attach to a process/thread specified by "pid" X static bool ptrace_attach(pid_t pid) { X- if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) { X+ if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) { X print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid); X return false; X } else { X@@ -158,10 +143,6 @@ static bool ptrace_attach(pid_t pid) { X do { X // Wait for debuggee to stop. X ret = waitpid(pid, &status, 0); X- if (ret == -1 && errno == ECHILD) { X- // try cloned process. X- ret = waitpid(pid, &status, __WALL); X- } X if (ret >= 0) { X if (WIFSTOPPED(status)) { X // Debuggee stopped. X@@ -194,85 +175,222 @@ static bool ptrace_attach(pid_t pid) { X // functions for obtaining library information X // ------------------------------------------------------- X X-/* X- * splits a string _str_ into substrings with delimiter _delim_ by replacing old * delimiters with _new_delim_ (ideally, '\0'). the address of each substring X- * is stored in array _ptrs_ as the return value. the maximum capacity of _ptrs_ * array is specified by parameter _n_. X- * RETURN VALUE: total number of substrings (always <= _n_) X- * NOTE: string _str_ is modified if _delim_!=_new_delim_ X- */ X-static int split_n_str(char * str, int n, char ** ptrs, char delim, char new_delim) X-{ X- int i; X- for(i = 0; i < n; i++) ptrs[i] = NULL; X- if (str == NULL || n < 1 ) return 0; X- X- i = 0; X- X- // skipping leading blanks X- while(*str&&*str==delim) str++; X- X- while(*str&&i<n){ X- ptrs[i++] = str; X- while(*str&&*str!=delim) str++; X- while(*str&&*str==delim) *(str++) = new_delim; X- } X- X- return i; X+// callback for read_thread_info X+static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) { X+ return add_thread_info(ph, pthread_id, lwp_id) != NULL; X } X X+#if defined(__FreeBSD__) && __FreeBSD_version < 701000 X /* X- * fgets without storing '\n' at the end of the string X+ * TEXT_START_ADDR from binutils/ld/emulparams/<arch_spec>.sh X+ * Not the most robust but good enough. X */ X-static char * fgets_no_cr(char * buf, int n, FILE *fp) X-{ X- char * rslt = fgets(buf, n, fp); X- if (rslt && buf && *buf){ X- char *p = strchr(buf, '\0'); X- if (*--p=='\n') *p='\0'; X- } X- return rslt; X-} X X-// callback for read_thread_info X-static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) { X- return add_thread_info(ph, pthread_id, lwp_id) != NULL; X+#if defined(amd64) || defined(x86_64) X+#define TEXT_START_ADDR 0x400000 X+#elif defined(i386) X+#define TEXT_START_ADDR 0x8048000 X+#else X+#error TEXT_START_ADDR not defined X+#endif X+ X+#define BUF_SIZE (PATH_MAX + NAME_MAX + 1) X+ X+uintptr_t linkmap_addr(struct ps_prochandle *ph) { X+ uintptr_t ehdr_addr, phdr_addr, dyn_addr, dmap_addr, lmap_addr; X+ ELF_EHDR ehdr; X+ ELF_PHDR *phdrs, *phdr; X+ ELF_DYN *dyns, *dyn; X+ struct r_debug dmap; X+ unsigned long hdrs_size; X+ unsigned int i; X+ X+ /* read ELF_EHDR at TEXT_START_ADDR and validate */ X+ X+ ehdr_addr = (uintptr_t)TEXT_START_ADDR; X+ X+ if (process_read_data(ph, ehdr_addr, (char *)&ehdr, sizeof(ehdr)) != true) { X+ print_debug("process_read_data failed for ehdr_addr %p\n", ehdr_addr); X+ return (0); X+ } X+ X+ if (!IS_ELF(ehdr) || X+ ehdr.e_ident[EI_CLASS] != ELF_TARG_CLASS || X+ ehdr.e_ident[EI_DATA] != ELF_TARG_DATA || X+ ehdr.e_ident[EI_VERSION] != EV_CURRENT || X+ ehdr.e_phentsize != sizeof(ELF_PHDR) || X+ ehdr.e_version != ELF_TARG_VER || X+ ehdr.e_machine != ELF_TARG_MACH) { X+ print_debug("not an ELF_EHDR at %p\n", ehdr_addr); X+ return (0); X+ } X+ X+ /* allocate space for all ELF_PHDR's and read */ X+ X+ phdr_addr = ehdr_addr + ehdr.e_phoff; X+ hdrs_size = ehdr.e_phnum * sizeof(ELF_PHDR); X+ X+ if ((phdrs = malloc(hdrs_size)) == NULL) X+ return (0); X+ X+ if (process_read_data(ph, phdr_addr, (char *)phdrs, hdrs_size) != true) { X+ print_debug("process_read_data failed for phdr_addr %p\n", phdr_addr); X+ return (0); X+ } X+ X+ /* find PT_DYNAMIC section */ X+ X+ for (i = 0, phdr = phdrs; i < ehdr.e_phnum; i++, phdr++) { X+ if (phdr->p_type == PT_DYNAMIC) X+ break; X+ } X+ X+ if (i >= ehdr.e_phnum) { X+ print_debug("PT_DYNAMIC section not found!\n"); X+ free(phdrs); X+ return (0); X+ } X+ X+ /* allocate space and read in ELF_DYN headers */ X+ X+ dyn_addr = phdr->p_vaddr; X+ hdrs_size = phdr->p_memsz; X+ free(phdrs); X+ X+ if ((dyns = malloc(hdrs_size)) == NULL) X+ return (0); X+ X+ if (process_read_data(ph, dyn_addr, (char *)dyns, hdrs_size) != true) { X+ print_debug("process_read_data failed for dyn_addr %p\n", dyn_addr); X+ free(dyns); X+ return (0); X+ } X+ X+ /* find DT_DEBUG */ X+ X+ dyn = dyns; X+ while (dyn->d_tag != DT_DEBUG && dyn->d_tag != DT_NULL) { X+ dyn++; X+ } X+ X+ if (dyn->d_tag != DT_DEBUG) { X+ print_debug("failed to find DT_DEBUG\n"); X+ free(dyns); X+ return (0); X+ } X+ X+ /* read struct r_debug into dmap */ X+ X+ dmap_addr = (uintptr_t)dyn->d_un.d_ptr; X+ free(dyns); X+ X+ if (process_read_data(ph, dmap_addr, (char *)&dmap, sizeof(dmap)) != true) { X+ print_debug("process_read_data failed for dmap_addr %p\n", dmap_addr); X+ return (0); X+ } X+ X+ lmap_addr = (uintptr_t)dmap.r_map; X+ X+ return (lmap_addr); X } X+#endif // __FreeBSD__ && __FreeBSD_version < 701000 X X static bool read_lib_info(struct ps_prochandle* ph) { X- char fname[32]; X- char buf[256]; X- FILE *fp = NULL; X- X- sprintf(fname, "/proc/%d/maps", ph->pid); X- fp = fopen(fname, "r"); X- if (fp == NULL) { X- print_debug("can't open /proc/%d/maps file\n", ph->pid); X- return false; X+#if defined(__FreeBSD__) && __FreeBSD_version >= 701000 X+ struct kinfo_vmentry *freep, *kve; X+ int i, cnt; X+ X+ freep = kinfo_getvmmap(ph->pid, &cnt); X+ if (freep == NULL) { X+ print_debug("can't get vm map for pid\n", ph->pid); X+ return false; X } X X- while(fgets_no_cr(buf, 256, fp)){ X- char * word[6]; X- int nwords = split_n_str(buf, 6, word, ' ', '\0'); X- if (nwords > 5 && find_lib(ph, word[5]) == false) { X- intptr_t base; X- lib_info* lib; X- sscanf(word[0], "%lx", &base); X- if ((lib = add_lib_info(ph, word[5], (uintptr_t)base)) == NULL) X+ for (i = 0; i < cnt; i++) { X+ kve = &freep[i]; X+ if ((kve->kve_flags & KVME_FLAG_COW) && X+ kve->kve_path != NULL && X+ strlen(kve->kve_path) > 0) { X+ X+ if (find_lib(ph, kve->kve_path) == false) { X+ lib_info* lib; X+ if ((lib = add_lib_info(ph, kve->kve_path, X+ (uintptr_t) kve->kve_start)) == NULL) X continue; // ignore, add_lib_info prints error X X- // we don't need to keep the library open, symtab is already X- // built. Only for core dump we need to keep the fd open. X- close(lib->fd); X- lib->fd = -1; X+ // we don't need to keep the library open, symtab is already X+ // built. Only for core dump we need to keep the fd open. X+ close(lib->fd); X+ lib->fd = -1; X+ } X } X } X- fclose(fp); X+ X+ free(freep); X+ X+ return true; X+#else X+ char *l_name; X+ struct link_map *lmap; X+ uintptr_t lmap_addr; X+ X+ if ((l_name = malloc(BUF_SIZE)) == NULL) X+ return false; X+ X+ if ((lmap = malloc(sizeof(*lmap))) == NULL) { X+ free(l_name); X+ return false; X+ } X+ X+ lmap_addr = linkmap_addr(ph); X+ X+ if (lmap_addr == 0) { X+ free(l_name); X+ free(lmap); X+ return false; X+ } X+ X+ do { X+ if (process_read_data(ph, lmap_addr, (char *)lmap, sizeof(*lmap)) != true) { X+ print_debug("process_read_data failed for lmap_addr %p\n", lmap_addr); X+ free (l_name); X+ free (lmap); X+ return false; X+ } X+ X+ if (process_read_data(ph, (uintptr_t)lmap->l_name, l_name, X+ BUF_SIZE) != true) { X+ print_debug("process_read_data failed for lmap->l_name %p\n", X+ lmap->l_name); X+ free (l_name); X+ free (lmap); X+ return false; X+ } X+ X+ if (find_lib(ph, l_name) == false) { X+ lib_info* lib; X+ if ((lib = add_lib_info(ph, l_name, X+ (uintptr_t) lmap->l_addr)) == NULL) X+ continue; // ignore, add_lib_info prints error X+ X+ // we don't need to keep the library open, symtab is already X+ // built. Only for core dump we need to keep the fd open. X+ close(lib->fd); X+ lib->fd = -1; X+ } X+ lmap_addr = (uintptr_t)lmap->l_next; X+ } while (lmap->l_next != NULL); X+ X+ free (l_name); X+ free (lmap); X+ X return true; X+#endif X } X X // detach a given pid X static bool ptrace_detach(pid_t pid) { X- if (pid && ptrace(PTRACE_DETACH, pid, NULL, NULL) < 0) { X+ if (pid && ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0) { X print_debug("ptrace(PTRACE_DETACH, ..) failed for %d\n", pid); X return false; X } else { X@@ -280,24 +398,16 @@ static bool ptrace_detach(pid_t pid) { X } X } X X-// detach all pids of a ps_prochandle X-static void detach_all_pids(struct ps_prochandle* ph) { X- thread_info* thr = ph->threads; X- while (thr) { X- ptrace_detach(thr->lwp_id); X- thr = thr->next; X- } X-} X- X static void process_cleanup(struct ps_prochandle* ph) { X- detach_all_pids(ph); X+ ptrace_detach(ph->pid); X } X X static ps_prochandle_ops process_ops = { X- release: process_cleanup, X- p_pread: process_read_data, X- p_pwrite: process_write_data, X- get_lwp_regs: process_get_lwp_regs X+ .release= process_cleanup, X+ .p_pread= process_read_data, X+ .p_pwrite= process_write_data, X+ .get_lwp_regs= process_get_lwp_regs, X+ .get_lwp_info= process_get_lwp_info X }; X X // attach to the process. One and only one exposed stuff X@@ -324,21 +434,14 @@ struct ps_prochandle* Pgrab(pid_t pid) { X // read library info and symbol tables, must do this before attaching threads, X // as the symbols in the pthread library will be used to figure out X // the list of threads within the same process. X- read_lib_info(ph); X+ if (read_lib_info(ph) != true) { X+ ptrace_detach(pid); X+ free(ph); X+ return NULL; X+ } X X // read thread info X read_thread_info(ph, add_new_thread); X X- // attach to the threads X- thr = ph->threads; X- while (thr) { X- // don't attach to the main thread again X- if (ph->pid != thr->lwp_id && ptrace_attach(thr->lwp_id) != true) { X- // even if one attach fails, we get return NULL X- Prelease(ph); X- return NULL; X- } X- thr = thr->next; X- } X return ph; X } Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/salibelf.c ./hotspot/agent/src/os/bsd/salibelf.c X--- ../orig/hotspot/agent/src/os/bsd/salibelf.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/salibelf.c 2009-05-14 23:41:34.000000000 -0400 X@@ -28,6 +28,7 @@ X #include "salibelf.h" X #include <stdlib.h> X #include <unistd.h> X+#include <string.h> X X extern void print_debug(const char*,...); X Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/symtab.c ./hotspot/agent/src/os/bsd/symtab.c X--- ../orig/hotspot/agent/src/os/bsd/symtab.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/symtab.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,13 +26,14 @@ X */ X X #include <unistd.h> X-#include <sys/procfs.h> X #include <search.h> X #include <stdlib.h> X #include <string.h> X+#include "hsearch_r.h" X #include "symtab.h" X #include "salibelf.h" X X+extern void print_debug(const char*,...); X X // ---------------------------------------------------- X // functions for symbol lookups X@@ -59,7 +60,6 @@ typedef struct symtab { X // read symbol table from given fd. X struct symtab* build_symtab(int fd) { X ELF_EHDR ehdr; X- char *names = NULL; X struct symtab* symtab = NULL; X X // Reading of elf header X@@ -68,18 +68,22 @@ struct symtab* build_symtab(int fd) { X ELF_SHDR* shbuf = NULL; X ELF_SHDR* cursct = NULL; X ELF_PHDR* phbuf = NULL; X- ELF_PHDR* phdr = NULL; X+ int symtab_found = 0; X+ int dynsym_found = 0; X+ uint32_t symsection = SHT_SYMTAB; X X uintptr_t baseaddr = (uintptr_t)-1; X X lseek(fd, (off_t)0L, SEEK_SET); X if (! read_elf_header(fd, &ehdr)) { X+ print_debug("not an ELF header\n"); X // not an elf X return NULL; X } X X // read ELF header X if ((shbuf = read_section_header_table(fd, &ehdr)) == NULL) { X+ print_debug("can't read section header\n"); X goto quit; X } X X@@ -88,23 +92,35 @@ struct symtab* build_symtab(int fd) { X scn_cache = (struct elf_section *) X calloc(ehdr.e_shnum * sizeof(struct elf_section), 1); X if (scn_cache == NULL) { X+ print_debug("can't read scn_cache\n"); X goto quit; X } X X for (cursct = shbuf, cnt = 0; cnt < ehdr.e_shnum; cnt++) { X scn_cache[cnt].c_shdr = cursct; X- if (cursct->sh_type == SHT_SYMTAB || cursct->sh_type == SHT_STRTAB) { X+ if (cursct->sh_type == SHT_SYMTAB || X+ cursct->sh_type == SHT_STRTAB || X+ cursct->sh_type == SHT_DYNSYM) { X if ( (scn_cache[cnt].c_data = read_section_data(fd, &ehdr, cursct)) == NULL) { X+ print_debug("can't read section_data\n"); X goto quit; X } X } X+ if (cursct->sh_type == SHT_SYMTAB) X+ symtab_found++; X+ X+ if (cursct->sh_type == SHT_DYNSYM) X+ dynsym_found++; X cursct++; X } X X+ if (!symtab_found && dynsym_found) X+ symsection = SHT_DYNSYM; X+ X for (cnt = 1; cnt < ehdr.e_shnum; cnt++) { X ELF_SHDR *shdr = scn_cache[cnt].c_shdr; X X- if (shdr->sh_type == SHT_SYMTAB) { X+ if (shdr->sh_type == symsection) { X ELF_SYM *syms; X int j, n, rslt; X size_t size; X@@ -116,6 +132,7 @@ struct symtab* build_symtab(int fd) { X // guarantee(symtab == NULL, "multiple symtab"); X symtab = (struct symtab*)calloc(1, sizeof(struct symtab)); X if (symtab == NULL) { X+ print_debug("can't allocate symtab\n"); X goto quit; X } X // the symbol table Xdiff -uNpr ../orig/hotspot/agent/src/os/bsd/test.c ./hotspot/agent/src/os/bsd/test.c X--- ../orig/hotspot/agent/src/os/bsd/test.c 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/os/bsd/test.c 2009-05-14 23:41:34.000000000 -0400 X@@ -47,7 +47,7 @@ int main(int argc, char** argv) { X } X X default: { X- printf("usage %s <pid> or %s <exec file> <core file>\n"); X+ fprintf(stderr, "usage %s <pid> or %s <exec file> <core file>\n"); X return 1; X } X } Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java 2009-04-24 03:30:48.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java 2009-05-14 23:41:34.000000000 -0400 X@@ -28,6 +28,7 @@ import java.io.PrintStream; X import java.net.*; X import java.rmi.*; X import sun.jvm.hotspot.debugger.*; X+import sun.jvm.hotspot.debugger.bsd.*; X import sun.jvm.hotspot.debugger.dbx.*; X import sun.jvm.hotspot.debugger.proc.*; X import sun.jvm.hotspot.debugger.remote.*; X@@ -337,6 +338,8 @@ public class HotSpotAgent { X setupDebuggerWin32(); X } else if (os.equals("linux")) { X setupDebuggerLinux(); X+ } else if (os.equals("bsd")) { X+ setupDebuggerBsd(); X } else { X // Add support for more operating systems here X throw new DebuggerException("Operating system " + os + " not yet supported"); X@@ -392,6 +395,10 @@ public class HotSpotAgent { X db = new HotSpotTypeDataBase(machDesc, X new LinuxVtblAccess(debugger, jvmLibNames), X debugger, jvmLibNames); X+ } else if (os.equals("bsd")) { X+ db = new HotSpotTypeDataBase(machDesc, X+ new BsdVtblAccess(debugger, jvmLibNames), X+ debugger, jvmLibNames); X } else { X throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); X } X@@ -557,6 +564,8 @@ public class HotSpotAgent { X setupJVMLibNamesWin32(); X } else if (os.equals("linux")) { X setupJVMLibNamesLinux(); X+ } else if (os.equals("bsd")) { X+ setupJVMLibNamesBsd(); X } else { X throw new RuntimeException("Unknown OS type"); X } X@@ -638,6 +647,31 @@ public class HotSpotAgent { X jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; X } X X+ // X+ // BSD X+ // X+ X+ private void setupDebuggerBsd() { X+ setupJVMLibNamesBsd(); X+ X+ if (cpu.equals("x86")) { X+ machDesc = new MachineDescriptionIntelX86(); X+ } else if (cpu.equals("amd64")) { X+ machDesc = new MachineDescriptionAMD64(); X+ } else { X+ throw new DebuggerException("BSD only supported on x86/amd64"); X+ } X+ X+ BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer); X+ debugger = dbg; X+ X+ attachDebugger(); X+ } X+ X+ private void setupJVMLibNamesBsd() { X+ jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; X+ } X+ X /** Convenience routine which should be called by per-platform X debugger setup. Should not be called when startupMode is X REMOTE_MODE. */ Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java 2009-04-24 03:30:49.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java 2009-05-14 23:41:34.000000000 -0400 X@@ -29,6 +29,7 @@ import java.net.*; X import java.rmi.*; X import sun.jvm.hotspot.*; X import sun.jvm.hotspot.debugger.*; X+import sun.jvm.hotspot.debugger.bsd.*; X import sun.jvm.hotspot.debugger.dbx.*; X import sun.jvm.hotspot.debugger.proc.*; X import sun.jvm.hotspot.debugger.cdbg.*; X@@ -516,6 +517,8 @@ public class BugSpotAgent { X setupDebuggerWin32(); X } else if (os.equals("linux")) { X setupDebuggerLinux(); X+ } else if (os.equals("bsd")) { X+ setupDebuggerBsd(); X } else { X // Add support for more operating systems here X throw new DebuggerException("Operating system " + os + " not yet supported"); X@@ -567,6 +570,9 @@ public class BugSpotAgent { X } else if (os.equals("linux")) { X db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), X debugger, jvmLibNames); X+ } else if (os.equals("bsd")) { X+ db = new HotSpotTypeDataBase(machDesc, new BsdVtblAccess(debugger, jvmLibNames), X+ debugger, jvmLibNames); X } else { X throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess implemented yet)"); X } X@@ -739,6 +745,8 @@ public class BugSpotAgent { X setupJVMLibNamesWin32(); X } else if (os.equals("linux")) { X setupJVMLibNamesLinux(); X+ } else if (os.equals("bsd")) { X+ setupJVMLibNamesBsd(); X } else { X throw new RuntimeException("Unknown OS type"); X } X@@ -822,6 +830,34 @@ public class BugSpotAgent { X setupJVMLibNamesSolaris(); X } X X+ // X+ // BSD X+ // X+ X+ private void setupDebuggerBsd() { X+ setupJVMLibNamesBsd(); X+ X+ if (cpu.equals("x86")) { X+ machDesc = new MachineDescriptionIntelX86(); X+ } else if (cpu.equals("amd64")) { X+ machDesc = new MachineDescriptionAMD64(); X+ } else { X+ throw new DebuggerException("Bsd only supported on x86/amd64"); X+ } X+ X+ // Note we do not use a cache for the local debugger in server X+ // mode; it will be taken care of on the client side (once remote X+ // debugging is implemented). X+ X+ debugger = new BsdDebuggerLocal(machDesc, !isServer); X+ attachDebugger(); X+ } X+ X+ private void setupJVMLibNamesBsd() { X+ // same as solaris X+ setupJVMLibNamesSolaris(); X+ } X+ X /** Convenience routine which should be called by per-platform X debugger setup. Should not be called when startupMode is X REMOTE_MODE. */ Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java 2009-05-14 23:41:34.000000000 -0400 X@@ -30,10 +30,8 @@ import sun.jvm.hotspot.debugger.*; X import sun.jvm.hotspot.debugger.cdbg.*; X import sun.jvm.hotspot.debugger.x86.*; X import sun.jvm.hotspot.debugger.amd64.*; X-import sun.jvm.hotspot.debugger.sparc.*; X import sun.jvm.hotspot.debugger.bsd.x86.*; X import sun.jvm.hotspot.debugger.bsd.amd64.*; X-import sun.jvm.hotspot.debugger.bsd.sparc.*; X import sun.jvm.hotspot.utilities.*; X X class BsdCDebugger implements CDebugger { X@@ -99,13 +97,6 @@ class BsdCDebugger implements CDebugger X Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); X if (pc == null) return null; X return new BsdAMD64CFrame(dbg, rbp, pc); X- } else if (cpu.equals("sparc")) { X- SPARCThreadContext context = (SPARCThreadContext) thread.getContext(); X- Address sp = context.getRegisterAsAddress(SPARCThreadContext.R_SP); X- if (sp == null) return null; X- Address pc = context.getRegisterAsAddress(SPARCThreadContext.R_O7); X- if (pc == null) return null; X- return new BsdSPARCCFrame(dbg, sp, pc, BsdDebuggerLocal.getAddressSize()); X } else { X throw new DebuggerException(cpu + " is not yet supported"); X } Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java 2009-05-14 23:41:34.000000000 -0400 X@@ -26,9 +26,7 @@ package sun.jvm.hotspot.debugger.bsd; X X import sun.jvm.hotspot.debugger.*; X import sun.jvm.hotspot.debugger.bsd.amd64.*; X-import sun.jvm.hotspot.debugger.bsd.ia64.*; X import sun.jvm.hotspot.debugger.bsd.x86.*; X-import sun.jvm.hotspot.debugger.bsd.sparc.*; X X class BsdThreadContextFactory { X static ThreadContext createThreadContext(BsdDebugger dbg) { X@@ -37,10 +35,6 @@ class BsdThreadContextFactory { X return new BsdX86ThreadContext(dbg); X } else if (cpu.equals("amd64")) { X return new BsdAMD64ThreadContext(dbg); X- } else if (cpu.equals("ia64")) { X- return new BsdIA64ThreadContext(dbg); X- } else if (cpu.equals("sparc")) { X- return new BsdSPARCThreadContext(dbg); X } else { X throw new RuntimeException("cpu " + cpu + " is not yet supported"); X } Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2009-04-24 03:30:51.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2009-05-14 23:41:34.000000000 -0400 X@@ -37,6 +37,8 @@ import sun.jvm.hotspot.runtime.linux_x86 X import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess; X import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; X import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; X+import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; X+import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess; X import sun.jvm.hotspot.utilities.*; X X public class Threads { X@@ -90,7 +92,12 @@ public class Threads { X } else if (cpu.equals("sparc")) { X access = new LinuxSPARCJavaThreadPDAccess(); X } X- X+ } else if (os.equals("bsd")) { X+ if (cpu.equals("x86")) { X+ access = new BsdX86JavaThreadPDAccess(); X+ } else if (cpu.equals("amd64")) { X+ access = new BsdAMD64JavaThreadPDAccess(); X+ } X } X X if (access == null) { Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java 2009-05-15 09:51:39.000000000 -0400 X@@ -28,37 +28,36 @@ public class BsdSignals { X private static String[] signalNames = { X "", /* No signal 0 */ X "SIGHUP", /* hangup */ X- "SIGINT", /* interrupt (rubout) */ X- "SIGQUIT", /* quit (ASCII FS) */ X- "SIGILL", /* illegal instruction (not reset when caught) */ X+ "SIGINT", /* interrupt */ X+ "SIGQUIT", /* quit */ X+ "SIGILL", /* illegal instr. (not reset when caught) */ X "SIGTRAP", /* trace trap (not reset when caught) */ X- "SIGABRT", /* used by abort, replace SIGIOT in the future */ X- "SIGIOT", X- "SIGBUS", X+ "SIGABRT", /* abort() */ X+ "SIGEMT", /* EMT instruction */ X "SIGFPE", /* floating point exception */ X "SIGKILL", /* kill (cannot be caught or ignored) */ X- "SIGUSR1", /* user defined signal 1 */ X+ "SIGBUS", /* bus error */ X "SIGSEGV", /* segmentation violation */ X- "SIGUSR2", /* user defined signal 2 */ X+ "SIGSYS", /* non-existent system call invoked */ X "SIGPIPE", /* write on a pipe with no one to read it */ X "SIGALRM", /* alarm clock */ X "SIGTERM", /* software termination signal from kill */ X- "SIGSTKFLT", X- "SIGCHLD", /* child status change alias */ X- "SIGCONT", /* stopped process has been continued */ X- "SIGSTOP", /* stop (cannot be caught or ignored) */ X- "SIGTSTP", /* user stop requested from tty */ X- "SIGTTIN", /* background tty read attempted */ X- "SIGTTOU", /* background tty write attempted */ X- "SIGURG", /* urgent socket condition */ X- "SIGXCPU", /* exceeded cpu limit */ X+ "SIGURG", /* urgent condition on IO channel */ X+ "SIGSTOP", /* sendable stop signal not from tty */ X+ "SIGTSTP", /* stop signal from tty */ X+ "SIGCONT", /* continue a stopped process */ X+ "SIGCHLD", /* to parent on child stop or exit */ X+ "SIGTTIN", /* to readers pgrp upon background tty read */ X+ "SIGTTOU", /* like TTIN if (tp->t_local&LTOSTOP) */ X+ "SIGIO", /* input/output possible signal */ X+ "SIGXCPU", /* exceeded CPU time limit */ X "SIGXFSZ", /* exceeded file size limit */ X- "SIGVTALRM", /* virtual timer expired */ X- "SIGPROF", /* profiling timer expired */ X- "SIGWINCH", /* window size change */ X- "SIGPOLL", /* pollable event occured */ X- "SIGPWR", /* power-fail restart */ X- "SIGSYS" X+ "SIGVTALRM", /* virtual time alarm */ X+ "SIGPROF", /* profiling time alarm */ X+ "SIGWINCH", /* window size changes */ X+ "SIGINFO", /* information request */ X+ "SIGUSR1", /* user defined signal 1 */ X+ "SIGUSR2" /* user defined signal 2 */ X }; X X public static String getSignalName(int sigNum) { Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java 2009-05-14 23:40:16.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java 2009-05-14 23:41:34.000000000 -0400 X@@ -32,33 +32,32 @@ public class BsdSignals { X "SIGQUIT", /* quit (ASCII FS) */ X "SIGILL", /* illegal instruction (not reset when caught) */ X "SIGTRAP", /* trace trap (not reset when caught) */ X- "SIGABRT", /* used by abort, replace SIGIOT in the future */ X- "SIGIOT", X- "SIGBUS", X+ "SIGABRT", /* abort() */ X+ "SIGEMT", /* EMT instruction */ X "SIGFPE", /* floating point exception */ X "SIGKILL", /* kill (cannot be caught or ignored) */ X- "SIGUSR1", /* user defined signal 1 */ X+ "SIGBUS", /* bus error */ X "SIGSEGV", /* segmentation violation */ X- "SIGUSR2", /* user defined signal 2 */ X+ "SIGSYS", /* non-existent system call invoked */ X "SIGPIPE", /* write on a pipe with no one to read it */ X "SIGALRM", /* alarm clock */ X "SIGTERM", /* software termination signal from kill */ X- "SIGSTKFLT", X- "SIGCHLD", /* child status change alias */ X- "SIGCONT", /* stopped process has been continued */ X- "SIGSTOP", /* stop (cannot be caught or ignored) */ X- "SIGTSTP", /* user stop requested from tty */ X- "SIGTTIN", /* background tty read attempted */ X- "SIGTTOU", /* background tty write attempted */ X- "SIGURG", /* urgent socket condition */ X- "SIGXCPU", /* exceeded cpu limit */ X+ "SIGURG", /* urgent condition on IO channel */ X+ "SIGSTOP", /* sendable stop signal not from tty */ X+ "SIGTSTP", /* stop signal from tty */ X+ "SIGCONT", /* continue a stopped process */ X+ "SIGCHLD", /* to parent on child stop or exit */ X+ "SIGTTIN", /* to readers pgrp upon background tty read */ X+ "SIGTTOU", /* like TTIN if (tp->t_local&LTOSTOP) */ X+ "SIGIO", /* input/output possible signal */ X+ "SIGXCPU", /* exceeded CPU time limit */ X "SIGXFSZ", /* exceeded file size limit */ X- "SIGVTALRM", /* virtual timer expired */ X- "SIGPROF", /* profiling timer expired */ X- "SIGWINCH", /* window size change */ X- "SIGPOLL", /* pollable event occured */ X- "SIGPWR", /* power-fail restart */ X- "SIGSYS" X+ "SIGVTALRM", /* virtual time alarm */ X+ "SIGPROF", /* profiling time alarm */ X+ "SIGWINCH", /* window size changes */ X+ "SIGINFO", /* information request */ X+ "SIGUSR1", /* user defined signal 1 */ X+ "SIGUSR2" /* user defined signal 2 */ X }; X X public static String getSignalName(int sigNum) { Xdiff -uNpr ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java ./hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java X--- ../orig/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2009-04-24 03:30:51.000000000 -0400 X+++ ./hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2009-05-14 23:41:34.000000000 -0400 X@@ -37,6 +37,14 @@ public class PlatformInfo { X return "solaris"; X } else if (os.equals("Linux")) { X return "linux"; X+ } else if (os.equals("FreeBSD")) { X+ return "bsd"; X+ } else if (os.equals("NetBSD")) { X+ return "bsd"; X+ } else if (os.equals("OpenBSD")) { X+ return "bsd"; X+ } else if (os.equals("Darwin")) { X+ return "bsd"; X } else if (os.startsWith("Windows")) { X return "win32"; X } else { Xdiff -uNpr ../orig/hotspot/build/bsd/Makefile ./hotspot/build/bsd/Makefile X--- ../orig/hotspot/build/bsd/Makefile 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/Makefile 2009-05-14 23:41:33.000000000 -0400 X@@ -198,7 +198,8 @@ checks: check_os_version check_j2se_vers X # Solaris 2.5.1, 2.6). X # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. X X-SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7% X+#SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7% X+DISABLE_HOTSPOT_OS_VERSION_CHECK = ok X OS_VERSION := $(shell uname -r) X EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) X Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/buildtree.make ./hotspot/build/bsd/makefiles/buildtree.make X--- ../orig/hotspot/build/bsd/makefiles/buildtree.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/buildtree.make 2009-05-14 23:41:33.000000000 -0400 X@@ -273,10 +273,11 @@ env.sh: $(BUILDTREE_MAKE) X [ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \ X { \ X echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \ X+ echo "DYLD_LIBRARY_PATH=.:$${DYLD_LIBRARY_PATH:+$$DYLD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \ X echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \ X } | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \ X echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \ X- echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \ X+ echo "export JAVA_HOME LD_LIBRARY_PATH DYLD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \ X ) > $@ X X env.csh: env.sh Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/cscope.make ./hotspot/build/bsd/makefiles/cscope.make X--- ../orig/hotspot/build/bsd/makefiles/cscope.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/cscope.make 2009-05-14 23:41:33.000000000 -0400 X@@ -72,7 +72,7 @@ endif X # OS-specific files for other systems are excluded by default. Use CS_OS=yes X # to include platform-specific files for other platforms. X ifndef CS_OS X-CS_OS = bsd macos solaris win32 X+CS_OS = linux macos solaris win32 bsd X CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS})) X endif X Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/defs.make ./hotspot/build/bsd/makefiles/defs.make X--- ../orig/hotspot/build/bsd/makefiles/defs.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/defs.make 2009-05-14 23:41:34.000000000 -0400 X@@ -28,6 +28,14 @@ X X SLASH_JAVA ?= /java X X+# Library suffix X+OS_VENDOR:=$(shell uname -s) X+ifeq ($(OS_VENDOR),Darwin) X+ LIBRARY_SUFFIX=dylib X+else X+ LIBRARY_SUFFIX=so X+endif X+ X # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name X ARCH:=$(shell uname -m) X PATH_SEP = : X@@ -79,6 +87,31 @@ ifeq ($(ARCH), x86_64) X endif X endif X X+# amd64 X+ifeq ($(ARCH), amd64) X+ ARCH_DATA_MODEL = 64 X+ MAKE_ARGS += LP64=1 X+ PLATFORM = bsd-amd64 X+ VM_PLATFORM = bsd_amd64 X+ HS_ARCH = x86 X+endif X+ X+# i386 X+ifeq ($(ARCH), i386) X+ ARCH_DATA_MODEL = 32 X+ PLATFORM = bsd-i586 X+ VM_PLATFORM = bsd_i486 X+ HS_ARCH = x86 X+endif X+ X+# i486 X+ifeq ($(ARCH), i486) X+ ARCH_DATA_MODEL = 32 X+ PLATFORM = bsd-i586 X+ VM_PLATFORM = bsd_i486 X+ HS_ARCH = x86 X+endif X+ X # i686 X ifeq ($(ARCH), i686) X ARCH_DATA_MODEL = 32 X@@ -95,19 +128,13 @@ VM_DEBUG=jvmg X EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html X EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server X EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt X-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.so X-EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so X+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.$(LIBRARY_SUFFIX) X+EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) X ifeq ($(ARCH_DATA_MODEL), 32) X EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client X EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt X- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so
檔案過大!部分文章無法顯示
X+ */ X+static Boolean X+awt_wm_isWindowmaker() X+{ X+ if (awt_wm_atomInterned(&_XA_WINDOWMAKER_STATE, "_WINDOWMAKER_STATE")) X+ return True; X+ return False; X+} X+ X+/* X+ * Afterstep. X+ */ X+static Boolean X+awt_wm_isAfterstep() X+{ X+ if (awt_wm_atomInterned(&_XA_AS_STYLE, "_AS_STYLE")) X+ return True; X+ return False; X+} X+ X+/* X+ * FVWM 2. X+ */ X+static Boolean X+awt_wm_isFvwm2() X+{ X+ if (awt_wm_atomInterned(&_XA_OL_DECOR_ADD, "_OL_DECOR_ADD") X+ && !awt_wm_atomInterned(&_XA_OL_DECOR_PIN, "_OL_DECOR_PIN")) X+ return True; X+ return False; X+} X X static Boolean X awt_wm_isNetWMName(char *name) X@@ -1280,6 +1325,12 @@ awt_wm_getRunningWM(void) X else if (awt_wm_isKDE2()) { X awt_wmgr = KDE2_WM; X } X+ else if (awt_wm_isWindowmaker()) { X+ awt_wmgr = WINDOWMAKER_WM; X+ } X+ else if (awt_wm_isAfterstep()) { X+ awt_wmgr = AFTERSTEP_WM; X+ } X /* X * We don't check for legacy WM when we already know that WM X * supports WIN or _NET wm spec. X@@ -1302,6 +1353,9 @@ awt_wm_getRunningWM(void) X awt_wmgr = MOTIF_WM; X } X else if (awt_wm_isOpenLook()) { X+ awt_wmgr = OPENLOOK_WM; X+ } X+ else if (awt_wm_isFvwm2()) { X awt_wmgr = OPENLOOK_WM; X } X else { Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_wm.h ./jdk/src/solaris/native/sun/awt/awt_wm.h X--- ../orig/jdk/src/solaris/native/sun/awt/awt_wm.h 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_wm.h 2009-05-14 23:41:34.000000000 -0400 X@@ -45,7 +45,10 @@ enum wmgr_t { X KDE2_WM, X SAWFISH_WM, X ICE_WM, X- METACITY_WM X+ METACITY_WM, X+ AFTERSTEP_WM, X+ WINDOWMAKER_WM, X+ FVWM2_WM X }; X X extern void awt_wm_init(void); Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/extutil.h ./jdk/src/solaris/native/sun/awt/extutil.h X--- ../orig/jdk/src/solaris/native/sun/awt/extutil.h 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/extutil.h 2009-05-14 23:41:34.000000000 -0400 X@@ -58,7 +58,7 @@ in this Software without prior written a X */ X /* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */ X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X X #ifndef _EXTUTIL_H_ X #define _EXTUTIL_H_ X@@ -248,4 +248,4 @@ char *proc (Display *dpy, int code, XExt X char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) X #endif X X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/fontpath.c ./jdk/src/solaris/native/sun/awt/fontpath.c X--- ../orig/jdk/src/solaris/native/sun/awt/fontpath.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/fontpath.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,7 +23,7 @@ X * have any questions. X */ X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <string.h> X #endif /* __linux__ */ X #include <stdio.h> X@@ -40,6 +40,7 @@ X X #include <jni.h> X #include <jni_util.h> X+#include <jvm_md.h> X #include <sun_font_FontManager.h> X #ifndef HEADLESS X #include <X11/Xlib.h> X@@ -58,10 +59,24 @@ X extern Display *awt_display; X #endif /* !HEADLESS */ X X+#ifdef __APPLE__ X+// XXXDARWIN: Hard-code the path to Apple's freetype, as it is X+// not included in the dyld search path by default, and 10.4 X+// does not support -rpath. X+// X+// This ignores the build time setting of ALT_FREETYPE_LIB_PATH, X+// and should be replaced with -rpath/@rpath support on 10.5 or later, X+// or via support for a the FREETYPE_LIB_PATH define. X+#define FONTCONFIG_DLL_VERSIONED X11_PATH "/lib/" VERSIONED_JNI_LIB_NAME("fontconfig", "1") X+#define FONTCONFIG_DLL X11_PATH "/lib/" JNI_LIB_NAME("fontconfig") X+#else X+#define FONTCONFIG_DLL_VERSIONED VERSIONED_JNI_LIB_NAME("fontconfig", "1") X+#define FONTCONFIG_DLL JNI_LIB_NAME("fontconfig") X+#endif X X #define MAXFDIRS 512 /* Max number of directories that contain fonts */ X X-#ifndef __linux__ X+#if !defined(__linux__) && !defined(_ALLBSD_SOURCE) X /* X * This can be set in the makefile to "/usr/X11" if so desired. X */ X@@ -111,24 +126,40 @@ static char *fullSolarisFontPath[] = { X NULL, /* terminates the list */ X }; X X+#elif _ALLBSD_SOURCE X+static char *fullBSDFontPath[] = { X+ X11_PATH "/lib/X11/fonts/TrueType", X+ X11_PATH "/lib/X11/fonts/truetype", X+ X11_PATH "/lib/X11/fonts/tt", X+ X11_PATH "/lib/X11/fonts/TTF", X+ X11_PATH "/lib/X11/fonts/OTF", X+ PACKAGE_PATH "/share/fonts/TrueType", X+ PACKAGE_PATH "/share/fonts/truetype", X+ PACKAGE_PATH "/share/fonts/tt", X+ PACKAGE_PATH "/share/fonts/TTF", X+ PACKAGE_PATH "/share/fonts/OTF", X+ X11_PATH "/lib/X11/fonts/Type1", X+ PACKAGE_PATH "/share/fonts/Type1", X+ NULL, /* terminates the list */ X+}; X #else /* __linux */ X /* All the known interesting locations we have discovered on X * various flavors of Linux X */ X static char *fullLinuxFontPath[] = { X- "/usr/X11R6/lib/X11/fonts/TrueType", /* RH 7.1+ */ X- "/usr/X11R6/lib/X11/fonts/truetype", /* SuSE */ X- "/usr/X11R6/lib/X11/fonts/tt", X- "/usr/X11R6/lib/X11/fonts/TTF", X- "/usr/X11R6/lib/X11/fonts/OTF", /* RH 9.0 (but empty!) */ X- "/usr/share/fonts/ja/TrueType", /* RH 7.2+ */ X- "/usr/share/fonts/truetype", X- "/usr/share/fonts/ko/TrueType", /* RH 9.0 */ X- "/usr/share/fonts/zh_CN/TrueType", /* RH 9.0 */ X- "/usr/share/fonts/zh_TW/TrueType", /* RH 9.0 */ X+ X11_PATH "/lib/X11/fonts/TrueType", /* RH 7.1+ */ X+ X11_PATH "/lib/X11/fonts/truetype", /* SuSE */ X+ X11_PATH "/lib/X11/fonts/tt", X+ X11_PATH "/lib/X11/fonts/TTF", X+ X11_PATH "/lib/X11/fonts/OTF", /* RH 9.0 (but empty!) */ X+ PACKAGE_PATH "/share/fonts/ja/TrueType", /* RH 7.2+ */ X+ PACKAGE_PATH "/share/fonts/truetype", X+ PACKAGE_PATH "/share/fonts/ko/TrueType", /* RH 9.0 */ X+ PACKAGE_PATH "/share/fonts/zh_CN/TrueType", /* RH 9.0 */ X+ PACKAGE_PATH "/share/fonts/zh_TW/TrueType", /* RH 9.0 */ X "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType", /* Debian */ X- "/usr/X11R6/lib/X11/fonts/Type1", X- "/usr/share/fonts/default/Type1", /* RH 9.0 */ X+ X11_PATH "/lib/X11/fonts/Type1", X+ PACKAGE_PATH "/share/fonts/default/Type1", /* RH 9.0 */ X NULL, /* terminates the list */ X }; X #endif X@@ -351,7 +382,7 @@ static char **getX11FontPath () X X #endif /* !HEADLESS */ X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /* from awt_LoadLibrary.c */ X JNIEXPORT jboolean JNICALL AWTIsHeadless(); X #endif X@@ -476,8 +507,10 @@ static char *getPlatformFontPathChars(JN X */ X fcdirs = getFontConfigLocations(); X X-#ifdef __linux__ X+#if defined(__linux__) X knowndirs = fullLinuxFontPath; X+#elif defined(_ALLBSD_SOURCE) X+ knowndirs = fullBSDFontPath; X #else /* IF SOLARIS */ X knowndirs = fullSolarisFontPath; X #endif X@@ -488,7 +521,8 @@ static char *getPlatformFontPathChars(JN X * be initialised. X */ X #ifndef HEADLESS X-#ifdef __linux__ /* There's no headless build on linux ... */ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X+ /* There's no headless build on linux ... */ X if (!AWTIsHeadless()) { /* .. so need to call a function to check */ X #endif X AWT_LOCK(); X@@ -496,7 +530,7 @@ static char *getPlatformFontPathChars(JN X x11dirs = getX11FontPath(); X } X AWT_UNLOCK(); X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X } X #endif X #endif /* !HEADLESS */ X@@ -608,7 +642,7 @@ Java_sun_font_FontManager_populateFontFi X } X X #include <dlfcn.h> X-#ifndef __linux__ /* i.e. is solaris */ X+#if !(defined(__linux__) || defined(__APPLE__)) X #include <link.h> X #endif X X@@ -654,9 +688,9 @@ static void* openFontConfig() { X * certain symbols - and functionality - to be available. X * Also add explicit search for .so.1 in case .so symlink doesn't exist. X */ X- libfontconfig = dlopen("libfontconfig.so.1", RTLD_LOCAL|RTLD_LAZY); X+ libfontconfig = dlopen(FONTCONFIG_DLL_VERSIONED, RTLD_LOCAL|RTLD_LAZY); X if (libfontconfig == NULL) { X- libfontconfig = dlopen("libfontconfig.so", RTLD_LOCAL|RTLD_LAZY); X+ libfontconfig = dlopen(FONTCONFIG_DLL, RTLD_LOCAL|RTLD_LAZY); X if (libfontconfig == NULL) { X return NULL; X } Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/gtk2_interface.c ./jdk/src/solaris/native/sun/awt/gtk2_interface.c X--- ../orig/jdk/src/solaris/native/sun/awt/gtk2_interface.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/gtk2_interface.c 2009-05-14 23:41:34.000000000 -0400 X@@ -30,8 +30,9 @@ X #include <string.h> X #include "gtk2_interface.h" X #include "java_awt_Transparency.h" X+#include "jvm_md.h" X X-#define GTK2_LIB "libgtk-x11-2.0.so.0" X+#define GTK2_LIB VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0") X X #define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0) X #define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1) Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/list.c ./jdk/src/solaris/native/sun/awt/list.c X--- ../orig/jdk/src/solaris/native/sun/awt/list.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/list.c 2009-05-14 23:41:34.000000000 -0400 X@@ -66,7 +66,11 @@ from the X Consortium. X ----------------------------------------------------------------------- **/ X X #include <stdio.h> X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X #include "list.h" X X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/robot_common.c ./jdk/src/solaris/native/sun/awt/robot_common.c X--- ../orig/jdk/src/solaris/native/sun/awt/robot_common.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/robot_common.c 2009-05-14 23:41:34.000000000 -0400 X@@ -27,6 +27,9 @@ X #error This file should not be included in headless library X #endif X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#endif X #include "robot_common.h" X X /* Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/font/X11FontScaler.c ./jdk/src/solaris/native/sun/font/X11FontScaler.c X--- ../orig/jdk/src/solaris/native/sun/font/X11FontScaler.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/font/X11FontScaler.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,7 +32,11 @@ X * into X11FontScaler_md.c, which is compiled into another library. X */ X #include <stdio.h> X+#if defined(_ALLBSD_SOURCE) X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X #include <ctype.h> X #include <sys/utsname.h> X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/font/X11TextRenderer.c ./jdk/src/solaris/native/sun/font/X11TextRenderer.c X--- ../orig/jdk/src/solaris/native/sun/font/X11TextRenderer.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/font/X11TextRenderer.c 2009-05-14 23:41:34.000000000 -0400 X@@ -39,7 +39,11 @@ X #include "GraphicsPrimitiveMgr.h" X #include "glyphblitting.h" X #include "sunfontids.h" X+#if defined(_ALLBSD_SOURCE) X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X X X JNIEXPORT void JNICALL AWTDrawGlyphList Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/java2d/j2d_md.h ./jdk/src/solaris/native/sun/java2d/j2d_md.h X--- ../orig/jdk/src/solaris/native/sun/java2d/j2d_md.h 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/java2d/j2d_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -28,11 +28,11 @@ X #include <sys/types.h> X X /* X- * Linux version of <sys/types.h> does not define intptr_t X+ * Linux and BSD's version of <sys/types.h> does not define intptr_t X */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <stdint.h> X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X typedef unsigned char jubyte; X typedef unsigned short jushort; Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c ./jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c X--- ../orig/jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c 2009-05-14 23:41:34.000000000 -0400 X@@ -66,6 +66,10 @@ X * MLIB_EDGE_SRC_PADDED X */ X X+#ifdef __OpenBSD__ X+#include <sys/types.h> X+#endif X+#include <machine/endian.h> X #include <mlib_image.h> X #include <mlib_ImageZoom.h> X X@@ -102,7 +106,7 @@ typedef union { X X /***************************************************************/ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X static const mlib_u32 mlib_bit_mask4[16] = { X 0x00000000u, 0xFF000000u, 0x00FF0000u, 0xFFFF0000u, X@@ -111,7 +115,7 @@ static const mlib_u32 mlib_bit_mask4[16] X 0x0000FFFFu, 0xFF00FFFFu, 0x00FFFFFFu, 0xFFFFFFFFu X }; X X-#else /* _LITTLE_ENDIAN */ X+#else /* BIG_ENDIAN */ X X static const mlib_u32 mlib_bit_mask4[16] = { X 0x00000000u, 0x000000FFu, 0x0000FF00u, 0x0000FFFFu, X@@ -120,7 +124,7 @@ static const mlib_u32 mlib_bit_mask4[16] X 0xFFFF0000u, 0xFFFF00FFu, 0xFFFFFF00u, 0xFFFFFFFFu X }; X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X X /***************************************************************/ X X@@ -344,11 +348,11 @@ mlib_status mlib_ImageZoom_BIT_1_Nearest X #ifdef _NO_LONGLONG X X typedef struct { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X mlib_u32 uint1, uint0; X-#else /* _LITTLE_ENDIAN */ X+#else /* BIG_ENDIAN */ X mlib_u32 uint0, uint1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X } two_uint; X X /***************************************************************/ X@@ -511,11 +515,11 @@ mlib_status mlib_ImageZoom_BitToGray_1_N X DTYPE mask; X MASK(mask); X off *= 8; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X LSHIFT(dd_old, da[0], 64 - off); X-#else /* _LITTLE_ENDIAN */ X+#else /* BIG_ENDIAN */ X RSHIFT(dd_old, da[0], 64 - off); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X X #ifdef __SUNPRO_C X #pragma pipeloop(0) X@@ -540,30 +544,30 @@ mlib_status mlib_ImageZoom_BitToGray_1_N X X res = (res & 0xff) | (res >> 8); X dd = gray_mask[res]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X /* *da++ = (dd_old >> (64 - off)) | (dd << off);*/ X RSHIFT(dd_old, dd_old, 64 - off); X LSHIFT(dtmp, dd, off); X-#else /* _LITTLE_ENDIAN */ X+#else /* BIG_ENDIAN */ X /* *da++ = (dd_old << (64 - off)) | (dd >> off);*/ X LSHIFT(dd_old, dd_old, 64 - off); X RSHIFT(dtmp, dd, off); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X LOGIC(*da++, dd_old, dtmp, |); X dd_old = dd; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X /* da[0] = (dd_old >> (64 - off)) | (da[0] & ((mlib_u64)((mlib_s64) -1) << off));*/ X LSHIFT(dtmp, mask, off); X LOGIC(dtmp, da[0], dtmp, &); X RSHIFT(dtmp1, dd_old, 64 - off); X-#else /* _LITTLE_ENDIAN */ X+#else /* BIG_ENDIAN */ X /* da[0] = (dd_old << (64 - off)) | (da[0] & ((mlib_u64)((mlib_s64) -1) >> off));*/ X RSHIFT(dtmp, mask, off); X LOGIC(dtmp, da[0], dtmp, &); X LSHIFT(dtmp1, dd_old, 64 - off); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X LOGIC(da[0], dtmp, dtmp1, |); X } X else { /* aligned */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c ./jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c X--- ../orig/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c 2009-05-14 23:41:34.000000000 -0400 X@@ -794,7 +794,7 @@ static AnyFunc* hash_table_vis[HASH_SIZE X static int initialized; X static int usevis = JNI_TRUE; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X # define ULTRA_CHIP "sparc64" X #else X # define ULTRA_CHIP "sun4u" Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h ./jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h X--- ../orig/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -27,7 +27,10 @@ X #define OGLFuncs_md_h_Included X X #include <stdlib.h> X+#ifndef __APPLE__ X #include <link.h> X+#endif X+#include "jvm_md.h" X #include "J2D_GL/glx.h" X #include "OGLFuncMacros.h" X X@@ -113,7 +116,7 @@ do { \ X { \ X char *libGLPath = getenv("J2D_ALT_LIBGL_PATH"); \ X if (libGLPath == NULL) { \ X- libGLPath = "libGL.so.1"; \ X+ libGLPath = VERSIONED_JNI_LIB_NAME("GL", "1"); \ X } \ X OGL_LIB_HANDLE = dlopen(libGLPath, RTLD_LAZY | RTLD_LOCAL); \ X } \ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c ./jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c X--- ../orig/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,6 +32,7 @@ X #include "gdefs.h" X X #include "jni_util.h" X+#include "jvm_md.h" X #include "awt_Component.h" X #include "awt_GraphicsEnv.h" X X@@ -128,7 +129,7 @@ Java_sun_java2d_x11_X11SurfaceData_initI X X if (tryDGA && (getenv("NO_J2D_DGA") == NULL)) { X /* we use RTLD_NOW because of bug 4032715 */ X- lib = dlopen("libsunwjdga.so", RTLD_NOW); X+ lib = dlopen(JNI_LIB_NAME("sunwjdga"), RTLD_NOW); X } X dgaAvailable = JNI_FALSE; X if (lib != NULL) { Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/jdga/dgalock.c ./jdk/src/solaris/native/sun/jdga/dgalock.c X--- ../orig/jdk/src/solaris/native/sun/jdga/dgalock.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/jdga/dgalock.c 2009-05-14 23:41:34.000000000 -0400 X@@ -44,6 +44,7 @@ X #include <X11/Xlib.h> X X #include "jni.h" X+#include "jvm_md.h" X #include "jdga.h" X #include "jdgadevice.h" X X@@ -84,10 +85,10 @@ Drawable GetVirtualDrawableStub(Display X static GetVirtualDrawableFunc * GetVirtualDrawable = GetVirtualDrawableStub; X X static void Solaris_DGA_XineramaInit(Display *display) { X- void * handle = 0; X+ void * handle = NULL; X if (IsXineramaOn == NULL) { X- handle = dlopen("libxinerama.so", RTLD_NOW); X- if (handle != 0) { X+ handle = dlopen(JNI_LIB_NAME("xinerama"), RTLD_NOW); X+ if (handle != NULL) { X void *sym = dlsym(handle, "IsXineramaOn"); X IsXineramaOn = (IsXineramaOnFunc *)sym; X if (IsXineramaOn != 0 && (*IsXineramaOn)(display)) { Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/management/FileSystemImpl.c ./jdk/src/solaris/native/sun/management/FileSystemImpl.c X--- ../orig/jdk/src/solaris/native/sun/management/FileSystemImpl.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/management/FileSystemImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,6 +26,10 @@ X #include <sys/types.h> X #include <sys/stat.h> X X+#if defined(_ALLBSD_SOURCE) X+#include "largefile_bsd.h" X+#endif X+ X #include "jni.h" X #include "jni_util.h" X #include "sun_management_FileSystemImpl.h" Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c ./jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c X--- ../orig/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -33,7 +33,7 @@ X #include <strings.h> X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <string.h> X #endif X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c ./jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c X--- ../orig/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,11 +26,12 @@ X #include "jni.h" X #include "jni_util.h" X #include "jvm.h" X+#include "jvm_md.h" X #include "jlong.h" X #include "sun_net_spi_DefaultProxySelector.h" X #include <dlfcn.h> X #include <stdio.h> X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <string.h> X #else X #include <strings.h> X@@ -109,8 +110,9 @@ Java_sun_net_spi_DefaultProxySelector_in X /** X * Let's try to load le GConf-2 library X */ X- if (dlopen("libgconf-2.so", RTLD_GLOBAL | RTLD_LAZY) != NULL || X- dlopen("libgconf-2.so.4", RTLD_GLOBAL | RTLD_LAZY) != NULL) { X+ if (dlopen(JNI_LIB_NAME("gconf-2"), RTLD_GLOBAL | RTLD_LAZY) != NULL || X+ dlopen(VERSIONED_JNI_LIB_NAME("gconf-2", "4"), X+ RTLD_GLOBAL | RTLD_LAZY) != NULL) { X gconf_ver = 2; X } X if (gconf_ver > 0) { Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c ./jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c X--- ../orig/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -35,7 +35,7 @@ X #include <string.h> X #include <errno.h> X X-#if __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <netinet/in.h> X #endif X X@@ -86,7 +86,7 @@ Java_sun_nio_ch_DatagramChannelImpl_disc X rv = connect(fd, 0, 0); X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X { X int len; X SOCKADDR sa; X@@ -96,17 +96,30 @@ Java_sun_nio_ch_DatagramChannelImpl_disc X #ifdef AF_INET6 X if (ipv6_available()) { X struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&sa; X+#if defined(_ALLBSD_SOURCE) X+ him6->sin6_family = AF_INET6; X+#else X him6->sin6_family = AF_UNSPEC; X+#endif X len = sizeof(struct sockaddr_in6); X } else X #endif X { X struct sockaddr_in *him4 = (struct sockaddr_in*)&sa; X+#if defined(_ALLBSD_SOURCE) X+ him4->sin_family = AF_INET; X+#else X him4->sin_family = AF_UNSPEC; X+#endif X len = sizeof(struct sockaddr_in); X } X X rv = connect(fd, (struct sockaddr *)&sa, len); X+ X+#if defined(_ALLBSD_SOURCE) X+ if (rv < 0 && errno == EADDRNOTAVAIL) X+ rv = errno = 0; X+#endif X } X #endif X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c ./jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c X--- ../orig/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,15 +26,21 @@ X #include "jni.h" X #include "jni_util.h" X #include "jvm.h" X+#include "jvm_md.h" X #include "jlong.h" X #include <sys/mman.h> X #include <sys/stat.h> X+#include <fcntl.h> X #include "sun_nio_ch_FileChannelImpl.h" X #include "java_lang_Integer.h" X #include "nio.h" X #include "nio_util.h" X #include <dlfcn.h> X X+#if defined(_ALLBSD_SOURCE) X+#include "largefile_bsd.h" X+#endif X+ X static jfieldID chan_fd; /* jobject 'fd' in sun.io.FileChannelImpl */ X X #ifdef __solaris__ X@@ -59,6 +65,10 @@ sendfile_func* my_sendfile_func = NULL; X typedef ssize_t sendfile64_func(int out_fd, int in_fd, off64_t *offset, size_t count); X X sendfile64_func* my_sendfile64_func = NULL; X+#elif defined(_ALLBSD_SOURCE) X+#include <sys/socket.h> X+#include <errno.h> X+#include <stdlib.h> X #endif X X JNIEXPORT jlong JNICALL X@@ -68,7 +78,8 @@ Java_sun_nio_ch_FileChannelImpl_initIDs( X chan_fd = (*env)->GetFieldID(env, clazz, "fd", "Ljava/io/FileDescriptor;"); X X #ifdef __solaris__ X- if (dlopen("/usr/lib/libsendfile.so.1", RTLD_GLOBAL | RTLD_LAZY) != NULL) { X+ if (dlopen("/usr/lib/" VERSIONED_JNI_LIB_NAME("sendfile", "1"), X+ RTLD_GLOBAL | RTLD_LAZY) != NULL) { X my_sendfile_func = (sendfile_func*) dlsym(RTLD_DEFAULT, "sendfilev64"); X } X #endif X@@ -278,6 +289,58 @@ Java_sun_nio_ch_FileChannelImpl_transfer X return result; X } X #endif X+ X+#ifdef _ALLBSD_SOURCE X+ /* X+ * XXXBSD: make sure that we're returning what java class may understand X+ * X+ * XXXBSD: I'd prefer to have it implemented with sendfile(), but since X+ * FreeBSD's sendfile() is only supposed to be used in file->socket X+ * schema we need to provide some kind of fall-back operation, if X+ * sendfile() failed with ENOTSOCK error only. X+ */ X+ void *buf; X+ off_t offset = (off_t)position; X+ int r, w = 0; X+ X+ buf = malloc(4096); X+ if (buf == NULL) { X+ JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); X+ return IOS_THROWN; X+ } X+ X+ while ((r = pread(srcFD, buf, 4096, offset)) > 0) { X+ w = write(dstFD, buf, r); X+ if (w == -1) X+ break; X+ offset += w; X+ } X+ free(buf); X+ X+ /* X+ * Similar to solaris if we've transferred any data return X+ * the number of bytes and ignore any error X+ */ X+ if (offset - (off_t)position > 0) X+ return (offset - (off_t)position); X+ X+ /* X+ * Deal with NBIO EAGAIN & EINTR the same as solaris. X+ */ X+ if (r == -1 || w == -1) { X+ switch (errno) { X+ case EAGAIN: X+ return IOS_UNAVAILABLE; X+ case EINTR: X+ return IOS_INTERRUPTED; X+ default: X+ JNU_ThrowIOExceptionWithLastError(env, "Transfer failed"); X+ return IOS_THROWN; X+ } X+ } X+ X+ return (0); X+#endif X } X X JNIEXPORT jint JNICALL X@@ -329,6 +392,23 @@ Java_sun_nio_ch_FileChannelImpl_release0 X fl.l_start = (off64_t)pos; X fl.l_type = F_UNLCK; X lockResult = fcntl(fd, cmd, &fl); X+#if defined(__FreeBSD__) || defined(__OpenBSD__) X+ /* XXXFREEBSD: While doing of preClose0() we're closing actual fd which X+ was locked, so here we'll get an error which need to be ignored to X+ satisfy TCK FileLock test */ X+ /* XXXFREEBSD: backport to 1.4.2 */ X+ if (lockResult < 0 && errno == EBADF) X+ lockResult = errno = 0; X+#endif X+#if defined(__NetBSD__) X+ /* XXXNETBSD: The dup2 in preClose0 is being done onto 1 end of a X+ socketpair which isn't a valid target for F_UNLCK. No good way to see X+ this vs. a bad lock setup so just return errno = 0 there X+ to pass JCK (lock will get removed once all fd's close anyways) */ X+ /* XXXNETBSD: backport to 1.4.2 */ X+ if (lockResult < 0 && errno == EINVAL) X+ lockResult = errno = 0; X+#endif X if (lockResult < 0) { X JNU_ThrowIOExceptionWithLastError(env, "Release failed"); X } Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c ./jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c X--- ../orig/jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,8 +32,12 @@ X #include <sys/socket.h> X #include <fcntl.h> X #include <sys/uio.h> X+#include <unistd.h> X #include "nio_util.h" X X+#if defined(_ALLBSD_SOURCE) X+#include "largefile_bsd.h" X+#endif X X static int preCloseFD = -1; /* File descriptor to which we dup other fd's X before closing them for real */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/nio/ch/FileKey.c ./jdk/src/solaris/native/sun/nio/ch/FileKey.c X--- ../orig/jdk/src/solaris/native/sun/nio/ch/FileKey.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/nio/ch/FileKey.c 2009-05-14 23:41:34.000000000 -0400 X@@ -30,6 +30,10 @@ X #include "nio_util.h" X #include "sun_nio_ch_FileKey.h" X X+#if defined(_ALLBSD_SOURCE) X+#include "largefile_bsd.h" X+#endif X+ X static jfieldID key_st_dev; /* id for FileKey.st_dev */ X static jfieldID key_st_ino; /* id for FileKey.st_ino */ X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/nio/ch/Net.c ./jdk/src/solaris/native/sun/nio/ch/Net.c X--- ../orig/jdk/src/solaris/native/sun/nio/ch/Net.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/nio/ch/Net.c 2009-05-14 23:41:34.000000000 -0400 X@@ -140,8 +140,31 @@ Java_sun_nio_ch_Net_localPort(JNIEnv *en X SOCKADDR sa; X int sa_len = SOCKADDR_LEN; X if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) { X+#ifdef _ALLBSD_SOURCE X+ /* X+ * XXXBSD: X+ * ECONNRESET is specific to the BSDs. We can not return an error, X+ * as the calling Java code with raise a java.lang.Error given the expectation X+ * that getsockname() will never fail. According to the Single UNIX Specification, X+ * it shouldn't fail. As such, we just fill in generic Linux-compatible values. X+ */ X+ if (errno == ECONNRESET) { X+ struct sockaddr_in *sin; X+ sin = (struct sockaddr_in *) &sa; X+ bzero(sin, sizeof(*sin)); X+ sin->sin_len = sizeof(struct sockaddr_in); X+ sin->sin_family = AF_INET; X+ sin->sin_port = htonl(0); X+ sin->sin_addr.s_addr = INADDR_ANY; X+ } else { X+ handleSocketError(env, errno); X+ return -1; X+ } X+#else /* _ALLBSD_SOURCE */ X handleSocketError(env, errno); X return -1; X+#endif /* _ALLBSD_SOURCE */ X+ X } X return NET_GetPortFromSockaddr((struct sockaddr *)&sa); X } X@@ -153,12 +176,76 @@ Java_sun_nio_ch_Net_localInetAddress(JNI X int sa_len = SOCKADDR_LEN; X int port; X if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) { X- handleSocketError(env, errno); X- return NULL; X+#ifdef _ALLBSD_SOURCE X+ /* X+ * XXXBSD: X+ * ECONNRESET is specific to the BSDs. We can not return an error, X+ * as the calling Java code with raise a java.lang.Error with the expectation X+ * that getsockname() will never fail. According to the Single UNIX Specification, X+ * it shouldn't fail. As such, we just fill in generic Linux-compatible values. X+ */ X+ if (errno == ECONNRESET) { X+ struct sockaddr_in *sin; X+ sin = (struct sockaddr_in *) &sa; X+ bzero(sin, sizeof(*sin)); X+ sin->sin_len = sizeof(struct sockaddr_in); X+ sin->sin_family = AF_INET; X+ sin->sin_port = htonl(0); X+ sin->sin_addr.s_addr = INADDR_ANY; X+ } else { X+ handleSocketError(env, errno); X+ return NULL; X+ } X+#else /* _ALLBSD_SOURCE */ X+ handleSocketError(env, errno); X+ return NULL; X+#endif /* _ALLBSD_SOURCE */ X+ X } X return NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port); X } X X+#ifdef _ALLBSD_SOURCE X+ X+#ifndef IP_BLOCK_SOURCE X+ X+#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */ X+#define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */ X+#define IP_BLOCK_SOURCE 72 /* block a source */ X+#define IP_UNBLOCK_SOURCE 73 /* unblock a source */ X+ X+#endif /* IP_BLOCK_SOURCE */ X+ X+#ifndef MCAST_BLOCK_SOURCE X+ X+#define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */ X+#define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */ X+#define MCAST_BLOCK_SOURCE 84 /* block a source */ X+#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */ X+ X+#endif /* MCAST_BLOCK_SOURCE */ X+ X+#ifndef IPV6_ADD_MEMBERSHIP X+ X+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP X+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP X+ X+#endif /* IPV6_ADD_MEMBERSHIP */ X+ X+struct my_ip_mreq_source { X+ struct in_addr imr_multiaddr; X+ struct in_addr imr_interface; X+ struct in_addr imr_sourceaddr; X+}; X+ X+struct my_group_source_req { X+ uint32_t gsr_interface; /* interface index */ X+ struct sockaddr_storage gsr_group; /* group address */ X+ struct sockaddr_storage gsr_source; /* source address */ X+}; X+ X+#endif /* _ALLBSD_SOURCE */ X+ X X #ifdef NEEDED X X@@ -224,7 +311,7 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv X int result; X struct linger linger; X void *arg; X- int arglen; X+ socklen_t arglen; X X if (NET_MapSocketOption(opt, &klevel, &kopt) < 0) { X JNU_ThrowByNameWithLastError(env, X@@ -262,7 +349,7 @@ Java_sun_nio_ch_Net_setIntOption0(JNIEnv X int result; X struct linger linger; X void *parg; X- int arglen; X+ socklen_t arglen; X X if (NET_MapSocketOption(opt, &klevel, &kopt) < 0) { X JNU_ThrowByNameWithLastError(env, X@@ -304,9 +391,11 @@ handleSocketError(JNIEnv *env, jint erro X switch (errorValue) { X case EINPROGRESS: /* Non-blocking connect */ X return 0; X+#ifdef EPROTO X case EPROTO: X xn = JNU_JAVANETPKG "ProtocolException"; X break; X+#endif X case ECONNREFUSED: X xn = JNU_JAVANETPKG "ConnectException"; X break; Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c ./jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c X--- ../orig/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,7 +26,9 @@ X #include <stdio.h> X #include <stdlib.h> X #include <dlfcn.h> X+#ifndef __APPLE__ X #include <link.h> X+#endif X #include "NativeFunc.h" X X /* standard GSS method names (ordering is from mapfile) */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c ./jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c X--- ../orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -28,12 +28,19 @@ X #include <string.h> X X #include <dlfcn.h> X+#ifndef __APPLE__ X #include <link.h> X+#endif X X #include <jni_util.h> X X #include "j2secmod.h" X X+#ifndef RTLD_NOLOAD X+/* A gross hack that will work if the NSS library is only opened once */ X+static void *nssLibHandle = NULL; X+#endif X+ X void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) { X void *hModule = (void*)jHandle; X void *fAddress = dlsym(hModule, functionName); X@@ -51,7 +58,11 @@ JNIEXPORT jlong JNICALL Java_sun_securit X { X const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL); X // look up existing handle only, do not load X+#ifdef RTLD_NOLOAD X void *hModule = dlopen(libName, RTLD_NOLOAD); X+#else X+ void *hModule = nssLibHandle; X+#endif X dprintf2("-handle for %s: %u\n", libName, hModule); X (*env)->ReleaseStringUTFChars(env, jLibName, libName); X return (jlong)hModule; X@@ -65,6 +76,9 @@ JNIEXPORT jlong JNICALL Java_sun_securit X X dprintf1("-lib %s\n", libName); X hModule = dlopen(libName, RTLD_LAZY); X+#ifndef RTLD_NOLOAD X+ nssLibHandle = hModule; X+#endif X (*env)->ReleaseStringUTFChars(env, jLibName, libName); X dprintf2("-handle: %u (0X%X)\n", hModule, hModule); X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c ./jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c X--- ../orig/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -64,7 +64,9 @@ X #include <assert.h> X X #include <dlfcn.h> X+#ifndef __APPLE__ X #include <link.h> X+#endif X X #include <jni.h> X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c ./jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c X--- ../orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -29,7 +29,9 @@ X #include <assert.h> X X #include <dlfcn.h> X+#ifndef __APPLE__ X #include <link.h> X+#endif X X #include <winscard.h> X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c ./jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c X--- ../orig/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c 2009-05-14 23:41:34.000000000 -0400 X@@ -35,10 +35,10 @@ X #include <dirent.h> X #include <ctype.h> X #include <sys/types.h> X-#include <sys/types.h> X #include <sys/socket.h> X #include <sys/stat.h> X #include <sys/un.h> X+#include <fcntl.h> X X #include "sun_tools_attach_BsdVirtualMachine.h" X X@@ -49,85 +49,6 @@ X } while(0) X X /* X- * Defines a callback that is invoked for each process X- */ X-typedef void (*ProcessCallback)(const pid_t pid, void* user_data); X- X-/* X- * Invokes the callback function for each process X- */ X-static void forEachProcess(ProcessCallback f, void* user_data) { X- DIR* dir; X- struct dirent* ptr; X- X- /* X- * To locate the children we scan /proc looking for files that have a X- * position integer as a filename. X- */ X- if ((dir = opendir("/proc")) == NULL) { X- return; X- } X- while ((ptr = readdir(dir)) != NULL) { X- pid_t pid; X- X- /* skip current/parent directories */ X- if (strcmp(ptr->d_name, ".") == 0 || strcmp(ptr->d_name, "..") == 0) { X- continue; X- } X- X- /* skip files that aren't numbers */ X- pid = (pid_t)atoi(ptr->d_name); X- if ((int)pid <= 0) { X- continue; X- } X- X- /* invoke the callback */ X- (*f)(pid, user_data); X- } X- closedir(dir); X-} X- X- X-/* X- * Returns the parent pid of a given pid, or -1 if not found X- */ X-static pid_t getParent(pid_t pid) { X- char state; X- FILE* fp; X- char stat[2048]; X- int statlen; X- char fn[32]; X- int i, p; X- char* s; X- X- /* X- * try to open /proc/%d/stat X- */ X- sprintf(fn, "/proc/%d/stat", pid); X- fp = fopen(fn, "r"); X- if (fp == NULL) { X- return -1; X- } X- X- /* X- * The format is: pid (command) state ppid ... X- * As the command could be anything we must find the right most X- * ")" and then skip the white spaces that follow it. X- */ X- statlen = fread(stat, 1, 2047, fp); X- stat[statlen] = '\0'; X- fclose(fp); X- s = strrchr(stat, ')'); X- if (s == NULL) { X- return -1; X- } X- do s++; while (isspace(*s)); X- i = sscanf(s, "%c %d", &state, &p); X- return (pid_t)p; X-} X- X- X-/* X * Class: sun_tools_attach_BsdVirtualMachine X * Method: socket X * Signature: ()I X@@ -188,146 +109,6 @@ JNIEXPORT void JNICALL Java_sun_tools_at X X /* X * Class: sun_tools_attach_BsdVirtualMachine X- * Method: isBsdThreads X- * Signature: ()V X- */ X-JNIEXPORT jboolean JNICALL Java_sun_tools_attach_BsdVirtualMachine_isBsdThreads X- (JNIEnv *env, jclass cls) X-{ X-# ifndef _CS_GNU_LIBPTHREAD_VERSION X-# define _CS_GNU_LIBPTHREAD_VERSION 3 X-# endif X- size_t n; X- char* s; X- jboolean res; X- X- n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, 0); X- if (n <= 0) { X- /* glibc before 2.3.2 only has BsdThreads */ X- return JNI_TRUE; X- } X- X- s = (char *)malloc(n); X- if (s == NULL) { X- JNU_ThrowOutOfMemoryError(env, "malloc failed"); X- return JNI_TRUE; X- } X- confstr(_CS_GNU_LIBPTHREAD_VERSION, s, n); X- X- /* X- * If the LIBPTHREAD version include "NPTL" then we know we X- * have the new threads library and not BsdThreads X- */ X- res = (jboolean)(strstr(s, "NPTL") == NULL); X- free(s); X- return res; X-} X- X-/* X- * Structure and callback function used to count the children of X- * a given process, and record the pid of the "manager thread". X- */ X-typedef struct { X- pid_t ppid; X- int count; X- pid_t mpid; X-} ChildCountContext; X- X-static void ChildCountCallback(const pid_t pid, void* user_data) { X- ChildCountContext* context = (ChildCountContext*)user_data; X- if (getParent(pid) == context->ppid) { X- context->count++; X- /* X- * Remember the pid of the first child. If the final count is X- * one then this is the pid of the BsdThreads manager. X- */ X- if (context->count == 1) { X- context->mpid = pid; X- } X- } X-} X- X-/* X- * Class: sun_tools_attach_BsdVirtualMachine X- * Method: getBsdThreadsManager X- * Signature: (I)I X- */ X-JNIEXPORT jint JNICALL Java_sun_tools_attach_BsdVirtualMachine_getBsdThreadsManager X- (JNIEnv *env, jclass cls, jint pid) X-{ X- ChildCountContext context; X- X- /* X- * Iterate over all processes to find how many children 'pid' has X- */ X- context.ppid = pid; X- context.count = 0; X- context.mpid = (pid_t)0; X- forEachProcess(ChildCountCallback, (void*)&context); X- X- /* X- * If there's no children then this is likely the pid of the primordial X- * created by the launcher - in that case the BsdThreads manager is the X- * parent of this process. X- */ X- if (context.count == 0) { X- pid_t parent = getParent(pid); X- if ((int)parent > 0) { X- return (jint)parent; X- } X- } X- X- /* X- * There's one child so this is likely the embedded VM case where the X- * the primordial thread == BsdThreads initial thread. The BsdThreads X- * manager in that case is the child. X- */ X- if (context.count == 1) { X- return (jint)context.mpid; X- } X- X- /* X- * If we get here it's most likely we were given the wrong pid X- */ X- JNU_ThrowIOException(env, "Unable to get pid of BsdThreads manager thread"); X- return -1; X-} X- X-/* X- * Structure and callback function used to send a QUIT signal to all X- * children of a given process X- */ X-typedef struct { X- pid_t ppid; X-} SendQuitContext; X- X-static void SendQuitCallback(const pid_t pid, void* user_data) { X- SendQuitContext* context = (SendQuitContext*)user_data; X- pid_t parent = getParent(pid); X- if (parent == context->ppid) { X- kill(pid, SIGQUIT); X- } X-} X- X-/* X- * Class: sun_tools_attach_BsdVirtualMachine X- * Method: sendQuitToChildrenOf X- * Signature: (I)V X- */ X-JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_sendQuitToChildrenOf X- (JNIEnv *env, jclass cls, jint pid) X-{ X- SendQuitContext context; X- context.ppid = (pid_t)pid; X- X- /* X- * Iterate over all children of 'pid' and send a QUIT signal to each. X- */ X- forEachProcess(SendQuitCallback, (void*)&context); X-} X- X-/* X- * Class: sun_tools_attach_BsdVirtualMachine X * Method: sendQuitTo X * Signature: (I)V X */ X@@ -350,7 +131,7 @@ JNIEXPORT void JNICALL Java_sun_tools_at X jboolean isCopy; X const char* p = GetStringPlatformChars(env, path, &isCopy); X if (p != NULL) { X- struct stat64 sb; X+ struct stat sb; X uid_t uid, gid; X int res; X X@@ -361,7 +142,7 @@ JNIEXPORT void JNICALL Java_sun_tools_at X uid = geteuid(); X gid = getegid(); X X- res = stat64(p, &sb); X+ res = stat(p, &sb); X if (res != 0) { X /* save errno */ X res = errno; X@@ -459,3 +240,40 @@ JNIEXPORT void JNICALL Java_sun_tools_at X X } while (remaining > 0); X } X+ X+/* X+ * Class: sun_tools_attach_BSDVirtualMachine X+ * Method: createAttachFile X+ * Signature: (Ljava.lang.String;)V X+ */ X+JNIEXPORT void JNICALL Java_sun_tools_attach_BsdVirtualMachine_createAttachFile(JNIEnv *env, jclass cls, jstring path) X+{ X+ const char* _path; X+ jboolean isCopy; X+ int fd, rc; X+ X+ _path = GetStringPlatformChars(env, path, &isCopy); X+ if (_path == NULL) { X+ JNU_ThrowIOException(env, "Must specify a path"); X+ return; X+ } X+ X+ RESTARTABLE(open(_path, O_CREAT | O_EXCL, S_IWUSR | S_IRUSR), fd); X+ if (fd == -1) { X+ /* release p here before we throw an I/O exception */ X+ if (isCopy) { X+ JNU_ReleaseStringPlatformChars(env, path, _path); X+ } X+ JNU_ThrowIOExceptionWithLastError(env, "open"); X+ return; X+ } X+ X+ RESTARTABLE(chown(_path, geteuid(), getegid()), rc); X+ X+ RESTARTABLE(close(fd), rc); X+ X+ /* release p here */ X+ if (isCopy) { X+ JNU_ReleaseStringPlatformChars(env, path, _path); X+ } X+} Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/xawt/XWindow.c ./jdk/src/solaris/native/sun/xawt/XWindow.c X--- ../orig/jdk/src/solaris/native/sun/xawt/XWindow.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/xawt/XWindow.c 2009-05-14 23:41:34.000000000 -0400 X@@ -228,10 +228,10 @@ KeymapEntry keymapTable[] = X {java_awt_event_KeyEvent_VK_DOWN, XK_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD}, X X /* Keypad equivalents of Triangular Navigation Block */ X- {java_awt_event_KeyEvent_VK_KP_LEFT, XK_KP_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X- {java_awt_event_KeyEvent_VK_KP_UP, XK_KP_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X- {java_awt_event_KeyEvent_VK_KP_RIGHT, XK_KP_Right, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X- {java_awt_event_KeyEvent_VK_KP_DOWN, XK_KP_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X+ {java_awt_event_KeyEvent_VK_LEFT, XK_KP_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X+ {java_awt_event_KeyEvent_VK_UP, XK_KP_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X+ {java_awt_event_KeyEvent_VK_RIGHT, XK_KP_Right, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X+ {java_awt_event_KeyEvent_VK_DOWN, XK_KP_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD}, X X /* Other vendor-specific Triangular Navigation Block */ X {java_awt_event_KeyEvent_VK_LEFT, osfXK_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD}, X@@ -865,7 +865,7 @@ handleKeyEventWithNumLockMask(XEvent *ev X { X KeySym originalKeysym = *keysym; X X-#ifndef __linux__ X+#if !defined(__linux__) && !defined(_ALLBSD_SOURCE) X /* The following code on Linux will cause the keypad keys X * not to echo on JTextField when the NumLock is on. The X * keysyms will be 0, because the last parameter 2 is not defined. Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/xawt/awt_Desktop.c ./jdk/src/solaris/native/sun/xawt/awt_Desktop.c X--- ../orig/jdk/src/solaris/native/sun/xawt/awt_Desktop.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/xawt/awt_Desktop.c 2009-05-14 23:41:34.000000000 -0400 X@@ -24,6 +24,7 @@ X */ X X #include <jni.h> X+#include <jvm_md.h> X #include <dlfcn.h> X X typedef int gboolean; X@@ -36,7 +37,7 @@ int init(){ X gboolean (*gnome_vfs_init) (void); X const char *errmsg; X X- vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY); X+ vfs_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnomevfs-2", "0"), RTLD_LAZY); X if (vfs_handle == NULL) { X #ifdef INTERNAL_BUILD X fprintf(stderr, "can not load libgnomevfs-2.so\n"); X@@ -54,7 +55,7 @@ int init(){ X // call gonme_vfs_init() X (*gnome_vfs_init)(); X X- gnome_handle = dlopen("libgnome-2.so.0", RTLD_LAZY); X+ gnome_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnome-2", "0"), RTLD_LAZY); X if (gnome_handle == NULL) { X #ifdef INTERNAL_BUILD X fprintf(stderr, "can not load libgnome-2.so\n"); Xdiff -uNpr ../orig/jdk/src/solaris/npt/npt_md.h ./jdk/src/solaris/npt/npt_md.h X--- ../orig/jdk/src/solaris/npt/npt_md.h 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/npt/npt_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -32,9 +32,10 @@ X #include <string.h> X #include <errno.h> X #include <dlfcn.h> X+#ifndef __APPLE__ X #include <link.h> X- X-#define NPT_LIBNAME "libnpt.so" X+#endif X+#include <jvm_md.h> X X #define NPT_INITIALIZE(pnpt,version,options) \ X { \ X@@ -43,7 +44,7 @@ X \ X if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ X *(pnpt) = NULL; \ X- _handle = dlopen(NPT_LIBNAME, RTLD_LAZY); \ X+ _handle = dlopen(JNI_LIB_NAME("npt"), RTLD_LAZY); \ X if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ X _sym = dlsym(_handle, "nptInitialize"); \ X if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \ Xdiff -uNpr ../orig/jdk/src/solaris/transport/socket/socket_md.c ./jdk/src/solaris/transport/socket/socket_md.c X--- ../orig/jdk/src/solaris/transport/socket/socket_md.c 2009-04-24 03:34:35.000000000 -0400 X+++ ./jdk/src/solaris/transport/socket/socket_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -36,7 +36,7 @@ X #ifdef __solaris__ X #include <thread.h> X #endif X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <pthread.h> X #include <sys/poll.h> X #endif X@@ -283,7 +283,7 @@ dbgsysTlsGet(int index) { X X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X int X dbgsysTlsAlloc() { X pthread_key_t key; Xdiff -uNpr ../orig/langtools/src/share/classes/com/sun/tools/javah/Util.java ./langtools/src/share/classes/com/sun/tools/javah/Util.java X--- ../orig/langtools/src/share/classes/com/sun/tools/javah/Util.java 2009-04-24 03:35:10.000000000 -0400 X+++ ./langtools/src/share/classes/com/sun/tools/javah/Util.java 2009-05-14 23:41:34.000000000 -0400 X@@ -180,6 +180,14 @@ public class Util { X os = "win32"; X } else if (os.indexOf("Linux") >= 0) { X os = "Linux"; X+ } else if (os.indexOf("FreeBSD") >= 0) { X+ os = "FreeBSD"; X+ } else if (os.indexOf("Darwin") >= 0) { X+ os = "Darwin"; X+ } else if (os.indexOf("NetBSD") >= 0) { X+ os = "NetBSD"; X+ } else if (os.indexOf("OpenBSD") >= 0) { X+ os = "OpenBSD"; X } X String arch = System.getProperty("os.arch"); X String resname = "com.sun.tools.javah.resources." + os + "_" + arch; d493197f9e6abf9dfcc966db75771261 exit _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"