Date: Sun, 30 Aug 2009 17:01:51 +0200 From: Kurt Jaeger <fbsd-pr@opsec.eu> To: FreeBSD-gnats-submit@freebsd.org Cc: fbsd-pr@opsec.eu, openjdk@getsnappy.com, glewis@FreeBSD.org Subject: patch to java/openjdk6 to sucessful build Message-ID: <E1Mhluh-000N20-4M@f7.opsec.eu> Resent-Message-ID: <20090830150845.GN56042@home.opsec.eu>
next in thread | raw e-mail | index | archive | help
>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<OSTOP) */ 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<OSTOP) */ 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- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so X- EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so X- EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar X-else X- ifeq ($(ARCH),ia64) X- else X- EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so X- EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar X- endif X+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.$(LIBRARY_SUFFIX) X+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) X endif X+EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so X+EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/gcc.make ./hotspot/build/bsd/makefiles/gcc.make X--- ../orig/hotspot/build/bsd/makefiles/gcc.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/gcc.make 2009-05-14 23:41:33.000000000 -0400 X@@ -22,12 +22,15 @@ X # X # X X+OS_VENDOR = $(shell uname -s) X+ X #------------------------------------------------------------------------ X # CC, CPP & AS X X-CPP = g++ X-CC = gcc X-AS = $(CC) -c X+CXX ?= g++ X+CPP = $(CXX) X+CC ?= gcc X+AS = $(CC) -c -x assembler-with-cpp X X # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only X # prints the numbers (e.g. "2.95", "3.2.1") X@@ -62,7 +65,7 @@ endif X CFLAGS += $(VM_PICFLAG) X CFLAGS += -fno-rtti X CFLAGS += -fno-exceptions X-CFLAGS += -D_REENTRANT X+CFLAGS += -pthread X CFLAGS += -fcheck-new X X ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) X@@ -72,6 +75,15 @@ ARCHFLAG/ia64 = X ARCHFLAG/sparc = -m32 -mcpu=v9 X ARCHFLAG/sparcv9 = -m64 -mcpu=v9 X X+# Darwin-specific build flags X+ifeq ($(OS_VENDOR), Darwin) X+ # Ineffecient 16-byte stack re-alignment on Darwin/IA32 X+ ARCHFLAG/i486 += -mstackrealign X+ X+ # -arch compiler flag required for x64_64 X+ ARCHFLAGS/amd64 += -arch x86_64 X+endif X+ X CFLAGS += $(ARCHFLAG) X AOUT_FLAGS += $(ARCHFLAG) X LFLAGS += $(ARCHFLAG) X@@ -96,6 +108,11 @@ ACCEPTABLE_WARNINGS = -Wpointer-arith -W X CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS) X # Special cases X CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) X+# XXXDARWIN: for _dyld_bind_fully_image_containing_address X+ifeq ($(OS_VENDOR), Darwin) X+ CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations X+endif X+ X X # The flags to use for an Optimized g++ build X OPT_CFLAGS += -O3 X@@ -126,20 +143,40 @@ ifeq ($(BUILDARCH), ia64) X LFLAGS += -Wl,-relax X endif X X-# Enable linker optimization X-LFLAGS += -Xlinker -O1 X- X # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. X MAPFLAG = -Xlinker --version-script=FILENAME X X-# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj X-SONAMEFLAG = -Xlinker -soname=SONAME X+# X+# Shared Library X+# X+ifeq ($(OS_VENDOR), Darwin) X+ # Standard linker flags X+ LFLAGS += X+ X+ # Darwin doesn't use ELF and doesn't support version scripts X+ LDNOMAP = true X+ X+ # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj X+ SONAMEFLAG = X+ X+ # Build shared library X+ SHARED_FLAG = -dynamiclib $(VM_PICFLAG) X X-# Build shared library X-SHARED_FLAG = -shared X+ # Keep symbols even they are not used X+ #AOUT_FLAGS += -export-dynamic X+else X+ # Enable linker optimization X+ LFLAGS += -Xlinker -O1 X+ X+ # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj X+ SONAMEFLAG = -Xlinker -soname=SONAME X X-# Keep symbols even they are not used X-AOUT_FLAGS += -export-dynamic X+ # Build shared library X+ SHARED_FLAG = -shared $(VM_PICFLAG) X+ X+ # Keep symbols even they are not used X+ AOUT_FLAGS += -export-dynamic X+endif X X #------------------------------------------------------------------------ X # Debug flags Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/jsig.make ./hotspot/build/bsd/makefiles/jsig.make X--- ../orig/hotspot/build/bsd/makefiles/jsig.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/jsig.make 2009-05-14 23:41:33.000000000 -0400 X@@ -26,7 +26,12 @@ X X # libjsig[_g].so: signal interposition library X JSIG = jsig$(G_SUFFIX) X-LIBJSIG = lib$(JSIG).so X+ X+ifeq ($(OS_VENDOR), Darwin) X+ LIBJSIG = lib$(JSIG).dylib X+else X+ LIBJSIG = lib$(JSIG).so X+endif X X JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm X X@@ -39,12 +44,12 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfi X # cause problems with interposing. See CR: 6466665 X # LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) X X-LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT X+LFLAGS_JSIG += -D_GNU_SOURCE -pthread X X $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) X @echo Making signal interposition lib... X $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ X- $(LFLAGS_JSIG) -o $@ $< -ldl X+ $(LFLAGS_JSIG) -o $@ $< X X install_jsig: $(LIBJSIG) X @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/launcher.make ./hotspot/build/bsd/makefiles/launcher.make X--- ../orig/hotspot/build/bsd/makefiles/launcher.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/launcher.make 2009-05-14 23:41:33.000000000 -0400 X@@ -44,7 +44,7 @@ ifeq ($(LINK_INTO),AOUT) X LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS) X else X LAUNCHER.o = launcher.o X- LFLAGS_LAUNCHER += -L `pwd` X+ LFLAGS_LAUNCHER += -L`pwd` X LIBS_LAUNCHER += -l$(JVM) $(LIBS) X endif X Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/sa.make ./hotspot/build/bsd/makefiles/sa.make X--- ../orig/hotspot/build/bsd/makefiles/sa.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/sa.make 2009-05-14 23:41:33.000000000 -0400 X@@ -42,7 +42,7 @@ SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/too X X # gnumake 3.78.1 does not accept the *s that X # are in AGENT_ALLFILES, so use the shell to expand them X-AGENT_ALLFILES := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_ALLFILES)) X+AGENT_ALLFILES := $(shell /bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_ALLFILES)) X X SA_CLASSDIR = $(GENERATED)/saclasses X Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/saproc.make ./hotspot/build/bsd/makefiles/saproc.make X--- ../orig/hotspot/build/bsd/makefiles/saproc.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/saproc.make 2009-05-15 09:53:42.000000000 -0400 X@@ -26,7 +26,12 @@ X X # libsaproc[_g].so: serviceability agent X SAPROC = saproc$(G_SUFFIX) X-LIBSAPROC = lib$(SAPROC).so X+ X+ifeq ($(OS_VENDOR), Darwin) X+ LIBSAPROC = lib$(SAPROC).dylib X+else X+ LIBSAPROC = lib$(SAPROC).so X+endif X X AGENT_DIR = $(GAMMADIR)/agent X X@@ -37,6 +42,7 @@ SASRCFILES = $(SASRCDIR)/salibelf.c X $(SASRCDIR)/libproc_impl.c \ X $(SASRCDIR)/ps_proc.c \ X $(SASRCDIR)/ps_core.c \ X+ $(SASRCDIR)/hsearch_r.c \ X $(SASRCDIR)/BsdDebuggerLocal.c X X SAMAPFILE = $(SASRCDIR)/mapfile X@@ -53,6 +59,25 @@ checkAndBuildSA: X X SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) X X+# This is needed to avoid picking up the proc_service.h X+# header in SASRCDIR. We want to use the system provided one. X+ifeq ($(CC_VER_MAJOR), 3) X+INCSASRCDIR=-I$(SASRCDIR) -I- X+else X+INCSASRCDIR=-iquote $(SASRCDIR) X+endif X+ X+LIBUTIL= X+ifeq ($(OS_VENDOR), FreeBSD) X+# 7.0 and 6.x use ptrace X+# 7.1 and up use libutil for kinfo_getvmmap X+PTRACE_OS_VERSIONS = 5.% 6.% 7.0% X+EMPTY_IF_KINFO_GETVMMAP = $(filter $(PTRACE_OS_VERSIONS),$(shell uname -r)) X+ifeq ($(EMPTY_IF_KINFO_GETVMMAP),) X+LIBUTIL=-lutil X+endif X+endif X+ X $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) X $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ X echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ X@@ -61,13 +86,14 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) X @echo Making SA debugger back-end... X $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ X $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ X- -I$(SASRCDIR) \ X+ $(INCSASRCDIR) \ X -I$(GENERATED) \ X -I$(BOOT_JAVA_HOME)/include \ X- -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ X+ -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \ X $(SASRCFILES) \ X $(SA_LFLAGS) \ X -o $@ \ X+ $(LIBUTIL) \ X -lthread_db X X install_saproc: checkAndBuildSA Xdiff -uNpr ../orig/hotspot/build/bsd/makefiles/vm.make ./hotspot/build/bsd/makefiles/vm.make X--- ../orig/hotspot/build/bsd/makefiles/vm.make 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/makefiles/vm.make 2009-05-14 23:41:33.000000000 -0400 X@@ -93,7 +93,7 @@ CFLAGS += $(CFLAGS/NOEX) X # Extra flags from gnumake's invocation or environment X CFLAGS += $(EXTRA_CFLAGS) X X-LIBS += -lm -ldl -lpthread X+LIBS += -lm -pthread X X # By default, link the *.o into the library, not the executable. X LINK_INTO$(LINK_INTO) = LIBJVM X@@ -108,7 +108,11 @@ include $(MAKEFILES_DIR)/dtrace.make X # JVM X X JVM = jvm$(G_SUFFIX) X-LIBJVM = lib$(JVM).so X+ifeq ($(OS_VENDOR), Darwin) X+ LIBJVM = lib$(JVM).dylib X+else X+ LIBJVM = lib$(JVM).so X+endif X X JVM_OBJ_FILES = $(Obj_Files) X X@@ -122,7 +126,7 @@ mapfile_reorder : mapfile $(REORDERFILE) X rm -f $@ X cat $^ > $@ X X-STATIC_CXX = true X+STATIC_CXX = false X X ifeq ($(LINK_INTO),AOUT) X LIBJVM.o = X@@ -140,14 +144,14 @@ else X ifeq ($(STATIC_CXX), true) X LFLAGS_VM += $(STATIC_LIBGCC) X LIBS_VM += $(STATIC_STDCXX) X+ LINK_VM = $(LINK_LIB.c) X else X- LIBS_VM += -lstdc++ X+ LINK_VM = $(LINK_LIB.CC) X endif X X LIBS_VM += $(LIBS) X endif X X-LINK_VM = $(LINK_LIB.c) X X # rule for building precompiled header X $(PRECOMPILED_HEADER): $(Precompiled_Files) X@@ -175,11 +179,6 @@ $(LD_SCRIPT): $(LIBJVM_MAPFILE) X LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT) X endif X X-# With more recent Redhat releases (or the cutting edge version Fedora), if X-# SEBsd is configured to be enabled, the runtime linker will fail to apply X-# the text relocation to libjvm.so considering that it is built as a non-PIC X-# DSO. To workaround that, we run chcon to libjvm.so after it is built. See X-# details in bug 6538311. X $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) X $(QUIETLY) { \ X echo Linking vm...; \ X@@ -188,15 +187,6 @@ $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) X $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ X $(LINK_LIB.CC/POST_HOOK) \ X rm -f $@.1; ln -s $@ $@.1; \ X- if [ -x /usr/sbin/sebsdenabled ] ; then \ X- /usr/sbin/sebsdenabled; \ X- if [ $$? = 0 ] ; then \ X- /usr/bin/chcon -t textrel_shlib_t $@; \ X- if [ $$? != 0 ]; then \ X- echo "ERROR: Cannot chcon $@"; exit 1; \ X- fi \ X- fi \ X- fi \ X } X X DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM) Xdiff -uNpr ../orig/hotspot/build/bsd/platform_amd64 ./hotspot/build/bsd/platform_amd64 X--- ../orig/hotspot/build/bsd/platform_amd64 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/platform_amd64 2009-05-14 23:41:33.000000000 -0400 X@@ -12,6 +12,4 @@ lib_arch = amd64 X X compiler = gcc X X-gnu_dis_arch = amd64 X- X-sysdefs = -DLINUX -D_GNU_SOURCE -DAMD64 X+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64 Xdiff -uNpr ../orig/hotspot/build/bsd/platform_i486 ./hotspot/build/bsd/platform_i486 X--- ../orig/hotspot/build/bsd/platform_i486 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/platform_i486 2009-05-14 23:41:33.000000000 -0400 X@@ -12,6 +12,4 @@ lib_arch = i386 X X compiler = gcc X X-gnu_dis_arch = i386 X- X-sysdefs = -DLINUX -D_GNU_SOURCE -DIA32 X+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA32 Xdiff -uNpr ../orig/hotspot/build/bsd/platform_sparc ./hotspot/build/bsd/platform_sparc X--- ../orig/hotspot/build/bsd/platform_sparc 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/build/bsd/platform_sparc 2009-05-14 23:41:33.000000000 -0400 X@@ -12,6 +12,6 @@ lib_arch = sparc X X compiler = gcc X X-gnu_dis_arch = sparc X+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DSPARC X X sysdefs = -DLINUX -D_GNU_SOURCE -DSPARC Xdiff -uNpr ../orig/hotspot/build/sa.files ./hotspot/build/sa.files X--- ../orig/hotspot/build/sa.files 2009-04-24 03:30:52.000000000 -0400 X+++ ./hotspot/build/sa.files 2009-05-14 23:41:34.000000000 -0400 X@@ -40,6 +40,7 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/HotSpot X $(AGENT_SRC_DIR)/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/HotSpotTypeDataBase.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/LinuxVtblAccess.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/BsdVtblAccess.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/ObjectHistogram.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/RMIHelper.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/StackTrace.java \ X@@ -76,6 +77,9 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugge X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dbx/x86/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/amd64/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ia64/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \ X@@ -110,6 +114,9 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/memory/ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/oops/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/amd64/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_amd64/*.java \ X+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ia64/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \ Xdiff -uNpr ../orig/hotspot/make/Makefile ./hotspot/make/Makefile X--- ../orig/hotspot/make/Makefile 2009-04-24 03:30:52.000000000 -0400 X+++ ./hotspot/make/Makefile 2009-05-14 23:41:33.000000000 -0400 X@@ -262,6 +262,19 @@ endif X X # Shared Library X ifneq ($(OSNAME),windows) X+ifeq ($(OSNAME),bsd) X+# BSD-specific LIBRARY_SUFFIX build option X+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+else X $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so X $(install-file) X $(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so X@@ -273,6 +286,7 @@ $(EXPORT_SERVER_DIR)/%.so: $(C2_DI X $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so X $(install-file) X endif X+endif X X # Jar file (sa-jdi.jar) X $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar Xdiff -uNpr ../orig/hotspot/make/defs.make ./hotspot/make/defs.make X--- ../orig/hotspot/make/defs.make 2009-04-24 03:30:52.000000000 -0400 X+++ ./hotspot/make/defs.make 2009-05-14 23:41:33.000000000 -0400 X@@ -118,13 +118,23 @@ endif X # Windows should have OS predefined X ifeq ($(OS),) X OS := $(shell uname -s) X+ ifneq ($(findstring BSD,$(OS)),) X+ OS=bsd X+ endif X+ ifeq ($(OS), Darwin) X+ OS=bsd X+ endif X HOST := $(shell uname -n) X endif X X-# If not SunOS and not Linux, assume Windows X+# If not SunOS, not Linux and not BSD, assume Windows X ifneq ($(OS), Linux) X ifneq ($(OS), SunOS) X- OSNAME=windows X+ ifneq ($(OS), bsd) X+ OSNAME=windows X+ else X+ OSNAME=bsd X+ endif X else X OSNAME=solaris X endif Xdiff -uNpr ../orig/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp ./hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp X--- ../orig/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp 2009-04-24 03:30:53.000000000 -0400 X+++ ./hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -57,7 +57,7 @@ void InterpreterRuntime::SignatureHandle X __ cmpl(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), 0); // do not use temp() to avoid AGI X Label L; X __ jcc(Assembler::notZero, L); X- __ movl(temp(), 0); X+ __ movl(temp(), NULL_WORD); X __ bind(L); X __ movl(Address(to(), to_offset * wordSize), temp()); X } X@@ -113,7 +113,7 @@ class SlowSignatureHandler: public Nativ X virtual void pass_object() { X // pass address of from X intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); X- *_to++ = (*(intptr_t*)from_addr == 0) ? NULL : from_addr; X+ *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; X debug_only(verify_tag(frame::TagReference)); X _from -= Interpreter::stackElementSize(); X } Xdiff -uNpr ../orig/hotspot/src/cpu/x86/vm/jni_x86.h ./hotspot/src/cpu/x86/vm/jni_x86.h X--- ../orig/hotspot/src/cpu/x86/vm/jni_x86.h 2009-04-24 03:30:53.000000000 -0400 X+++ ./hotspot/src/cpu/x86/vm/jni_x86.h 2009-05-14 23:41:33.000000000 -0400 X@@ -29,7 +29,7 @@ X #ifndef _JAVASOFT_JNI_MD_H_ X #define _JAVASOFT_JNI_MD_H_ X X-#if defined(SOLARIS) || defined(LINUX) X+#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) X #define JNIEXPORT X #define JNIIMPORT X #define JNICALL Xdiff -uNpr ../orig/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp ./hotspot/src/cpu/x86/vm/runtime_x86_32.cpp X--- ../orig/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp 2009-04-24 03:30:53.000000000 -0400 X+++ ./hotspot/src/cpu/x86/vm/runtime_x86_32.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -132,11 +132,11 @@ void OptoRuntime::generate_exception_blo X // Get the exception pc in case we are deoptimized X __ movl(rdx, Address(rcx, JavaThread::exception_pc_offset())); X #ifdef ASSERT X- __ movl(Address(rcx, JavaThread::exception_handler_pc_offset()), 0); X- __ movl(Address(rcx, JavaThread::exception_pc_offset()), 0); X+ __ movl(Address(rcx, JavaThread::exception_handler_pc_offset()), NULL_WORD); X+ __ movl(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD); X #endif X // Clear the exception oop so GC no longer processes it as a root. X- __ movl(Address(rcx, JavaThread::exception_oop_offset()), 0); X+ __ movl(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD); X X __ popl(rcx); X Xdiff -uNpr ../orig/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp ./hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp X--- ../orig/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp 2009-04-24 03:30:53.000000000 -0400 X+++ ./hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -472,7 +472,7 @@ class StubGenerator: public StubCodeGene X // setup rax & rdx, remove return address & clear pending exception X __ popq(rdx); X __ movq(rax, Address(r15_thread, Thread::pending_exception_offset())); X- __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int)NULL_WORD); X+ __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); X X #ifdef ASSERT X // make sure exception is set X@@ -941,9 +941,9 @@ class StubGenerator: public StubCodeGene X __ jcc(Assembler::zero, exit); // if obj is NULL it is OK X // Check if the oop is in the right area of memory X __ movq(c_rarg2, rax); X- __ movptr(c_rarg3, (int64_t) Universe::verify_oop_mask()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask()); X __ andq(c_rarg2, c_rarg3); X- __ movptr(c_rarg3, (int64_t) Universe::verify_oop_bits()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits()); X __ cmpq(c_rarg2, c_rarg3); X __ jcc(Assembler::notZero, error); X X@@ -953,9 +953,9 @@ class StubGenerator: public StubCodeGene X __ jcc(Assembler::zero, error); // if klass is NULL it is broken X // Check if the klass is in the right area of memory X __ movq(c_rarg2, rax); X- __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); X __ andq(c_rarg2, c_rarg3); X- __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); X __ cmpq(c_rarg2, c_rarg3); X __ jcc(Assembler::notZero, error); X X@@ -964,9 +964,9 @@ class StubGenerator: public StubCodeGene X __ testq(rax, rax); X __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken X // Check if the klass' klass is in the right area of memory X- __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); X __ andq(rax, c_rarg3); X- __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits()); X+ __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); X __ cmpq(rax, c_rarg3); X __ jcc(Assembler::notZero, error); X Xdiff -uNpr ../orig/hotspot/src/cpu/x86/vm/x86_32.ad ./hotspot/src/cpu/x86/vm/x86_32.ad X--- ../orig/hotspot/src/cpu/x86/vm/x86_32.ad 2009-04-24 03:30:53.000000000 -0400 X+++ ./hotspot/src/cpu/x86/vm/x86_32.ad 2009-05-14 23:41:33.000000000 -0400 X@@ -3364,7 +3364,7 @@ encode %{ X masm.movl (Address(boxReg, 0), 3) ; // results in ST-before-CAS penalty X masm.get_thread (scrReg) ; X masm.movl (boxReg, tmpReg); // consider: LEA box, [tmp-2] X- masm.movl (tmpReg, 0); // consider: xor vs mov X+ masm.movl (tmpReg, NULL_WORD); // consider: xor vs mov X if (os::is_MP()) { masm.lock(); } X masm.cmpxchg (scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; X } else X@@ -3383,7 +3383,7 @@ encode %{ X X if ((EmitSync & 64) == 0) { X // Optimistic form: consider XORL tmpReg,tmpReg X- masm.movl (tmpReg, 0 ) ; X+ masm.movl (tmpReg, NULL_WORD ) ; X } else { X // Can suffer RTS->RTO upgrades on shared or cold $ lines X // Test-And-CAS instead of CAS X@@ -3589,7 +3589,7 @@ encode %{ X masm.orl (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; X masm.orl (boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; X masm.jccb (Assembler::notZero, DONE_LABEL) ; X- masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; X+ masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; X masm.jmpb (DONE_LABEL) ; X } else { X masm.xorl (boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; X@@ -3598,7 +3598,7 @@ encode %{ X masm.movl (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; X masm.orl (boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; X masm.jccb (Assembler::notZero, CheckSucc) ; X- masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; X+ masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; X masm.jmpb (DONE_LABEL) ; X } X X@@ -3646,7 +3646,7 @@ encode %{ X // We currently use (3), although it's likely that switching to (2) X // is correct for the future. X X- masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; X+ masm.movl (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; X if (os::is_MP()) { X if (VM_Version::supports_sse2() && 1 == FenceInstruction) { X masm.emit_raw (0x0F) ; // MFENCE ... Xdiff -uNpr ../orig/hotspot/src/os/bsd/launcher/java_md.c ./hotspot/src/os/bsd/launcher/java_md.c X--- ../orig/hotspot/src/os/bsd/launcher/java_md.c 2009-05-14 23:40:13.000000000 -0400 X+++ ./hotspot/src/os/bsd/launcher/java_md.c 2009-05-14 23:41:33.000000000 -0400 X@@ -45,8 +45,15 @@ X #include "version_comp.h" X #endif X X+#ifdef __APPLE__ X+#define JVM_DLL "libjvm.dylib" X+#define JAVA_DLL "libjava.dylib" X+#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH" X+#else X #define JVM_DLL "libjvm.so" X #define JAVA_DLL "libjava.so" X+#define LD_LIBRARY_PATH "LD_LIBRARY_PATH" X+#endif X X #ifndef GAMMA /* launcher.make defines ARCH */ X X@@ -112,7 +119,7 @@ extern char **environ; X * A collection of useful strings. One should think of these as #define X * entries, but actual strings can be more efficient (with many compilers). X */ X-#ifdef __bsd__ X+#ifdef _ALLBSD_SOURCE X static const char *system_dir = "/usr/java"; X static const char *user_dir = "/java"; X #else /* Solaris */ X@@ -456,10 +463,10 @@ CreateExecutionEnvironment(int *_argcp, X * If not on Solaris, assume only a single LD_LIBRARY_PATH X * variable. X */ X- runpath = getenv("LD_LIBRARY_PATH"); X+ runpath = getenv(LD_LIBRARY_PATH); X #endif /* __sun */ X X-#ifdef __bsd X+#ifdef _ALLBSD_SOURCE X /* X * On bsd, if a binary is running as sgid or suid, glibc sets X * LD_LIBRARY_PATH to the empty string for security purposes. (In X@@ -836,7 +843,7 @@ GetXUsagePath(char *buf, jint bufsize) X jboolean X GetApplicationHome(char *buf, jint bufsize) X { X-#ifdef __bsd__ X+#ifdef _ALLBSD_SOURCE X char *execname = GetExecname(); X if (execname) { X strncpy(buf, execname, bufsize-1); X@@ -1005,7 +1012,7 @@ SetExecname(char **argv) X } X } X } X-#elif defined(__bsd__) X+#elif defined(__linux__) X { X const char* self = "/proc/self/exe"; X char buf[PATH_MAX+1]; X@@ -1015,7 +1022,7 @@ SetExecname(char **argv) X exec_path = strdup(buf); X } X } X-#else /* !__sun && !__bsd */ X+#else /* !__sun && !__linux */ X { X /* Not implemented */ X } X@@ -1220,7 +1227,7 @@ get_cpuid(uint32_t arg, X X #endif /* __sun && i586 */ X X-#if defined(__bsd__) && defined(i586) X+#if defined(_ALLBSD_SOURCE) && defined(i586) X X /* X * A utility method for asking the CPU about itself. X@@ -1286,7 +1293,7 @@ get_cpuid(uint32_t arg, X #endif X } X X-#endif /* __bsd__ && i586 */ X+#endif /* _ALLBSD_SOURCE && i586 */ X X #ifdef i586 X /* X@@ -1465,7 +1472,7 @@ solaris_i586_ServerClassMachine(void) { X X #endif /* __sun && i586 */ X X-#if defined(__bsd__) && defined(i586) X+#if defined(_ALLBSD_SOURCE) && defined(i586) X X /* The definition of a server-class machine for bsd-i586 */ X jboolean X@@ -1496,7 +1503,7 @@ bsd_i586_ServerClassMachine(void) { X return result; X } X X-#endif /* __bsd__ && i586 */ X+#endif /* _ALLBSD_SOURCE && i586 */ X X /* Dispatch to the platform-specific definition of "server-class" */ X jboolean X@@ -1506,7 +1513,7 @@ ServerClassMachine(void) { X result = solaris_sparc_ServerClassMachine(); X #elif defined(__sun) && defined(i586) X result = solaris_i586_ServerClassMachine(); X-#elif defined(__bsd__) && defined(i586) X+#elif defined(_ALLBSD_SOURCE) && defined(i586) X result = bsd_i586_ServerClassMachine(); X #else X if (_launcher_debug) { Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/attachListener_bsd.cpp ./hotspot/src/os/bsd/vm/attachListener_bsd.cpp X--- ../orig/hotspot/src/os/bsd/vm/attachListener_bsd.cpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/attachListener_bsd.cpp 2009-05-14 23:41:34.000000000 -0400 X@@ -182,32 +182,20 @@ int BsdAttachListener::init() { X struct sockaddr_un addr; X addr.sun_family = AF_UNIX; X X- // FIXME: Prior to b39 the tool-side API expected to find the well X- // known file in the working directory. To allow this libjvm.so work with X- // a pre-b39 SDK we create it in the working directory if X- // +StartAttachListener is used is used. All unit tests for this feature X- // currently used this flag. Once b39 SDK has been promoted we can remove X- // this code. X- if (StartAttachListener) { X- sprintf(path, ".java_pid%d", os::current_process_id()); X- strcpy(addr.sun_path, path); X- ::unlink(path); X- res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr)); X- } X- if (res == -1) { X- sprintf(path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id()); X- strcpy(addr.sun_path, path); X- ::unlink(path); X- res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr)); X- } X+ X+ sprintf(path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id()); X+ strcpy(addr.sun_path, path); X+ ::unlink(path); X+ res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr)); X if (res == -1) { X RESTARTABLE(::close(listener), res); X return -1; X } X set_path(path); X X- // put in listen mode and set permission X- if ((::listen(listener, 5) == -1) || (::chmod(path, S_IREAD|S_IWRITE) == -1)) { X+ // put in listen mode and set permission and ownership X+ if ((::listen(listener, 5) == -1) || (::chmod(path, S_IREAD|S_IWRITE) == -1) || X+ (::chown(path, geteuid(), getegid()) == -1)) { X RESTARTABLE(::close(listener), res); X ::unlink(path); X set_path(NULL); X@@ -333,6 +321,15 @@ BsdAttachOperation* BsdAttachListener::d X X // get the credentials of the peer and check the effective uid/guid X // - check with jeff on this. X+#ifdef _ALLBSD_SOURCE X+ uid_t puid; X+ gid_t pgid; X+ if (::getpeereid(s, &puid, &pgid) != 0) { X+ int res; X+ RESTARTABLE(::close(s), res); X+ continue; X+ } X+#else X struct ucred cred_info; X socklen_t optlen = sizeof(cred_info); X if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) { X@@ -340,10 +337,13 @@ BsdAttachOperation* BsdAttachListener::d X RESTARTABLE(::close(s), res); X continue; X } X+ uid_t puid = cred_info.uid; X+ gid_t pgid = cred_info.gid; X+#endif X uid_t euid = geteuid(); X gid_t egid = getegid(); X X- if (cred_info.uid != euid || cred_info.gid != egid) { X+ if (puid != euid || pgid != egid) { X int res; X RESTARTABLE(::close(s), res); X continue; X@@ -463,15 +463,12 @@ bool AttachListener::is_init_trigger() { X if (init_at_startup() || is_initialized()) { X return false; // initialized at startup or already initialized X } X- char fn[32]; X- sprintf(fn, ".attach_pid%d", os::current_process_id()); X+ char path[PATH_MAX + 1]; X int ret; X- struct stat64 st; X- RESTARTABLE(::stat64(fn, &st), ret); X- if (ret == -1) { X- sprintf(fn, "/tmp/.attach_pid%d", os::current_process_id()); X- RESTARTABLE(::stat64(fn, &st), ret); X- } X+ struct stat st; X+ X+ sprintf(path, "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id()); X+ RESTARTABLE(::stat(path, &st), ret); X if (ret == 0) { X // simple check to avoid starting the attach mechanism when X // a bogus user creates the file Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/hpi_bsd.cpp ./hotspot/src/os/bsd/vm/hpi_bsd.cpp X--- ../orig/hotspot/src/os/bsd/vm/hpi_bsd.cpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/hpi_bsd.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -31,6 +31,14 @@ X # include <sys/param.h> X # include <dlfcn.h> X X+#ifdef __APPLE__ X+#define HPI_LIB "libhpi.dylib" X+#define HPI_G_LIB "libhpi.dylib" X+#else X+#define HPI_LIB "libhpi.so" X+#define HPI_G_LIB "libhpi.so" X+#endif X+ X typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *); X X void hpi::initialize_get_interface(vm_calls_t *callbacks) { X@@ -48,11 +56,11 @@ void hpi::initialize_get_interface(vm_ca X os::jvm_path(buf, JVM_MAXPATHLEN); X X #ifdef PRODUCT X- const char * hpi_lib = "/libhpi.so"; X+ const char * hpi_lib = "/" HPI_LIB; X #else X char * ptr = strrchr(buf, '/'); X assert(strstr(ptr, "/libjvm") == ptr, "invalid library name"); X- const char * hpi_lib = strstr(ptr, "_g") ? "/libhpi_g.so" : "/libhpi.so"; X+ const char * hpi_lib = strstr(ptr, "_g") ? "/" HPI_G_LIB : "/" HPI_LIB; X #endif X X *(strrchr(buf, '/')) = '\0'; /* get rid of /libjvm.so */ Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/hpi_bsd.hpp ./hotspot/src/os/bsd/vm/hpi_bsd.hpp X--- ../orig/hotspot/src/os/bsd/vm/hpi_bsd.hpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/hpi_bsd.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -39,26 +39,22 @@ X // HPI_FileInterface X X inline int hpi::close(int fd) { X- return ::close(fd); X+ RESTARTABLE_RETURN_INT(::close(fd)); X } X X inline size_t hpi::read(int fd, void *buf, unsigned int nBytes) { X- size_t res; X- RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res); X- return res; X+ INTERRUPTIBLE_RETURN_INT(::read(fd, buf, (size_t) nBytes), os::Bsd::clear_interrupted); X } X X inline size_t hpi::write(int fd, const void *buf, unsigned int nBytes) { X- size_t res; X- RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res); X- return res; X+ INTERRUPTIBLE_RETURN_INT(::write(fd, buf, (size_t) nBytes), os::Bsd::clear_interrupted); X } X X X // HPI_SocketInterface X X inline int hpi::socket_close(int fd) { X- return ::close(fd); X+ RESTARTABLE_RETURN_INT(::close(fd)); X } X X inline int hpi::socket(int domain, int type, int protocol) { X@@ -66,11 +62,11 @@ inline int hpi::socket(int domain, int t X } X X inline int hpi::recv(int fd, char *buf, int nBytes, int flags) { X- RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags)); X+ INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags), os::Bsd::clear_interrupted); X } X X inline int hpi::send(int fd, char *buf, int nBytes, int flags) { X- RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags)); X+ INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags), os::Bsd::clear_interrupted); X } X X inline int hpi::timeout(int fd, long timeout) { X@@ -81,12 +77,13 @@ inline int hpi::timeout(int fd, long tim X prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000; X X for(;;) { X+ int res; X struct pollfd pfd; X X pfd.fd = fd; X pfd.events = POLLIN | POLLERR; X X- int res = ::poll(&pfd, 1, timeout); X+ INTERRUPTIBLE_NORESTART(::poll(&pfd, 1, timeout), res, os::Bsd::clear_interrupted); X X if (res == OS_ERR && errno == EINTR) { X X@@ -110,7 +107,26 @@ inline int hpi::listen(int fd, int count X } X X inline int hpi::connect(int fd, struct sockaddr *him, int len) { X- RESTARTABLE_RETURN_INT(::connect(fd, him, len)); X+ do { X+ int _result; X+ INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result, X+ os::Bsd::clear_interrupted); X+ X+ // Depending on when thread interruption is reset, _result could be X+ // one of two values when errno == EINTR X+ X+ if (((_result == OS_INTRPT) || (_result == OS_ERR)) && (errno == EINTR)) { X+ /* restarting a connect() changes its errno semantics */ X+ INTERRUPTIBLE(::connect(fd, him, len), _result, X+ os::Bsd::clear_interrupted); X+ /* undo these changes */ X+ if (_result == OS_ERR) { X+ if (errno == EALREADY) errno = EINPROGRESS; /* fall through */ X+ else if (errno == EISCONN) { errno = 0; return OS_OK; } X+ } X+ } X+ return _result; X+ } while(false); X } X X inline int hpi::accept(int fd, struct sockaddr *him, int *len) { X@@ -121,26 +137,33 @@ inline int hpi::accept(int fd, struct so X // to 64 bits on some platform that we support. X // Bsd doc says this can't return EINTR, unlike accept() on Solaris X X- return ::accept(fd, him, (socklen_t *)len); X+ if (fd < 0) X+ return OS_ERR; X+ INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him, (socklen_t*) len), os::Bsd::clear_interrupted); X } X X inline int hpi::recvfrom(int fd, char *buf, int nBytes, int flags, X sockaddr *from, int *fromlen) { X- RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen)); X+ INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen), os::Bsd::clear_interrupted); X } X X inline int hpi::sendto(int fd, char *buf, int len, int flags, X struct sockaddr *to, int tolen) { X- RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); X+ INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, (unsigned int) flags, to, tolen),os::Bsd::clear_interrupted); X } X X inline int hpi::socket_available(int fd, jint *pbytes) { X // Bsd doc says EINTR not returned, unlike Solaris X- int ret = ::ioctl(fd, FIONREAD, pbytes); X+ int ret; X+ X+ if (fd < 0) X+ return OS_OK; X+ X+ RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); X X //%% note ioctl can return 0 when successful, JVM_SocketAvailable X // is expected to return 0 on failure and 1 on success to the jdk. X- return (ret < 0) ? 0 : 1; X+ return (ret == OS_ERR) ? 0 : 1; X } X X X@@ -167,7 +190,7 @@ HPIDECL(bind, "bind", _socket, Bind, X (fd, him, len)); X */ X inline int hpi::bind(int fd, struct sockaddr *him, int len){ X- return ::bind(fd, him, len); X+ INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),os::Bsd::clear_interrupted); X } X X /* Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/jsig.c ./hotspot/src/os/bsd/vm/jsig.c X--- ../orig/hotspot/src/os/bsd/vm/jsig.c 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/jsig.c 2009-05-14 23:41:33.000000000 -0400 X@@ -146,7 +146,8 @@ sa_handler_t signal(int sig, sa_handler_ X } X X sa_handler_t sigset(int sig, sa_handler_t disp) { X- return set_signal(sig, disp, true); X+ printf("sigset() is not supported by BSD"); X+ exit(0); X } X X static int call_os_sigaction(int sig, const struct sigaction *act, Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/jvm_bsd.cpp ./hotspot/src/os/bsd/vm/jvm_bsd.cpp X--- ../orig/hotspot/src/os/bsd/vm/jvm_bsd.cpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/jvm_bsd.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -141,44 +141,37 @@ struct siglabel { X X struct siglabel siglabels[] = { X /* derived from /usr/include/bits/signum.h on RH7.2 */ X- "HUP", SIGHUP, /* Hangup (POSIX). */ X+ "HUP", SIGHUP, /* Hangup (POSIX). */ X "INT", SIGINT, /* Interrupt (ANSI). */ X "QUIT", SIGQUIT, /* Quit (POSIX). */ X "ILL", SIGILL, /* Illegal instruction (ANSI). */ X "TRAP", SIGTRAP, /* Trace trap (POSIX). */ X "ABRT", SIGABRT, /* Abort (ANSI). */ X- "IOT", SIGIOT, /* IOT trap (4.2 BSD). */ X- "BUS", SIGBUS, /* BUS error (4.2 BSD). */ X+ "EMT", SIGEMT, /* EMT trap */ X "FPE", SIGFPE, /* Floating-point exception (ANSI). */ X "KILL", SIGKILL, /* Kill, unblockable (POSIX). */ X- "USR1", SIGUSR1, /* User-defined signal 1 (POSIX). */ X+ "BUS", SIGBUS, /* BUS error (4.2 BSD). */ X "SEGV", SIGSEGV, /* Segmentation violation (ANSI). */ X- "USR2", SIGUSR2, /* User-defined signal 2 (POSIX). */ X+ "SYS", SIGSYS, /* Bad system call. Only on some Bsden! */ X "PIPE", SIGPIPE, /* Broken pipe (POSIX). */ X "ALRM", SIGALRM, /* Alarm clock (POSIX). */ X "TERM", SIGTERM, /* Termination (ANSI). */ X-#ifdef SIGSTKFLT X- "STKFLT", SIGSTKFLT, /* Stack fault. */ X-#endif X- "CLD", SIGCLD, /* Same as SIGCHLD (System V). */ X- "CHLD", SIGCHLD, /* Child status has changed (POSIX). */ X- "CONT", SIGCONT, /* Continue (POSIX). */ X+ "URG", SIGURG, /* Urgent condition on socket (4.2 BSD). */ X "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */ X "TSTP", SIGTSTP, /* Keyboard stop (POSIX). */ X+ "CONT", SIGCONT, /* Continue (POSIX). */ X+ "CHLD", SIGCHLD, /* Child status has changed (POSIX). */ X "TTIN", SIGTTIN, /* Background read from tty (POSIX). */ X "TTOU", SIGTTOU, /* Background write to tty (POSIX). */ X- "URG", SIGURG, /* Urgent condition on socket (4.2 BSD). */ X+ "IO", SIGIO, /* I/O now possible (4.2 BSD). */ X "XCPU", SIGXCPU, /* CPU limit exceeded (4.2 BSD). */ X "XFSZ", SIGXFSZ, /* File size limit exceeded (4.2 BSD). */ X "VTALRM", SIGVTALRM, /* Virtual alarm clock (4.2 BSD). */ X "PROF", SIGPROF, /* Profiling alarm clock (4.2 BSD). */ X "WINCH", SIGWINCH, /* Window size change (4.3 BSD, Sun). */ X- "POLL", SIGPOLL, /* Pollable event occurred (System V). */ X- "IO", SIGIO, /* I/O now possible (4.2 BSD). */ X- "PWR", SIGPWR, /* Power failure restart (System V). */ X-#ifdef SIGSYS X- "SYS", SIGSYS /* Bad system call. Only on some Bsden! */ X-#endif X+ "INFO", SIGINFO, /* Information request. */ X+ "USR1", SIGUSR1, /* User-defined signal 1 (POSIX). */ X+ "USR2", SIGUSR2 /* User-defined signal 2 (POSIX). */ X }; X X JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name)) Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/jvm_bsd.h ./hotspot/src/os/bsd/vm/jvm_bsd.h X--- ../orig/hotspot/src/os/bsd/vm/jvm_bsd.h 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/jvm_bsd.h 2009-05-14 23:41:33.000000000 -0400 X@@ -54,7 +54,11 @@ X #define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} X X #define JNI_LIB_PREFIX "lib" X+#ifdef __APPLE__ X+#define JNI_LIB_SUFFIX ".dylib" X+#else X #define JNI_LIB_SUFFIX ".so" X+#endif X X // Hack: MAXPATHLEN is 4095 on some Bsd and 4096 on others. This may X // cause problems if JVM and the rest of JDK are built on different X@@ -93,6 +97,20 @@ X #define SHUTDOWN2_SIGNAL SIGINT X #define SHUTDOWN3_SIGNAL SIGTERM X X+#ifndef SIGRTMIN X+#ifdef __OpenBSD__ X+#define SIGRTMIN 1 X+#else X+#define SIGRTMIN 33 X+#endif X+#endif X+#ifndef SIGRTMAX X+#ifdef __OpenBSD__ X+#define SIGRTMAX 31 X+#else X+#define SIGRTMAX 63 X+#endif X+#endif X #endif /* JVM_MD_H */ X X // Reconciliation History Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/osThread_bsd.cpp ./hotspot/src/os/bsd/vm/osThread_bsd.cpp X--- ../orig/hotspot/src/os/bsd/vm/osThread_bsd.cpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/osThread_bsd.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -31,8 +31,8 @@ X X void OSThread::pd_initialize() { X assert(this != NULL, "check"); X- _thread_id = 0; X- _pthread_id = 0; X+ _thread_id = NULL; X+ _pthread_id = NULL; X _siginfo = NULL; X _ucontext = NULL; X _expanding_stack = 0; Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/osThread_bsd.hpp ./hotspot/src/os/bsd/vm/osThread_bsd.hpp X--- ../orig/hotspot/src/os/bsd/vm/osThread_bsd.hpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/osThread_bsd.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -39,6 +39,12 @@ X X private: X X+#ifdef _ALLBSD_SOURCE X+ // _thread_id and _pthread_id are the same on BSD X+ // keep both to minimize code divergence in os_bsd.cpp X+ pthread_t _thread_id; X+ pthread_t _pthread_id; X+#else X // _thread_id is kernel thread id (similar to LWP id on Solaris). Each X // thread has a unique thread_id (BsdThreads or NPTL). It can be used X // to access /proc. X@@ -47,6 +53,7 @@ X // _pthread_id is the pthread id, which is used by library calls X // (e.g. pthread_kill). X pthread_t _pthread_id; X+#endif X X sigset_t _caller_sigmask; // Caller's signal mask X X@@ -56,12 +63,18 @@ X sigset_t caller_sigmask() const { return _caller_sigmask; } X void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; } X X+#ifdef _ALLBSD_SOURCE X+ pthread_t thread_id() const { X+ return _thread_id; X+ } X+#else X pid_t thread_id() const { X return _thread_id; X } X+#endif X #ifndef PRODUCT X // Used for debugging, return a unique integer for each thread. X- int thread_identifier() const { return _thread_id; } X+ intptr_t thread_identifier() const { return (intptr_t)_pthread_id; } X #endif X #ifdef ASSERT X // We expect no reposition failures so kill vm if we get one. X@@ -70,9 +83,15 @@ X return false; X } X #endif // ASSERT X+#ifdef _ALLBSD_SOURCE X+ void set_thread_id(pthread_t id) { X+ _thread_id = id; X+ } X+#else X void set_thread_id(pid_t id) { X _thread_id = id; X } X+#endif X pthread_t pthread_id() const { X return _pthread_id; X } X@@ -123,6 +142,9 @@ public: X X private: X Monitor* _startThread_lock; // sync parent and child in thread creation X+#ifdef _ALLBSD_SOURCE X+ JavaThreadState _saved_interrupt_thread_state; // the thread state before a system call -- restored afterward X+#endif X X public: X X@@ -130,6 +152,11 @@ public: X return _startThread_lock; X } X X+#ifdef _ALLBSD_SOURCE X+ JavaThreadState saved_interrupt_thread_state() { return _saved_interrupt_thread_state; } X+ void set_saved_interrupt_thread_state(JavaThreadState state) { _saved_interrupt_thread_state = state; } X+#endif X+ X // *************************************************************** X // Platform dependent initialization and cleanup X // *************************************************************** Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/os_bsd.cpp ./hotspot/src/os/bsd/vm/os_bsd.cpp X--- ../orig/hotspot/src/os/bsd/vm/os_bsd.cpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/os_bsd.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -50,12 +50,33 @@ X # include <semaphore.h> X # include <fcntl.h> X # include <string.h> X+#ifdef _ALLBSD_SOURCE X+# include <sys/param.h> X+# include <sys/sysctl.h> X+#else X # include <syscall.h> X # include <sys/sysinfo.h> X # include <gnu/libc-version.h> X+#endif X # include <sys/ipc.h> X # include <sys/shm.h> X+ X+#ifndef __APPLE__ X # include <link.h> X+#endif X+ X+#if defined(__FreeBSD__) X+# include <elf.h> X+#endif X+ X+#ifdef __APPLE__ X+#include <mach/mach.h> // semaphore_* API X+#include <mach-o/dyld.h> X+#endif X+ X+#ifndef MAP_ANONYMOUS X+#define MAP_ANONYMOUS MAP_ANON X+#endif X X #define MAX_PATH (2 * K) X X@@ -67,19 +88,25 @@ X // global variables X julong os::Bsd::_physical_memory = 0; X X+#ifndef _ALLBSD_SOURCE X address os::Bsd::_initial_thread_stack_bottom = NULL; X uintptr_t os::Bsd::_initial_thread_stack_size = 0; X+#endif X X int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL; X+#ifndef _ALLBSD_SOURCE X int (*os::Bsd::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL; X Mutex* os::Bsd::_createThread_lock = NULL; X+#endif X pthread_t os::Bsd::_main_thread; X int os::Bsd::_page_size = -1; X+#ifndef _ALLBSD_SOURCE X bool os::Bsd::_is_floating_stack = false; X bool os::Bsd::_is_NPTL = false; X bool os::Bsd::_supports_fast_thread_cpu_time = false; X const char * os::Bsd::_glibc_version = NULL; X const char * os::Bsd::_libpthread_version = NULL; X+#endif X X static jlong initial_time_count=0; X X@@ -97,6 +124,77 @@ static pid_t _initial_pid = 0; X static int SR_signum = SIGUSR2; X sigset_t SR_sigset; X X+#ifdef _ALLBSD_SOURCE X+// XXXBSD: ported from solaris version X+// interruptible infrastructure X+ X+// setup_interruptible saves the thread state before going into an X+// interruptible system call. X+// The saved state is used to restore the thread to X+// its former state whether or not an interrupt is received. X+// Used by classloader os::read X+// hpi calls skip this layer and stay in _thread_in_native X+ X+void os::Bsd::setup_interruptible(JavaThread* thread) { X+ X+ JavaThreadState thread_state = thread->thread_state(); X+ X+ assert(thread_state != _thread_blocked, "Coming from the wrong thread"); X+ assert(thread_state != _thread_in_native, "Native threads skip setup_interruptible"); X+ OSThread* osthread = thread->osthread(); X+ osthread->set_saved_interrupt_thread_state(thread_state); X+ thread->frame_anchor()->make_walkable(thread); X+ ThreadStateTransition::transition(thread, thread_state, _thread_blocked); X+} X+ X+// Version of setup_interruptible() for threads that are already in X+// _thread_blocked. Used by os_sleep(). X+void os::Bsd::setup_interruptible_already_blocked(JavaThread* thread) { X+ thread->frame_anchor()->make_walkable(thread); X+} X+ X+JavaThread* os::Bsd::setup_interruptible() { X+ JavaThread* thread = (JavaThread*)ThreadLocalStorage::thread(); X+ setup_interruptible(thread); X+ return thread; X+} X+ X+#ifdef ASSERT X+ X+JavaThread* os::Bsd::setup_interruptible_native() { X+ JavaThread* thread = (JavaThread*)ThreadLocalStorage::thread(); X+ JavaThreadState thread_state = thread->thread_state(); X+ assert(thread_state == _thread_in_native, "Assumed thread_in_native"); X+ return thread; X+} X+ X+void os::Bsd::cleanup_interruptible_native(JavaThread* thread) { X+ JavaThreadState thread_state = thread->thread_state(); X+ assert(thread_state == _thread_in_native, "Assumed thread_in_native"); X+} X+#endif X+ X+// cleanup_interruptible reverses the effects of setup_interruptible X+// setup_interruptible_already_blocked() does not need any cleanup. X+ X+void os::Bsd::cleanup_interruptible(JavaThread* thread) { X+ OSThread* osthread = thread->osthread(); X+ X+ ThreadStateTransition::transition(thread, _thread_blocked, osthread->saved_interrupt_thread_state()); X+} X+ X+// I/O interruption related counters called in _INTERRUPTIBLE X+ X+void os::Bsd::bump_interrupted_before_count() { X+ RuntimeService::record_interrupted_before_count(); X+} X+ X+void os::Bsd::bump_interrupted_during_count() { X+ RuntimeService::record_interrupted_during_count(); X+} X+#endif X+ X+ X //////////////////////////////////////////////////////////////////////////////// X // utility functions X X@@ -108,11 +206,17 @@ julong os::available_memory() { X } X X julong os::Bsd::available_memory() { X+#ifdef _ALLBSD_SOURCE X+ // XXXBSD: this is just a stopgap implementation X+ return physical_memory() >> 2; X+#else X+ X // values in struct sysinfo are "unsigned long" X struct sysinfo si; X sysinfo(&si); X X return (julong)si.freeram * si.mem_unit; X+#endif X } X X julong os::physical_memory() { X@@ -160,6 +264,7 @@ bool os::have_special_privileges() { X } X X X+#ifndef _ALLBSD_SOURCE X #ifndef SYS_gettid X // i386: 224, ia64: 1105, amd64: 186, sparc 143 X #ifdef __ia64__ X@@ -174,6 +279,7 @@ bool os::have_special_privileges() { X #error define gettid for the arch X #endif X #endif X+#endif X X // Cpu architecture string X #if defined(IA64) X@@ -193,6 +299,7 @@ static char cpu_arch[] = "sparc"; X #endif X X X+#ifndef _ALLBSD_SOURCE X // pid_t gettid() X // X // Returns the kernel thread id of the currently running thread. Kernel X@@ -219,7 +326,47 @@ static bool unsafe_chroot_detected = fal X static const char *unstable_chroot_error = "/proc file system not found.\n" X "Java may be unstable running multithreaded in a chroot " X "environment on Bsd when /proc filesystem is not mounted."; X+#endif X X+#ifdef _ALLBSD_SOURCE X+void os::Bsd::initialize_system_info() { X+ int mib[2]; X+ size_t len; X+ int cpu_val; X+ u_long mem_val; X+ X+ /* get processors count via hw.ncpus sysctl */ X+ mib[0] = CTL_HW; X+ mib[1] = HW_NCPU; X+ len = sizeof(cpu_val); X+ if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1) X+ _processor_count = cpu_val; X+ X+ if (_processor_count < 1) X+ _processor_count = 1; // fallback X+ X+ /* get physical memory via hw.usermem sysctl (hw.usermem is used X+ * instead of hw.physmem because we need size of allocatable memory X+ */ X+ mib[0] = CTL_HW; X+ mib[1] = HW_USERMEM; X+ len = sizeof(mem_val); X+ if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) X+ _physical_memory = mem_val; X+ else X+ _physical_memory = 256*1024*1024; // fallback (XXXBSD?) X+ X+#ifdef __OpenBSD__ X+ { X+ // limit _physical_memory memory view on OpenBSD since X+ // datasize rlimit restricts us anyway. X+ struct rlimit limits; X+ getrlimit(RLIMIT_DATA, &limits); X+ _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur); X+ } X+#endif X+} X+#else X void os::Bsd::initialize_system_info() { X _processor_count = sysconf(_SC_NPROCESSORS_CONF); X if (_processor_count == 1) { X@@ -236,6 +383,7 @@ void os::Bsd::initialize_system_info() { X _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE); X assert(_processor_count > 0, "bsd error"); X } X+#endif X X void os::init_system_properties_values() { X // char arch[12]; X@@ -356,7 +504,12 @@ void os::init_system_properties_values() X * should always exist (until the legacy problem cited above is X * addressed). X */ X+#ifdef __APPLE__ X+ char *v = getenv("DYLD_LIBRARY_PATH"); X+#else X char *v = getenv("LD_LIBRARY_PATH"); X+#endif X+ X if (v != NULL) { X char *t = ld_library_path; X /* That's +1 for the colon and +1 for the trailing '\0' */ X@@ -515,6 +668,7 @@ void os::Bsd::hotspot_sigmask(Thread* th X } X } X X+#ifndef _ALLBSD_SOURCE X ////////////////////////////////////////////////////////////////////////////// X // detecting pthread library X X@@ -679,6 +833,7 @@ bool os::Bsd::manually_expand_stack(Java X } X return false; X } X+#endif X X ////////////////////////////////////////////////////////////////////////////// X // create new thread X@@ -687,6 +842,9 @@ static address highest_vm_reserved_addre X X // check if it's safe to start a new thread X static bool _thread_safety_check(Thread* thread) { X+#ifdef _ALLBSD_SOURCE X+ return true; X+#else X if (os::Bsd::is_BsdThreads() && !os::Bsd::is_floating_stack()) { X // Fixed stack BsdThreads (SuSE Bsd/x86, and some versions of Redhat) X // Heap is mmap'ed at lower end of memory space. Thread stacks are X@@ -720,6 +878,7 @@ static bool _thread_safety_check(Thread* X // here, that means enough space has been reserved for stack. X return true; X } X+#endif X } X X // Thread start routine for all newly created threads X@@ -747,6 +906,10 @@ static void *java_start(Thread *thread) X return NULL; X } X X+#ifdef _ALLBSD_SOURCE X+ // thread_id is pthread_id on BSD X+ osthread->set_thread_id(::pthread_self()); X+#else X // thread_id is kernel thread id (similar to Solaris LWP id) X osthread->set_thread_id(os::Bsd::gettid()); X X@@ -756,6 +919,7 @@ static void *java_start(Thread *thread) X thread->set_lgrp_id(lgrp_id); X } X } X+#endif X // initialize signal mask for this thread X os::Bsd::hotspot_sigmask(thread); X X@@ -836,17 +1000,22 @@ bool os::create_thread(Thread* thread, T X // let pthread_create() pick the default value. X } X X+#ifndef _ALLBSD_SOURCE X // glibc guard page X pthread_attr_setguardsize(&attr, os::Bsd::default_guard_size(thr_type)); X+#endif X X ThreadState state; X X { X+ X+#ifndef _ALLBSD_SOURCE X // Serialize thread creation if we are running with fixed stack BsdThreads X bool lock = os::Bsd::is_BsdThreads() && !os::Bsd::is_floating_stack(); X if (lock) { X os::Bsd::createThread_lock()->lock_without_safepoint_check(); X } X+#endif X X pthread_t tid; X int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); X@@ -860,7 +1029,9 @@ bool os::create_thread(Thread* thread, T X // Need to clean up stuff we've allocated so far X thread->set_osthread(NULL); X delete osthread; X+#ifndef _ALLBSD_SOURCE X if (lock) os::Bsd::createThread_lock()->unlock(); X+#endif X return false; X } X X@@ -876,9 +1047,11 @@ bool os::create_thread(Thread* thread, T X } X } X X+#ifndef _ALLBSD_SOURCE X if (lock) { X os::Bsd::createThread_lock()->unlock(); X } X+#endif X } X X // Aborted due to thread limit being reached X@@ -916,7 +1089,11 @@ bool os::create_attached_thread(JavaThre X } X X // Store pthread info into the OSThread X+#ifdef _ALLBSD_SOURCE X+ osthread->set_thread_id(::pthread_self()); X+#else X osthread->set_thread_id(os::Bsd::gettid()); X+#endif X osthread->set_pthread_id(::pthread_self()); X X // initialize floating point control register X@@ -927,6 +1104,7 @@ bool os::create_attached_thread(JavaThre X X thread->set_osthread(osthread); X X+#ifndef _ALLBSD_SOURCE X if (UseNUMA) { X int lgrp_id = os::numa_get_group_id(); X if (lgrp_id != -1) { X@@ -953,6 +1131,7 @@ bool os::create_attached_thread(JavaThre X os::Bsd::manually_expand_stack(jt, addr); X osthread->clear_expanding_stack(); X } X+#endif X X // initialize signal mask for this thread X // and save the caller's signal mask X@@ -1011,6 +1190,7 @@ extern "C" Thread* get_thread() { X ////////////////////////////////////////////////////////////////////////////// X // initial thread X X+#ifndef _ALLBSD_SOURCE X // Check if current thread is the initial thread, similar to Solaris thr_main. X bool os::Bsd::is_initial_thread(void) { X char dummy; X@@ -1241,6 +1421,7 @@ void os::Bsd::capture_initial_stack(size X _initial_thread_stack_size = align_size_down(_initial_thread_stack_size, page_size()); X _initial_thread_stack_bottom = (address)stack_top - _initial_thread_stack_size; X } X+#endif X X //////////////////////////////////////////////////////////////////////////////// X // time support X@@ -1279,6 +1460,21 @@ jlong os::javaTimeMillis() { X #define CLOCK_MONOTONIC (1) X #endif X X+#ifdef __APPLE__ X+void os::Bsd::clock_init() { X+ // XXXDARWIN: Investigate replacement monotonic clock X+} X+#elif defined(_ALLBSD_SOURCE) X+void os::Bsd::clock_init() { X+ struct timespec res; X+ struct timespec tp; X+ if (::clock_getres(CLOCK_MONOTONIC, &res) == 0 && X+ ::clock_gettime(CLOCK_MONOTONIC, &tp) == 0) { X+ // yes, monotonic clock is supported X+ _clock_gettime = ::clock_gettime; X+ } X+} X+#else X void os::Bsd::clock_init() { X // we do dlopen's in this particular order due to bug in bsd X // dynamical loader (see 6348968) leading to crash on exit X@@ -1314,7 +1510,9 @@ void os::Bsd::clock_init() { X } X } X } X+#endif X X+#ifndef _ALLBSD_SOURCE X #ifndef SYS_clock_getres X X #if defined(IA32) || defined(AMD64) X@@ -1353,6 +1551,7 @@ void os::Bsd::fast_thread_clock_init() { X _pthread_getcpuclockid = pthread_getcpuclockid_func; X } X } X+#endif X X jlong os::javaTimeNanos() { X if (Bsd::supports_monotonic_clock()) { X@@ -1499,7 +1698,14 @@ int os::current_process_id() { X X // DLL functions X X-const char* os::dll_file_extension() { return ".so"; } X+#define JNI_LIB_PREFIX "lib" X+#ifdef __APPLE__ X+#define JNI_LIB_SUFFIX ".dylib" X+#else X+#define JNI_LIB_SUFFIX ".so" X+#endif X+ X+const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; } X X const char* os::get_temp_directory() { return "/tmp/"; } X X@@ -1540,6 +1746,23 @@ bool os::dll_address_to_function_name(ad X } X } X X+#ifdef _ALLBSD_SOURCE X+// ported from solaris version X+bool os::dll_address_to_library_name(address addr, char* buf, X+ int buflen, int* offset) { X+ Dl_info dlinfo; X+ X+ if (dladdr((void*)addr, &dlinfo)){ X+ if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); X+ if (offset) *offset = addr - (address)dlinfo.dli_fbase; X+ return true; X+ } else { X+ if (buf) buf[0] = '\0'; X+ if (offset) *offset = -1; X+ return false; X+ } X+} X+#else X struct _address_to_library_name { X address addr; // input : memory address X size_t buflen; // size of fname X@@ -1614,11 +1837,27 @@ bool os::dll_address_to_library_name(add X return false; X } X } X+#endif X X // Loads .dll/.so and X // in case of error it checks if .dll/.so was built for the X // same architecture as Hotspot is running on X+ X+#ifdef __APPLE__ X+void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { X+ void * result= ::dlopen(filename, RTLD_LAZY); X+ if (result != NULL) { X+ // Successful loading X+ return result; X+ } X X+ // Read system error message into ebuf X+ ::strncpy(ebuf, ::dlerror(), ebuflen-1); X+ ebuf[ebuflen-1]='\0'; X+ X+ return NULL; X+} X+#else X void * os::dll_load(const char *filename, char *ebuf, int ebuflen) X { X void * result= ::dlopen(filename, RTLD_LAZY); X@@ -1671,6 +1910,20 @@ void * os::dll_load(const char *filename X #define EM_486 6 /* Intel 80486 */ X #endif X X+ #ifndef EM_PPC64 X+ #define EM_PPC64 21 /* PowerPC64 */ X+ #endif X+ X+ #ifndef EM_IA_64 X+ #define EM_IA_64 50 /* HP/Intel IA-64 */ X+ #endif X+ X+ #ifndef EM_X86_64 X+ #define EM_X86_64 62 /* AMD x86-64 */ X+ #endif X+ X+ X+ X static const arch_t arch_array[]={ X {EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, X {EM_486, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, X@@ -1751,7 +2004,7 @@ void * os::dll_load(const char *filename X X return NULL; X } X- X+#endif /* !__APPLE__ */ X X X X@@ -1774,7 +2027,51 @@ bool _print_ascii_file(const char* filen X X void os::print_dll_info(outputStream *st) { X st->print_cr("Dynamic libraries:"); X- X+#ifdef _ALLBSD_SOURCE X+#ifdef RTLD_DI_LINKMAP X+ Dl_info dli; X+ void *handle; X+ Link_map *map; X+ Link_map *p; X+ X+ if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { X+ st->print_cr("Error: Cannot print dynamic libraries."); X+ return; X+ } X+ handle = dlopen(dli.dli_fname, RTLD_LAZY); X+ if (handle == NULL) { X+ st->print_cr("Error: Cannot print dynamic libraries."); X+ return; X+ } X+ dlinfo(handle, RTLD_DI_LINKMAP, &map); X+ if (map == NULL) { X+ st->print_cr("Error: Cannot print dynamic libraries."); X+ return; X+ } X+ X+ while (map->l_prev != NULL) X+ map = map->l_prev; X+ X+ while (map != NULL) { X+ st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); X+ map = map->l_next; X+ } X+ X+ dlclose(handle); X+#elif defined(__APPLE__) X+ uint32_t count; X+ uint32_t i; X+ X+ count = _dyld_image_count(); X+ for (i = 1; i < count; i++) { X+ const char *name = _dyld_get_image_name(i); X+ intptr_t slide = _dyld_get_image_vmaddr_slide(i); X+ st->print_cr(PTR_FORMAT " \t%s", slide, name); X+ } X+#else X+ st->print_cr("Error: Cannot print dynamic libraries."); X+#endif X+#else X char fname[32]; X pid_t pid = os::Bsd::gettid(); X X@@ -1783,6 +2080,7 @@ void os::print_dll_info(outputStream *st X if (!_print_ascii_file(fname, st)) { X st->print("Can not get library information for pid = %d\n", pid); X } X+#endif X } X X X@@ -1815,6 +2113,7 @@ void os::print_os_info(outputStream* st) X st->print(name.machine); X st->cr(); X X+#ifndef _ALLBSD_SOURCE X // Print warning if unsafe chroot environment detected X if (unsafe_chroot_detected) { X st->print("WARNING!! "); X@@ -1829,6 +2128,7 @@ void os::print_os_info(outputStream* st) X st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed"); X } X st->cr(); X+#endif X X // rlimit X st->print("rlimit:"); X@@ -1854,6 +2154,7 @@ void os::print_os_info(outputStream* st) X if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); X else st->print("%d", rlim.rlim_cur); X X+#ifndef _ALLBSD_SOURCE X st->print(", AS "); X getrlimit(RLIMIT_AS, &rlim); X if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); X@@ -1866,6 +2167,7 @@ void os::print_os_info(outputStream* st) X os::loadavg(loadavg, 3); X st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); X st->cr(); X+#endif X } X X void os::print_memory_info(outputStream* st) { X@@ -1873,18 +2175,22 @@ void os::print_memory_info(outputStream* X st->print("Memory:"); X st->print(" %dk page", os::vm_page_size()>>10); X X+#ifndef _ALLBSD_SOURCE X // values in struct sysinfo are "unsigned long" X struct sysinfo si; X sysinfo(&si); X+#endif X X st->print(", physical " UINT64_FORMAT "k", X os::physical_memory() >> 10); X st->print("(" UINT64_FORMAT "k free)", X os::available_memory() >> 10); X+#ifndef _ALLBSD_SOURCE X st->print(", swap " UINT64_FORMAT "k", X ((jlong)si.totalswap * si.mem_unit) >> 10); X st->print("(" UINT64_FORMAT "k free)", X ((jlong)si.freeswap * si.mem_unit) >> 10); X+#endif X st->cr(); X } X X@@ -2108,19 +2414,29 @@ int os::sigexitnum_pd() { X static volatile jint pending_signals[NSIG+1] = { 0 }; X X // Bsd(POSIX) specific hand shaking semaphore. X+#ifdef __APPLE__ X+static semaphore_t sig_sem; X+#define SEM_INIT(sem, value) semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, value) X+#define SEM_WAIT(sem) semaphore_wait(sem); X+#define SEM_POST(sem) semaphore_signal(sem); X+#else X static sem_t sig_sem; X+#define SEM_INIT(sem, value) sem_init(&sem, 0, value) X+#define SEM_WAIT(sem) sem_wait(&sem); X+#define SEM_POST(sem) sem_post(&sem); X+#endif X X void os::signal_init_pd() { X // Initialize signal structures X ::memset((void*)pending_signals, 0, sizeof(pending_signals)); X X // Initialize signal semaphore X- ::sem_init(&sig_sem, 0, 0); X+ ::SEM_INIT(sig_sem, 0); X } X X void os::signal_notify(int sig) { X Atomic::inc(&pending_signals[sig]); X- ::sem_post(&sig_sem); X+ ::SEM_POST(sig_sem); X } X X static int check_pending_signals(bool wait) { X@@ -2142,7 +2458,7 @@ static int check_pending_signals(bool wa X do { X thread->set_suspend_equivalent(); X // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self() X- ::sem_wait(&sig_sem); X+ ::SEM_WAIT(sig_sem); X X // were we externally suspended while we were waiting? X threadIsSuspended = thread->handle_special_suspend_equivalent_condition(); X@@ -2153,7 +2469,7 @@ static int check_pending_signals(bool wa X // while suspended because that would surprise the thread that X // suspended us. X // X- ::sem_post(&sig_sem); X+ ::SEM_POST(sig_sem); X X thread->java_suspend_self(); X } X@@ -2224,10 +2540,16 @@ void bsd_wrap_code(char* base, size_t si X // left at the time of mmap(). This could be a potential X // problem. X bool os::commit_memory(char* addr, size_t size) { X+#ifdef __OpenBSD__ X+ // XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD X+ return mprotect(addr, size, PROT_READ|PROT_WRITE|PROT_EXEC) == 0; X+#else X+ X uintptr_t res = (uintptr_t) ::mmap(addr, size, X PROT_READ|PROT_WRITE|PROT_EXEC, X MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); X return res != (uintptr_t) MAP_FAILED; X+#endif X } X X bool os::commit_memory(char* addr, size_t size, size_t alignment_hint) { X@@ -2351,6 +2673,9 @@ bool os::unguard_memory(char* addr, size X static size_t _large_page_size = 0; X X bool os::large_page_init() { X+#ifdef _ALLBSD_SOURCE X+ return false; X+#else X if (!UseLargePages) return false; X X if (LargePageSizeInBytes) { X@@ -2405,6 +2730,7 @@ bool os::large_page_init() { X // We optimistically assume the support is available. If later it turns out X // not true, VM will automatically switch to use regular page size. X return true; X+#endif X } X X #ifndef SHM_HUGETLB X@@ -2575,7 +2901,7 @@ char* os::attempt_reserve_memory_at(size X } X X size_t os::read(int fd, void *buf, unsigned int nBytes) { X- return ::read(fd, buf, nBytes); X+ INTERRUPTIBLE_RETURN_INT_VM(::read(fd, buf, nBytes), os::Bsd::clear_interrupted); X } X X // TODO-FIXME: reconcile Solaris' os::sleep with the bsd variation. X@@ -2711,6 +3037,44 @@ void os::loop_breaker(int attempts) { X // this reason, the code should not be used as default (ThreadPriorityPolicy=0). X // It is only used when ThreadPriorityPolicy=1 and requires root privilege. X X+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) X+int os::java_to_os_priority[MaxPriority + 1] = { X+ 19, // 0 Entry should never be used X+ X+ 0, // 1 MinPriority X+ 3, // 2 X+ 6, // 3 X+ X+ 10, // 4 X+ 15, // 5 NormPriority X+ 18, // 6 X+ X+ 21, // 7 X+ 25, // 8 X+ 28, // 9 NearMaxPriority X+ X+ 31 // 10 MaxPriority X+}; X+#elif defined(__APPLE__) X+/* Using Mach high-level priority assignments */ X+int os::java_to_os_priority[MaxPriority + 1] = { X+ 0, // 0 Entry should never be used (MINPRI_USER) X+ X+ 27, // 1 MinPriority X+ 28, // 2 X+ 29, // 3 X+ X+ 30, // 4 X+ 31, // 5 NormPriority (BASEPRI_DEFAULT) X+ 32, // 6 X+ X+ 33, // 7 X+ 34, // 8 X+ 35, // 9 NearMaxPriority X+ X+ 36 // 10 MaxPriority X+}; X+#else X int os::java_to_os_priority[MaxPriority + 1] = { X 19, // 0 Entry should never be used X X@@ -2728,6 +3092,7 @@ int os::java_to_os_priority[MaxPriority X X -5 // 10 MaxPriority X }; X+#endif X X static int prio_init() { X if (ThreadPriorityPolicy == 1) { X@@ -2747,8 +3112,28 @@ static int prio_init() { X OSReturn os::set_native_priority(Thread* thread, int newpri) { X if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK; X X+#ifdef __OpenBSD__ X+ // OpenBSD pthread_setprio starves low priority threads X+ return OS_OK; X+#elif defined(__FreeBSD__) X+ int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri); X+#elif defined(__APPLE__) X+ struct sched_param sp; X+ int policy; X+ pthread_t self = pthread_self(); X+ X+ if (pthread_getschedparam(self, &policy, &sp) != 0) X+ return OS_ERR; X+ X+ sp.sched_priority = newpri; X+ if (pthread_setschedparam(self, policy, &sp) != 0) X+ return OS_ERR; X+ X+ return OS_OK; X+#else X int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri); X return (ret == 0) ? OS_OK : OS_ERR; X+#endif X } X X OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) { X@@ -2758,7 +3143,17 @@ OSReturn os::get_native_priority(const T X } X X errno = 0; X+#if defined(__OpenBSD__) || defined(__FreeBSD__) X+ *priority_ptr = pthread_getprio(thread->osthread()->pthread_id()); X+#elif defined(__APPLE__) X+ int policy; X+ struct sched_param sp; X+ X+ pthread_getschedparam(pthread_self(), &policy, &sp); X+ *priority_ptr = sp.sched_priority; X+#else X *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id()); X+#endif X return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR); X } X X@@ -2868,7 +3263,7 @@ static int SR_initialize() { X /* Get signal number to use for suspend/resume */ X if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) { X int sig = ::strtol(s, 0, 10); X- if (sig > 0 || sig < _NSIG) { X+ if (sig > 0 || sig < NSIG) { X SR_signum = sig; X } X } X@@ -3211,6 +3606,28 @@ void os::Bsd::install_signal_handlers() X set_signal_handler(SIGFPE, true); X set_signal_handler(SIGXFSZ, true); X X+#if defined(__APPLE__) X+ // In Mac OS X 10.4, CrashReporter will write a crash log for all 'fatal' signals, including X+ // signals caught and handled by the JVM. To work around this, we reset the mach task X+ // signal handler that's placed on our process by CrashReporter. This disables X+ // CrashReporter-based reporting. X+ // X+ // This work-around is not necessary for 10.5+, as CrashReporter no longer intercedes X+ // on caught fatal signals. X+ // X+ // Additionally, gdb installs both standard BSD signal handlers, and mach exception X+ // handlers. By replacing the existing task exception handler, we disable gdb's mach X+ // exception handling, while leaving the standard BSD signal handlers functional. X+ kern_return_t kr; X+ kr = task_set_exception_ports(mach_task_self(), X+ EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC, X+ MACH_PORT_NULL, X+ EXCEPTION_STATE_IDENTITY, X+ MACHINE_THREAD_STATE); X+ X+ assert(kr == KERN_SUCCESS, "could not set mach task signal handler"); X+#endif X+ X if (libjsig_is_loaded) { X // Tell libjsig jvm finishes setting signal handlers X (*end_signal_setting)(); X@@ -3231,6 +3648,7 @@ void os::Bsd::install_signal_handlers() X } X } X X+#ifndef _ALLBSD_SOURCE X // This is the fastest way to get thread cpu time on Bsd. X // Returns cpu time (user+sys) for any thread, not only for current. X // POSIX compliant clocks are implemented in the kernels 2.6.16+. X@@ -3245,6 +3663,7 @@ jlong os::Bsd::fast_thread_cpu_time(cloc X X return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec; X } X+#endif X X ///// X // glibc on Bsd platform uses non-documented flag X@@ -3466,13 +3885,13 @@ void os::init(void) { X X _initial_pid = (java_launcher_pid > 0) ? java_launcher_pid : getpid(); X X- clock_tics_per_sec = sysconf(_SC_CLK_TCK); X+ clock_tics_per_sec = CLK_TCK; X X init_random(1234567); X X ThreadCritical::initialize(); X X- Bsd::set_page_size(sysconf(_SC_PAGESIZE)); X+ Bsd::set_page_size(getpagesize()); X if (Bsd::page_size() == -1) { X fatal1("os_bsd.cpp: os::init: sysconf failed (%s)", strerror(errno)); X } X@@ -3485,6 +3904,16 @@ void os::init(void) { X X Bsd::clock_init(); X initial_time_count = os::elapsed_counter(); X+ X+#ifdef __APPLE__ X+ // XXXDARWIN X+ // Work around the unaligned VM callbacks in hotspot's X+ // sharedRuntime. The callbacks don't use SSE2 instructions, and work on X+ // Linux, Solaris, and FreeBSD. On Mac OS X, dyld (rightly so) enforces X+ // alignment when doing symbol lookup. To work around this, we force early X+ // binding of all symbols now, thus binding when alignment is known-good. X+ _dyld_bind_fully_image_containing_address((const void *) &os::init); X+#endif X } X X // To install functions for atexit system call X@@ -3497,7 +3926,9 @@ extern "C" { X // this is called _after_ the global arguments have been parsed X jint os::init_2(void) X { X+#ifndef _ALLBSD_SOURCE X Bsd::fast_thread_clock_init(); X+#endif X X // Allocate a single page and mark it as readable for safepoint polling X address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); X@@ -3546,6 +3977,7 @@ jint os::init_2(void) X JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, X vm_page_size())); X X+#ifndef _ALLBSD_SOURCE X Bsd::capture_initial_stack(JavaThread::stack_size_at_create()); X X Bsd::libpthread_init(); X@@ -3554,6 +3986,7 @@ jint os::init_2(void) X Bsd::glibc_version(), Bsd::libpthread_version(), X Bsd::is_floating_stack() ? "floating stack" : "fixed stack"); X } X+#endif X X if (MaxFDLimit) { X // set the number of file descriptors to max. print out error X@@ -3565,6 +3998,14 @@ jint os::init_2(void) X perror("os::init_2 getrlimit failed"); X } else { X nbr_files.rlim_cur = nbr_files.rlim_max; X+ X+#ifdef __APPLE__ X+ // Darwin returns RLIM_INFINITY for rlim_max, but fails with EINVAL if X+ // you attempt to use RLIM_INFINITY. As per setrlimit(2), OPEN_MAX must X+ // be used instead X+ nbr_files.rlim_cur = MIN(OPEN_MAX, nbr_files.rlim_cur); X+#endif X+ X status = setrlimit(RLIMIT_NOFILE, &nbr_files); X if (status != 0) { X if (PrintMiscellaneous && (Verbose || WizardMode)) X@@ -3573,8 +4014,10 @@ jint os::init_2(void) X } X } X X+#ifndef _ALLBSD_SOURCE X // Initialize lock used to serialize thread creation (see os::create_thread) X Bsd::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false)); X+#endif X X // Initialize HPI. X jint hpi_result = hpi::initialize(); X@@ -3621,11 +4064,16 @@ void os::make_polling_page_readable(void X }; X X int os::active_processor_count() { X+#ifdef _ALLBSD_SOURCE X+ return _processor_count; X+#else X+ X // Bsd doesn't yet have a (official) notion of processor sets, X // so just return the number of online processors. X int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN); X assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check"); X return online_cpus; X+#endif X } X X bool os::distribute_processes(uint length, uint* distribution) { X@@ -3667,6 +4115,9 @@ ExtendedPC os::get_thread_pc(Thread* thr X X int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) X { X+#ifdef _ALLBSD_SOURCE X+ return pthread_cond_timedwait(_cond, _mutex, _abstime); X+#else X if (is_NPTL()) { X return pthread_cond_timedwait(_cond, _mutex, _abstime); X } else { X@@ -3682,6 +4133,7 @@ int os::Bsd::safe_cond_timedwait(pthread X #endif // IA64 X return status; X } X+#endif X } X X //////////////////////////////////////////////////////////////////////////////// X@@ -3817,17 +4269,17 @@ int os::create_binary_file(const char* p X if (!rewrite_existing) { X oflags |= O_EXCL; X } X- return ::open64(path, oflags, S_IREAD | S_IWRITE); X+ return ::open(path, oflags, S_IREAD | S_IWRITE); X } X X // return current position of file pointer X jlong os::current_file_offset(int fd) { X- return (jlong)::lseek64(fd, (off64_t)0, SEEK_CUR); X+ return (jlong)::lseek(fd, (off_t)0, SEEK_CUR); X } X X // move file pointer to the specified offset X jlong os::seek_to_file_offset(int fd, jlong offset) { X- return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET); X+ return (jlong)::lseek(fd, (off_t)offset, SEEK_SET); X } X X // Map a block of memory. X@@ -3877,6 +4329,7 @@ bool os::unmap_memory(char* addr, size_t X return munmap(addr, bytes) == 0; X } X X+#ifndef _ALLBSD_SOURCE X static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time); X X static clockid_t thread_cpu_clockid(Thread* thread) { X@@ -3888,6 +4341,7 @@ static clockid_t thread_cpu_clockid(Thre X assert(rc == 0, "pthread_getcpuclockid is expected to return 0 code"); X return clockid; X } X+#endif X X // current_thread_cpu_time(bool) and thread_cpu_time(Thread*, bool) X // are used by JVM M&M and JVMTI to get user+sys or user CPU time X@@ -3897,39 +4351,71 @@ static clockid_t thread_cpu_clockid(Thre X // the fast estimate available on the platform. X X jlong os::current_thread_cpu_time() { X+#ifdef __APPLE__ X+ return os::thread_cpu_time(Thread::current(), true /* user + sys */); X+#elif !defined(_ALLBSD_SOURCE) X if (os::Bsd::supports_fast_thread_cpu_time()) { X return os::Bsd::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID); X } else { X // return user + sys since the cost is the same X return slow_thread_cpu_time(Thread::current(), true /* user + sys */); X } X+#endif X } X X jlong os::thread_cpu_time(Thread* thread) { X+#ifndef _ALLBSD_SOURCE X // consistent with what current_thread_cpu_time() returns X if (os::Bsd::supports_fast_thread_cpu_time()) { X return os::Bsd::fast_thread_cpu_time(thread_cpu_clockid(thread)); X } else { X return slow_thread_cpu_time(thread, true /* user + sys */); X } X+#endif X } X X jlong os::current_thread_cpu_time(bool user_sys_cpu_time) { X+#ifdef __APPLE__ X+ return os::thread_cpu_time(Thread::current(), user_sys_cpu_time); X+#elif !defined(_ALLBSD_SOURCE) X if (user_sys_cpu_time && os::Bsd::supports_fast_thread_cpu_time()) { X return os::Bsd::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID); X } else { X return slow_thread_cpu_time(Thread::current(), user_sys_cpu_time); X } X+#endif X } X X jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { X+#ifdef __APPLE__ X+ struct thread_basic_info tinfo; X+ mach_msg_type_number_t tcount = THREAD_INFO_MAX; X+ kern_return_t kr; X+ mach_port_t mach_thread; X+ X+ mach_thread = pthread_mach_thread_np(thread->osthread()->thread_id()); X+ kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount); X+ if (kr != KERN_SUCCESS) X+ return -1; X+ X+ if (user_sys_cpu_time) { X+ jlong nanos; X+ nanos = ((jlong) tinfo.system_time.seconds + tinfo.user_time.seconds) * (jlong)1000000000; X+ nanos += ((jlong) tinfo.system_time.microseconds + (jlong) tinfo.user_time.microseconds) * (jlong)1000; X+ return nanos; X+ } else { X+ return ((jlong)tinfo.user_time.seconds * 1000000000) + ((jlong)tinfo.user_time.microseconds * (jlong)1000); X+ } X+#elif !defined(_ALLBSD_SOURCE) X if (user_sys_cpu_time && os::Bsd::supports_fast_thread_cpu_time()) { X return os::Bsd::fast_thread_cpu_time(thread_cpu_clockid(thread)); X } else { X return slow_thread_cpu_time(thread, user_sys_cpu_time); X } X+#endif X } X X+#ifndef _ALLBSD_SOURCE X // X // -1 on error. X // X@@ -4018,6 +4504,7 @@ static jlong slow_thread_cpu_time(Thread X return (jlong)user_time * (1000000000 / clock_tics_per_sec); X } X } X+#endif X X void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) { X info_ptr->max_value = ALL_64_BITS; // will not wrap in less than 64 bits X@@ -4034,7 +4521,13 @@ void os::thread_cpu_time_info(jvmtiTimer X } X X bool os::is_thread_cpu_time_supported() { X+#ifdef __APPLE__ X+ return true; X+#elif defined(_ALLBSD_SOURCE) X+ return false; X+#else X return true; X+#endif X } X X // System loadavg support. Returns -1 if load average cannot be obtained. X@@ -4167,7 +4660,7 @@ jdk_pthread_sigmask(int how , const sigs X // abstime will be the absolute timeout time X // TODO: replace compute_abstime() with unpackTime() X X-static struct timespec* compute_abstime(timespec* abstime, jlong millis) { X+static struct timespec* compute_abstime(struct timespec* abstime, jlong millis) { X if (millis < 0) millis = 0; X struct timeval now; X int status = gettimeofday(&now, NULL); X@@ -4219,7 +4712,7 @@ void os::PlatformEvent::park() { / X status = pthread_cond_wait(_cond, _mutex); X // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... X // Treat this the same as if the wait was interrupted X- if (status == ETIME) { status = EINTR; } X+ if (status == ETIMEDOUT) { status = EINTR; } X assert_status(status == 0 || status == EINTR, status, "cond_wait"); X } X -- _nParked ; X@@ -4277,10 +4770,10 @@ int os::PlatformEvent::park(jlong millis X pthread_cond_init (_cond, NULL) ; X } X assert_status(status == 0 || status == EINTR || X- status == ETIME || status == ETIMEDOUT, X+ status == ETIMEDOUT, X status, "cond_timedwait"); X if (!FilterSpuriousWakeups) break ; // previous semantics X- if (status == ETIME || status == ETIMEDOUT) break ; X+ if (status == ETIMEDOUT) break ; X // We consume and ignore EINTR and spurious wakeups. X } X --_nParked ; X@@ -4372,7 +4865,7 @@ void os::PlatformEvent::unpark() { X * years from "now". X */ X X-static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) { X+static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) { X assert (time > 0, "convertTime"); X X struct timeval now; X@@ -4431,7 +4924,7 @@ void Parker::park(bool isAbsolute, jlong X } X X // Next, demultiplex/decode time arguments X- timespec absTime; X+ struct timespec absTime; X if (time < 0) { // don't wait at all X return; X } X@@ -4484,7 +4977,7 @@ void Parker::park(bool isAbsolute, jlong X } X } X assert_status(status == 0 || status == EINTR || X- status == ETIME || status == ETIMEDOUT, X+ status == ETIMEDOUT, X status, "cond_timedwait"); X X #ifdef ASSERT X@@ -4526,14 +5019,12 @@ void Parker::unpark() { X } X X X+/* Darwin has no "environ" in a dynamic library. */ X+#ifdef __APPLE__ X+#include <crt_externs.h> X+#define environ (*_NSGetEnviron()) X+#else X extern char** environ; X- X-#ifndef __NR_fork X-#define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57) X-#endif X- X-#ifndef __NR_execve X-#define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59) X #endif X X // Run the specified command in a separate process. Return its exit value, X@@ -4548,8 +5039,7 @@ int os::fork_and_exec(char* cmd) { X // separate process to execve. Make a direct syscall to fork process. X // On IA64 there's no fork syscall, we have to use fork() and hope for X // the best... X- pid_t pid = NOT_IA64(syscall(__NR_fork);) X- IA64_ONLY(fork();) X+ pid_t pid = fork(); X X if (pid < 0) { X // fork failed X@@ -4565,8 +5055,7 @@ int os::fork_and_exec(char* cmd) { X // in the new process, so make a system call directly. X // IA64 should use normal execve() from glibc to match the glibc fork() X // above. X- NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);) X- IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);) X+ execve("/bin/sh", (char* const*)argv, environ); X X // execve failed X _exit(-1); Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/os_bsd.hpp ./hotspot/src/os/bsd/vm/os_bsd.hpp X--- ../orig/hotspot/src/os/bsd/vm/os_bsd.hpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/os_bsd.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -30,6 +30,12 @@ X /* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */ X typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *); X X+#ifdef __APPLE__ X+// Mac OS X doesn't support clock_gettime. Stub out the type, it is X+// unused X+typedef int clockid_t; X+#endif X+ X class Bsd { X friend class os; X X@@ -50,6 +56,7 @@ class Bsd { X static int sigflags[MAXSIGNUM]; X X static int (*_clock_gettime)(clockid_t, struct timespec *); X+#ifndef _ALLBSD_SOURCE X static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *); X X static address _initial_thread_stack_bottom; X@@ -61,42 +68,79 @@ class Bsd { X static bool _is_floating_stack; X static bool _is_NPTL; X static bool _supports_fast_thread_cpu_time; X+#endif X X protected: X X static julong _physical_memory; X static pthread_t _main_thread; X+#ifndef _ALLBSD_SOURCE X static Mutex* _createThread_lock; X+#endif X static int _page_size; X X static julong available_memory(); X static julong physical_memory() { return _physical_memory; } X static void initialize_system_info(); X X+#ifndef _ALLBSD_SOURCE X static void set_glibc_version(const char *s) { _glibc_version = s; } X static void set_libpthread_version(const char *s) { _libpthread_version = s; } X+#endif X X static bool supports_variable_stack_size(); X X+#ifndef _ALLBSD_SOURCE X static void set_is_NPTL() { _is_NPTL = true; } X static void set_is_BsdThreads() { _is_NPTL = false; } X static void set_is_floating_stack() { _is_floating_stack = true; } X+#endif X X public: X+#ifdef _ALLBSD_SOURCE X+//XXXBSD: ported from solaris version X+ enum { X+ clear_interrupted = true X+ }; X+ static void setup_interruptible(JavaThread* thread); X+ static void setup_interruptible_already_blocked(JavaThread* thread); X+ static JavaThread* setup_interruptible(); X+ static void cleanup_interruptible(JavaThread* thread); X+ X+ // perf counter incrementers used by _INTERRUPTIBLE X+ X+ static void bump_interrupted_before_count(); X+ static void bump_interrupted_during_count(); X+ X+#ifdef ASSERT X+ static JavaThread* setup_interruptible_native(); X+ static void cleanup_interruptible_native(JavaThread* thread); X+#endif X+ X+#endif X+ X X static void init_thread_fpu_state(); X+#ifndef _ALLBSD_SOURCE X static int get_fpu_control_word(); X static void set_fpu_control_word(int fpu_control); X+#endif X static pthread_t main_thread(void) { return _main_thread; } X+ X+#ifndef _ALLBSD_SOURCE X // returns kernel thread id (similar to LWP id on Solaris), which can be X // used to access /proc X static pid_t gettid(); X static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; } X static Mutex* createThread_lock(void) { return _createThread_lock; } X+#endif X static void hotspot_sigmask(Thread* thread); X X+#ifndef _ALLBSD_SOURCE X static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; } X static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; } X+#endif X+ X static bool is_initial_thread(void); X X static int page_size(void) { return _page_size; } X@@ -133,6 +177,7 @@ class Bsd { X static struct sigaction *get_chained_signal_action(int sig); X static bool chained_handler(int sig, siginfo_t* siginfo, void* context); X X+#ifndef _ALLBSD_SOURCE X // GNU libc and libpthread version strings X static const char *glibc_version() { return _glibc_version; } X static const char *libpthread_version() { return _libpthread_version; } X@@ -146,6 +191,7 @@ class Bsd { X static bool is_floating_stack() { return _is_floating_stack; } X X static void libpthread_init(); X+#endif X X // Minimum stack size a thread can be created with (allowing X // the VM to completely create the thread and enter user code) X@@ -155,17 +201,21 @@ class Bsd { X static size_t default_stack_size(os::ThreadType thr_type); X static size_t default_guard_size(os::ThreadType thr_type); X X+#ifndef _ALLBSD_SOURCE X static void capture_initial_stack(size_t max_size); X X // Stack overflow handling X static bool manually_expand_stack(JavaThread * t, address addr); X static int max_register_window_saves_before_flushing(); X+#endif X X // Real-time clock functions X static void clock_init(void); X X+#ifndef _ALLBSD_SOURCE X // fast POSIX clocks support X static void fast_thread_clock_init(void); X+#endif X X static bool supports_monotonic_clock() { X return _clock_gettime != NULL; X@@ -175,6 +225,7 @@ class Bsd { X return _clock_gettime ? _clock_gettime(clock_id, tp) : -1; X } X X+#ifndef _ALLBSD_SOURCE X static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) { X return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1; X } X@@ -184,6 +235,7 @@ class Bsd { X } X X static jlong fast_thread_cpu_time(clockid_t clockid); X+#endif X X // Stack repair handling X Xdiff -uNpr ../orig/hotspot/src/os/bsd/vm/os_bsd.inline.hpp ./hotspot/src/os/bsd/vm/os_bsd.inline.hpp X--- ../orig/hotspot/src/os/bsd/vm/os_bsd.inline.hpp 2009-05-14 23:40:14.000000000 -0400 X+++ ./hotspot/src/os/bsd/vm/os_bsd.inline.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -64,7 +64,15 @@ inline bool os::uses_stack_guard_pages() X X inline bool os::allocate_stack_guard_pages() { X assert(uses_stack_guard_pages(), "sanity check"); X+#if !defined(__FreeBSD__) || __FreeBSD__ < 5 X+ // Since FreeBSD 4 uses malloc() for allocating the thread stack X+ // there is no need to do anything extra to allocate the guard pages X+ return false; X+#else X+ // FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks. X+ // Must 'allocate' them or guard pages are ignored. X return true; X+#endif X } X X X@@ -112,6 +120,107 @@ inline int os::closedir(DIR *dirp) X return ::closedir(dirp); X } X X+//XXXBSD: ported from solaris version X+////////////////////////////////////////////////////////////////////////////// X+//////////////////////////////////////////////////////////////////////////////// X+ X+// macros for interruptible io and system calls and system call restarting X+ X+#define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \ X+do { \ X+ _setup; \ X+ _before; \ X+ OSThread* _osthread = _thread->osthread(); \ X+ if (_int_enable && _thread->has_last_Java_frame()) { \ X+ /* this is java interruptible io stuff */ \ X+ if (os::is_interrupted(_thread, _clear)) { \ X+ os::Bsd::bump_interrupted_before_count(); \ X+ _result = OS_INTRPT; \ X+ } else { \ X+ /* _cmd always expands to an assignment to _result */ \ X+ if ((_cmd) < 0 && errno == EINTR \ X+ && os::is_interrupted(_thread, _clear)) { \ X+ os::Bsd::bump_interrupted_during_count(); \ X+ _result = OS_INTRPT; \ X+ } \ X+ } \ X+ } else { \ X+ /* this is normal blocking io stuff */ \ X+ _cmd; \ X+ } \ X+ _after; \ X+} while(false) X+ X+// Interruptible io support + restarting of interrupted system calls X+ X+#ifndef ASSERT X+ X+#define INTERRUPTIBLE(_cmd, _result, _clear) do { \ X+ _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \ X+} while((_result == OS_ERR) && (errno == EINTR)) X+ X+#else X+ X+// This adds an assertion that it is only called from thread_in_native X+// The call overhead is skipped for performance in product mode X+#define INTERRUPTIBLE(_cmd, _result, _clear) do { \ X+ _INTERRUPTIBLE(JavaThread* _thread = os::Bsd::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Bsd::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \ X+} while((_result == OS_ERR) && (errno == EINTR)) X+ X+#endif X+ X+// Used for calls from _thread_in_vm, not from _thread_in_native X+#define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \ X+ _INTERRUPTIBLE(JavaThread* _thread = os::Bsd::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Bsd::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \ X+} while((_result == OS_ERR) && (errno == EINTR)) X+ X+/* Use NORESTART when the system call cannot return EINTR, when something other X+ than a system call is being invoked, or when the caller must do EINTR X+ handling. */ X+ X+#ifndef ASSERT X+ X+#define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ X+ _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO) X+ X+#else X+ X+// This adds an assertion that it is only called from thread_in_native X+// The call overhead is skipped for performance in product mode X+#define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ X+ _INTERRUPTIBLE(JavaThread* _thread = os::Bsd::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Bsd::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ) X+ X+#endif X+ X+// Don't attend to UseVMInterruptibleIO. Always allow interruption. X+// Also assumes that it is called from the _thread_blocked state. X+// Used by os_sleep(). X+ X+#define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \ X+ _INTERRUPTIBLE(os::Bsd::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true ) X+ X+#define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \ X+ int _result; \ X+ do { \ X+ INTERRUPTIBLE(_cmd, _result, _clear); \ X+ } while((_result == OS_ERR) && (errno == EINTR)); \ X+ return _result; \ X+} while(false) X+ X+#define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \ X+ int _result; \ X+ do { \ X+ INTERRUPTIBLE_VM(_cmd, _result, _clear); \ X+ } while((_result == OS_ERR) && (errno == EINTR)); \ X+ return _result; \ X+} while(false) X+ X+#define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \ X+ int _result; \ X+ INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \ X+ return _result; \ X+} while(false) X+ X // macros for restartable system calls X X #define RESTARTABLE(_cmd, _result) do { \ Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/assembler_bsd_x86_64.cpp ./hotspot/src/os_cpu/bsd_x86/vm/assembler_bsd_x86_64.cpp X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/assembler_bsd_x86_64.cpp 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/assembler_bsd_x86_64.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -69,8 +69,9 @@ void MacroAssembler::get_thread(Register X } X } X X-// NOTE: since the bsd kernel resides at the low end of X-// user address space, no null pointer check is needed. X bool MacroAssembler::needs_explicit_null_check(int offset) { X- return offset < 0 || offset >= 0x100000; X+ // Bsd kernel guarantees that the first page is always unmapped. Don't X+ // assume anything more than that. X+ bool offset_in_first_page = 0 <= offset && offset < os::vm_page_size(); X+ return !offset_in_first_page; X } Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s ./hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2009-05-14 23:41:33.000000000 -0400 X@@ -21,49 +21,82 @@ X # have any questions. X # X X+ X+ X .ident "@(#)bsd_x86_32.s 1.10 07/05/17 15:48:59 JVM" X- X+ X+#ifdef __APPLE__ X+# Darwin uses _ prefixed global symbols X+#define SYMBOL(s) _ ## s X+#define ELF_TYPE(name, description) X+#else X+#define SYMBOL(s) s X+#define ELF_TYPE(name, description) .type name,description X+#endif X+ X+ .globl SYMBOL(fixcw) X+ X # NOTE WELL! The _Copy functions are called directly X # from server-compiler-generated code via CallLeafNoFP, X # which means that they *must* either not use floating X # point or use it in the same manner as does the server X # compiler. X X- .globl _Copy_conjoint_bytes X- .globl _Copy_arrayof_conjoint_bytes X- .globl _Copy_conjoint_jshorts_atomic X- .globl _Copy_arrayof_conjoint_jshorts X- .globl _Copy_conjoint_jints_atomic X- .globl _Copy_arrayof_conjoint_jints X- .globl _Copy_conjoint_jlongs_atomic X- .globl _mmx_Copy_arrayof_conjoint_jshorts X+ .globl SYMBOL(_Copy_conjoint_bytes) X+ .globl SYMBOL(_Copy_arrayof_conjoint_bytes) X+ .globl SYMBOL(_Copy_conjoint_jshorts_atomic) X+ .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) X+ .globl SYMBOL(_Copy_conjoint_jints_atomic) X+ .globl SYMBOL(_Copy_arrayof_conjoint_jints) X+ .globl SYMBOL(_Copy_conjoint_jlongs_atomic) X+ .globl SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts) X X- .globl _Atomic_cmpxchg_long X+ .globl SYMBOL(_Atomic_cmpxchg_long) X X .text X X- .globl SafeFetch32, Fetch32PFI, Fetch32Resume X- .globl SafeFetchN X+# Support for void os::Solaris::init_thread_fpu_state() in os_solaris_i486.cpp X+# Set fpu to 53 bit precision. This happens too early to use a stub. X+# ported from solaris_x86_32.s X+#ifdef __APPLE__ X+ .align 4 X+#else X+ .align 16 X+#endif X+SYMBOL(fixcw): X+ pushl $0x27f X+ fldcw 0(%esp) X+ popl %eax X+ ret X+ X+#ifdef __APPLE__ X+ .align 4 X+#else X+ .align 16 X+#endif X+ X+ .globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume) X+ .globl SYMBOL(SafeFetchN) X ## TODO: avoid exposing Fetch32PFI and Fetch32Resume. X ## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP) X ## routine to vet the address. If the address is the faulting LD then X ## SafeFetchTriage() would return the resume-at EIP, otherwise null. X- .type SafeFetch32,@function X+ ELF_TYPE(SafeFetch32,@function) X .p2align 4,,15 X-SafeFetch32: X-SafeFetchN: X+SYMBOL(SafeFetch32): X+SYMBOL(SafeFetchN): X movl 0x8(%esp), %eax X movl 0x4(%esp), %ecx X-Fetch32PFI: X+SYMBOL(Fetch32PFI): X movl (%ecx), %eax X-Fetch32Resume: X+SYMBOL(Fetch32Resume): X ret X X X- .globl SpinPause X- .type SpinPause,@function X+ .globl SYMBOL(SpinPause) X+ ELF_TYPE(SpinPause,@function) X .p2align 4,,15 X-SpinPause: X+SYMBOL(SpinPause): X rep X nop X movl $1, %eax X@@ -73,8 +106,8 @@ SpinPause: X # void* to, X # size_t count) X .p2align 4,,15 X- .type _Copy_conjoint_bytes,@function X-_Copy_conjoint_bytes: X+ ELF_TYPE(_Copy_conjoint_bytes,@function) X+SYMBOL(_Copy_conjoint_bytes): X pushl %esi X movl 4+12(%esp),%ecx # count X pushl %edi X@@ -181,8 +214,8 @@ cb_CopyLeft: X # X # Same as _Copy_conjoint_bytes, except no source alignment check. X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_bytes,@function X-_Copy_arrayof_conjoint_bytes: X+ ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) X+SYMBOL(_Copy_arrayof_conjoint_bytes): X pushl %esi X movl 4+12(%esp),%ecx # count X pushl %edi X@@ -269,8 +302,8 @@ acb_CopyLeft: X # void* to, X # size_t count) X .p2align 4,,15 X- .type _Copy_conjoint_jshorts_atomic,@function X-_Copy_conjoint_jshorts_atomic: X+ ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) X+SYMBOL(_Copy_conjoint_jshorts_atomic): X pushl %esi X movl 4+12(%esp),%ecx # count X pushl %edi X@@ -355,8 +388,8 @@ cs_CopyLeft: X # void* to, X # size_t count) X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_jshorts,@function X-_Copy_arrayof_conjoint_jshorts: X+ ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) X+SYMBOL(_Copy_arrayof_conjoint_jshorts): X pushl %esi X movl 4+12(%esp),%ecx # count X pushl %edi X@@ -432,10 +465,10 @@ acs_CopyLeft: X # Equivalent to X # arrayof_conjoint_jints X .p2align 4,,15 X- .type _Copy_conjoint_jints_atomic,@function X- .type _Copy_arrayof_conjoint_jints,@function X-_Copy_conjoint_jints_atomic: X-_Copy_arrayof_conjoint_jints: X+ ELF_TYPE(_Copy_conjoint_jints_atomic,@function) X+ ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) X+SYMBOL(_Copy_conjoint_jints_atomic): X+SYMBOL(_Copy_arrayof_conjoint_jints): X pushl %esi X movl 4+12(%esp),%ecx # count X pushl %edi X@@ -495,7 +528,7 @@ ci_CopyLeft: X # X # count treated as signed X # X- # if (from > to) { X+ # // if (from > to) { X # while (--count >= 0) { X # *to++ = *from++; X # } X@@ -505,8 +538,8 @@ ci_CopyLeft: X # } X # } X .p2align 4,,15 X- .type _Copy_conjoint_jlongs_atomic,@function X-_Copy_conjoint_jlongs_atomic: X+ ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) X+SYMBOL(_Copy_conjoint_jlongs_atomic): X movl 4+8(%esp),%ecx # count X movl 4+0(%esp),%eax # from X movl 4+4(%esp),%edx # to X@@ -534,8 +567,8 @@ cla_CopyLeft: X # void* to, X # size_t count) X .p2align 4,,15 X- .type _mmx_Copy_arrayof_conjoint_jshorts,@function X-_mmx_Copy_arrayof_conjoint_jshorts: X+ ELF_TYPE(_mmx_Copy_arrayof_conjoint_jshorts,@function) X+SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts): X pushl %esi X movl 4+12(%esp),%ecx X pushl %edi X@@ -633,8 +666,8 @@ mmx_acs_CopyLeft: X # bool is_MP) X # X .p2align 4,,15 X- .type _Atomic_cmpxchg_long,@function X-_Atomic_cmpxchg_long: X+ ELF_TYPE(_Atomic_cmpxchg_long,@function) X+SYMBOL(_Atomic_cmpxchg_long): X # 8(%esp) : return PC X pushl %ebx # 4(%esp) : old %ebx X pushl %edi # 0(%esp) : old %edi Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s ./hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s 2009-05-14 23:41:33.000000000 -0400 X@@ -23,48 +23,70 @@ X X .ident "@(#)bsd_x86_64.s 1.7 07/05/05 17:04:47 JVM" X X+#ifdef __APPLE__ X+# Darwin uses _ prefixed global symbols X+#define SYMBOL(s) _ ## s X+#define ELF_TYPE(name, description) X+#else X+#define SYMBOL(s) s X+#define ELF_TYPE(name, description) .type name,description X+#endif X+ X+ X # NOTE WELL! The _Copy functions are called directly X # from server-compiler-generated code via CallLeafNoFP, X # which means that they *must* either not use floating X # point or use it in the same manner as does the server X # compiler. X X- .globl _Copy_arrayof_conjoint_bytes X- .globl _Copy_arrayof_conjoint_jshorts X- .globl _Copy_conjoint_jshorts_atomic X- .globl _Copy_arrayof_conjoint_jints X- .globl _Copy_conjoint_jints_atomic X- .globl _Copy_arrayof_conjoint_jlongs X- .globl _Copy_conjoint_jlongs_atomic X+ .globl SYMBOL(_Copy_arrayof_conjoint_bytes) X+ .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) X+ .globl SYMBOL(_Copy_conjoint_jshorts_atomic) X+ .globl SYMBOL(_Copy_arrayof_conjoint_jints) X+ .globl SYMBOL(_Copy_conjoint_jints_atomic) X+ .globl SYMBOL(_Copy_arrayof_conjoint_jlongs) X+ .globl SYMBOL(_Copy_conjoint_jlongs_atomic) X X .text X X- .globl SafeFetch32, Fetch32PFI, Fetch32Resume X+ .globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume) X+#ifdef __APPLE__ X+ .align 4 X+#else X .align 16 X- .type SafeFetch32,@function X+#endif X+ ELF_TYPE(SafeFetch32,@function) X // Prototype: int SafeFetch32 (int * Adr, int ErrValue) X-SafeFetch32: X+SYMBOL(SafeFetch32): X movl %esi, %eax X-Fetch32PFI: X+SYMBOL(Fetch32PFI): X movl (%rdi), %eax X-Fetch32Resume: X+SYMBOL(Fetch32Resume): X ret X X- .globl SafeFetchN, FetchNPFI, FetchNResume X+ .globl SYMBOL(SafeFetchN), SYMBOL(FetchNPFI), SYMBOL(FetchNResume) X+#ifdef __APPLE__ X+ .align 4 X+#else X .align 16 X- .type SafeFetchN,@function X+#endif X+ ELF_TYPE(SafeFetchN,@function) X // Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue) X-SafeFetchN: X+SYMBOL(SafeFetchN): X movq %rsi, %rax X-FetchNPFI: X+SYMBOL(FetchNPFI): X movq (%rdi), %rax X-FetchNResume: X+SYMBOL(FetchNResume): X ret X X- .globl SpinPause X- .align 16 X- .type SpinPause,@function X-SpinPause: X+ .globl SYMBOL(SpinPause) X+#ifdef __APPLE__ X+ .align 4 X+#else X+ .align 16 X+#endif X+ ELF_TYPE(SpinPause,@function) X+SYMBOL(SpinPause): X rep X nop X movq $1, %rax X@@ -78,8 +100,8 @@ SpinPause: X # rdx - count, treated as ssize_t X # X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_bytes,@function X-_Copy_arrayof_conjoint_bytes: X+ ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) X+SYMBOL(_Copy_arrayof_conjoint_bytes): X movq %rdx,%r8 # byte count X shrq $3,%rdx # qword count X cmpq %rdi,%rsi X@@ -180,10 +202,10 @@ acb_CopyLeft: X # rdx - count, treated as ssize_t X # X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_jshorts,@function X- .type _Copy_conjoint_jshorts_atomic,@function X-_Copy_arrayof_conjoint_jshorts: X-_Copy_conjoint_jshorts_atomic: X+ ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) X+ ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) X+SYMBOL(_Copy_arrayof_conjoint_jshorts): X+SYMBOL(_Copy_conjoint_jshorts_atomic): X movq %rdx,%r8 # word count X shrq $2,%rdx # qword count X cmpq %rdi,%rsi X@@ -270,10 +292,10 @@ acs_CopyLeft: X # rdx - count, treated as ssize_t X # X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_jints,@function X- .type _Copy_conjoint_jints_atomic,@function X-_Copy_arrayof_conjoint_jints: X-_Copy_conjoint_jints_atomic: X+ ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) X+ ELF_TYPE(_Copy_conjoint_jints_atomic,@function) X+SYMBOL(_Copy_arrayof_conjoint_jints): X+SYMBOL(_Copy_conjoint_jints_atomic): X movq %rdx,%r8 # dword count X shrq %rdx # qword count X cmpq %rdi,%rsi X@@ -349,10 +371,10 @@ aci_CopyLeft: X # rdx - count, treated as ssize_t X # X .p2align 4,,15 X- .type _Copy_arrayof_conjoint_jlongs,@function X- .type _Copy_conjoint_jlongs_atomic,@function X-_Copy_arrayof_conjoint_jlongs: X-_Copy_conjoint_jlongs_atomic: X+ ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function) X+ ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) X+SYMBOL(_Copy_arrayof_conjoint_jlongs): X+SYMBOL(_Copy_conjoint_jlongs_atomic): X cmpq %rdi,%rsi X leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8 X jbe acl_CopyRight Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp ./hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -25,7 +25,29 @@ X * X */ X X+#ifndef _ALLBSD_SOURCE X #include <byteswap.h> X+#endif X+ X+#ifdef __APPLE__ X+#include <libkern/OSByteOrder.h> X+#endif X+ X+#if defined(AMD64) X+# if defined(__APPLE__) X+# define bswap_16(x) OSSwapInt16(x) X+# define bswap_32(x) OSSwapInt32(x) X+# define bswap_64(x) OSSwapInt64(x) X+# elif defined(__OpenBSD__) X+# define bswap_16(x) swap16(x) X+# define bswap_32(x) swap32(x) X+# define bswap_64(x) swap64(x) X+# else X+# define bswap_16(x) __bswap16(x) X+# define bswap_32(x) __bswap32(x) X+# define bswap_64(x) __bswap64(x) X+# endif X+#endif X X // Efficient swapping of data bytes from Java byte X // ordering to native byte ordering and vice versa. Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp ./hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -47,23 +47,158 @@ X # include <sys/wait.h> X # include <pwd.h> X # include <poll.h> X+#ifndef __OpenBSD__ X # include <ucontext.h> X-# include <fpu_control.h> X+#endif X+ X+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) X+# include <pthread_np.h> X+#endif X X #ifdef AMD64 X-#define REG_SP REG_RSP X-#define REG_PC REG_RIP X-#define REG_FP REG_RBP X #define SPELL_REG_SP "rsp" X #define SPELL_REG_FP "rbp" X #else X-#define REG_SP REG_UESP X-#define REG_PC REG_EIP X-#define REG_FP REG_EBP X #define SPELL_REG_SP "esp" X #define SPELL_REG_FP "ebp" X #endif // AMD64 X X+#ifdef __FreeBSD__ X+# define context_trapno uc_mcontext.mc_trapno X+# ifdef AMD64 X+# define context_pc uc_mcontext.mc_rip X+# define context_sp uc_mcontext.mc_rsp X+# define context_fp uc_mcontext.mc_rbp X+# define context_rip uc_mcontext.mc_rip X+# define context_rsp uc_mcontext.mc_rsp X+# define context_rbp uc_mcontext.mc_rbp X+# define context_rax uc_mcontext.mc_rax X+# define context_rbx uc_mcontext.mc_rbx X+# define context_rcx uc_mcontext.mc_rcx X+# define context_rdx uc_mcontext.mc_rdx X+# define context_rsi uc_mcontext.mc_rsi X+# define context_rdi uc_mcontext.mc_rdi X+# define context_r8 uc_mcontext.mc_r8 X+# define context_r9 uc_mcontext.mc_r9 X+# define context_r10 uc_mcontext.mc_r10 X+# define context_r11 uc_mcontext.mc_r11 X+# define context_r12 uc_mcontext.mc_r12 X+# define context_r13 uc_mcontext.mc_r13 X+# define context_r14 uc_mcontext.mc_r14 X+# define context_r15 uc_mcontext.mc_r15 X+# define context_flags uc_mcontext.mc_flags X+# define context_err uc_mcontext.mc_err X+# else X+# define context_pc uc_mcontext.mc_eip X+# define context_sp uc_mcontext.mc_esp X+# define context_fp uc_mcontext.mc_ebp X+# define context_eip uc_mcontext.mc_eip X+# define context_esp uc_mcontext.mc_esp X+# define context_eax uc_mcontext.mc_eax X+# define context_ebx uc_mcontext.mc_ebx X+# define context_ecx uc_mcontext.mc_ecx X+# define context_edx uc_mcontext.mc_edx X+# define context_ebp uc_mcontext.mc_ebp X+# define context_esi uc_mcontext.mc_esi X+# define context_edi uc_mcontext.mc_edi X+# define context_eflags uc_mcontext.mc_eflags X+# define context_trapno uc_mcontext.mc_trapno X+# endif X+#endif X+ X+#ifdef __APPLE__ X+# if __DARWIN_UNIX03 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) X+ // 10.5 UNIX03 member name prefixes X+ #define DU3_PREFIX(s, m) __ ## s.__ ## m X+# else X+ #define DU3_PREFIX(s, m) s ## . ## m X+# endif X+ X+# ifdef AMD64 X+# define context_pc context_rip X+# define context_sp context_rsp X+# define context_fp context_rbp X+# define context_rip uc_mcontext->DU3_PREFIX(ss,rip) X+# define context_rsp uc_mcontext->DU3_PREFIX(ss,rsp) X+# define context_rax uc_mcontext->DU3_PREFIX(ss,rax) X+# define context_rbx uc_mcontext->DU3_PREFIX(ss,rbx) X+# define context_rcx uc_mcontext->DU3_PREFIX(ss,rcx) X+# define context_rdx uc_mcontext->DU3_PREFIX(ss,rdx) X+# define context_rbp uc_mcontext->DU3_PREFIX(ss,rbp) X+# define context_rsi uc_mcontext->DU3_PREFIX(ss,rsi) X+# define context_rdi uc_mcontext->DU3_PREFIX(ss,rdi) X+# define context_r8 uc_mcontext->DU3_PREFIX(ss,r8) X+# define context_r9 uc_mcontext->DU3_PREFIX(ss,r9) X+# define context_r10 uc_mcontext->DU3_PREFIX(ss,r10) X+# define context_r11 uc_mcontext->DU3_PREFIX(ss,r11) X+# define context_r12 uc_mcontext->DU3_PREFIX(ss,r12) X+# define context_r13 uc_mcontext->DU3_PREFIX(ss,r13) X+# define context_r14 uc_mcontext->DU3_PREFIX(ss,r14) X+# define context_r15 uc_mcontext->DU3_PREFIX(ss,r15) X+# define context_flags uc_mcontext->DU3_PREFIX(ss,rflags) X+# define context_trapno uc_mcontext->DU3_PREFIX(es,trapno) X+# define context_err uc_mcontext->DU3_PREFIX(es,err) X+# else X+# define context_pc context_eip X+# define context_sp context_esp X+# define context_fp context_ebp X+# define context_eip uc_mcontext->DU3_PREFIX(ss,eip) X+# define context_esp uc_mcontext->DU3_PREFIX(ss,esp) X+# define context_eax uc_mcontext->DU3_PREFIX(ss,eax) X+# define context_ebx uc_mcontext->DU3_PREFIX(ss,ebx) X+# define context_ecx uc_mcontext->DU3_PREFIX(ss,ecx) X+# define context_edx uc_mcontext->DU3_PREFIX(ss,edx) X+# define context_ebp uc_mcontext->DU3_PREFIX(ss,ebp) X+# define context_esi uc_mcontext->DU3_PREFIX(ss,esi) X+# define context_edi uc_mcontext->DU3_PREFIX(ss,edi) X+# define context_eflags uc_mcontext->DU3_PREFIX(ss,eflags) X+# define context_trapno uc_mcontext->DU3_PREFIX(es,trapno) X+# endif X+#endif X+ X+#ifdef __OpenBSD__ X+# define context_trapno sc_trapno X+# ifdef AMD64 X+# define context_pc sc_rip X+# define context_sp sc_rsp X+# define context_fp sc_rbp X+# define context_rip sc_rip X+# define context_rsp sc_rsp X+# define context_rbp sc_rbp X+# define context_rax sc_rax X+# define context_rbx sc_rbx X+# define context_rcx sc_rcx X+# define context_rdx sc_rdx X+# define context_rsi sc_rsi X+# define context_rdi sc_rdi X+# define context_r8 sc_r8 X+# define context_r9 sc_r9 X+# define context_r10 sc_r10 X+# define context_r11 sc_r11 X+# define context_r12 sc_r12 X+# define context_r13 sc_r13 X+# define context_r14 sc_r14 X+# define context_r15 sc_r15 X+# define context_flags sc_rflags X+# define context_err sc_err X+# else X+# define context_pc sc_eip X+# define context_sp sc_esp X+# define context_fp sc_ebp X+# define context_eip sc_eip X+# define context_esp sc_esp X+# define context_eax sc_eax X+# define context_ebx sc_ebx X+# define context_ecx sc_ecx X+# define context_edx sc_edx X+# define context_ebp sc_ebp X+# define context_esi sc_esi X+# define context_edi sc_edi X+# define context_eflags sc_eflags X+# define context_trapno sc_trapno X+# endif X+#endif X+ X address os::current_stack_pointer() { X register void *esp __asm__ (SPELL_REG_SP); X return (address) esp; X@@ -82,15 +217,15 @@ void os::initialize_thread() { X } X X address os::Bsd::ucontext_get_pc(ucontext_t * uc) { X- return (address)uc->uc_mcontext.gregs[REG_PC]; X+ return (address)uc->context_pc; X } X X intptr_t* os::Bsd::ucontext_get_sp(ucontext_t * uc) { X- return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; X+ return (intptr_t*)uc->context_sp; X } X X intptr_t* os::Bsd::ucontext_get_fp(ucontext_t * uc) { X- return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; X+ return (intptr_t*)uc->context_fp; X } X X // For Forte Analyzer AsyncGetCallTrace profiling support - thread X@@ -237,18 +372,18 @@ JVM_handle_bsd_signal(int sig, X pc = (address) os::Bsd::ucontext_get_pc(uc); X X if (pc == (address) Fetch32PFI) { X- uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; X+ uc->context_pc = intptr_t(Fetch32Resume) ; X return 1 ; X } X #ifdef AMD64 X if (pc == (address) FetchNPFI) { X- uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; X+ uc->context_pc = intptr_t (FetchNResume) ; X return 1 ; X } X #endif // AMD64 X X // Handle ALL stack overflow variations here X- if (sig == SIGSEGV) { X+ if (sig == SIGSEGV || sig == SIGBUS) { X address addr = (address) info->si_addr; X X // check if fault address is within thread stack X@@ -270,6 +405,7 @@ JVM_handle_bsd_signal(int sig, X // to handle_unexpected_exception way down below. X thread->disable_stack_red_zone(); X tty->print_raw_cr("An irrecoverable stack overflow has occurred."); X+#ifndef _ALLBSD_SOURCE X } else { X // Accessing stack address below sp may cause SEGV if current X // thread has MAP_GROWSDOWN stack. This should only happen when X@@ -285,6 +421,7 @@ JVM_handle_bsd_signal(int sig, X } else { X fatal("recursive segv. expanding stack."); X } X+#endif X } X } X } X@@ -293,9 +430,16 @@ JVM_handle_bsd_signal(int sig, X // Java thread running in Java code => find exception handler if any X // a fault inside compiled code, the interpreter, or a stub X X- if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { X+ if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { X stub = SharedRuntime::get_poll_stub(pc); X+#if defined(__APPLE__) && !defined(AMD64) X+ // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. X+ // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from X+ // being called, so only do so if the implicit NULL check is not necessary. X+ } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) { X+#else X } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { X+#endif X // BugId 4454115: A read from a MappedByteBuffer can fault X // here if the underlying file has been truncated. X // Do not crash the VM in such a case. X@@ -316,6 +460,28 @@ JVM_handle_bsd_signal(int sig, X pc, X SharedRuntime:: X IMPLICIT_DIVIDE_BY_ZERO); X+#ifdef __APPLE__ X+ } else if (sig == SIGFPE && info->si_code == FPE_NOOP) { X+ int op = pc[0]; X+ X+ // Skip REX X+ if ((pc[0] & 0xf0) == 0x40) { X+ op = pc[1]; X+ } else { X+ op = pc[0]; X+ } X+ X+ // Check for IDIV X+ if (op == 0xF7) { X+ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime:: IMPLICIT_DIVIDE_BY_ZERO); X+ } else { X+ // TODO: handle more cases if we are using other x86 instructions X+ // that can generate SIGFPE signal. X+ tty->print_cr("unknown opcode 0x%X with SIGFPE.", op); X+ fatal("please update this code."); X+ } X+#endif /* __APPLE__ */ X+ X #else X if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) { X // HACK: si_code does not work on bsd 2.2.12-20!!! X@@ -343,7 +509,7 @@ JVM_handle_bsd_signal(int sig, X fatal("please update this code."); X } X #endif // AMD64 X- } else if (sig == SIGSEGV && X+ } else if ((sig == SIGSEGV || sig == SIGBUS) && X !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { X // Determination of interpreter/vtable stub/compiled code null exception X stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); X@@ -367,7 +533,7 @@ JVM_handle_bsd_signal(int sig, X // process of write protecting the memory serialization page. X // It write enables the page immediately after protecting it X // so we can just return to retry the write. X- if ((sig == SIGSEGV) && X+ if ((sig == SIGSEGV || sig == SIGBUS) && X os::is_memory_serialize_page(thread, (address) info->si_addr)) { X // Block current thread until the memory serialize page permission restored. X os::block_on_serialize_page_trap(); X@@ -388,7 +554,7 @@ JVM_handle_bsd_signal(int sig, X // Furthermore, a false-positive should be harmless. X if (UnguardOnExecutionViolation > 0 && X (sig == SIGSEGV || sig == SIGBUS) && X- uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { X+ uc->context_trapno == trap_page_fault) { X int page_size = os::vm_page_size(); X address addr = (address) info->si_addr; X address pc = os::Bsd::ucontext_get_pc(uc); X@@ -457,7 +623,7 @@ JVM_handle_bsd_signal(int sig, X // save all thread context in case we need to restore it X if (thread != NULL) thread->set_saved_exception_pc(pc); X X- uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub; X+ uc->context_pc = (intptr_t)stub; X return true; X } X X@@ -487,13 +653,24 @@ JVM_handle_bsd_signal(int sig, X ShouldNotReachHere(); X } X X+#ifdef _ALLBSD_SOURCE X+// From solaris_i486.s ported to bsd_i486.s X+extern "C" void fixcw(); X+#endif X+ X void os::Bsd::init_thread_fpu_state(void) { X #ifndef AMD64 X+# ifdef _ALLBSD_SOURCE X+ // Set fpu to 53 bit precision. This happens too early to use a stub. X+ fixcw(); X+# else X // set fpu to 53 bit precision X set_fpu_control_word(0x27f); X+# endif X #endif // !AMD64 X } X X+#ifndef _ALLBSD_SOURCE X int os::Bsd::get_fpu_control_word(void) { X #ifdef AMD64 X return 0; X@@ -509,11 +686,12 @@ void os::Bsd::set_fpu_control_word(int f X _FPU_SETCW(fpu_control); X #endif // !AMD64 X } X+#endif X X // Check that the bsd kernel version is 2.4 or higher since earlier X // versions do not support SSE without patches. X bool os::supports_sse() { X-#ifdef AMD64 X+#if defined(AMD64) || defined(_ALLBSD_SOURCE) X return true; X #else X struct utsname uts; X@@ -565,8 +743,11 @@ size_t os::Bsd::min_stack_allowed = (4 X X #define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;}) X X+#ifdef _ALLBSD_SOURCE X+bool os::Bsd::supports_variable_stack_size() { return true; } X+#else X // Test if pthread library can support variable thread stack size. BsdThreads X-// in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads X+// in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads X // in floating stack mode and NPTL support variable stack size. X bool os::Bsd::supports_variable_stack_size() { X if (os::Bsd::is_NPTL()) { X@@ -597,6 +778,7 @@ bool os::Bsd::supports_variable_stack_si X return (GET_GS() != 0); X } X } X+#endif X #endif // AMD64 X X // return default stack size for thr_type X@@ -650,6 +832,41 @@ size_t os::Bsd::default_guard_size(os::T X // pthread_attr_getstack() X X static void current_stack_region(address * bottom, size_t * size) { X+#ifdef __APPLE__ X+ pthread_t self = pthread_self(); X+ void *stacktop = pthread_get_stackaddr_np(self); X+ *size = pthread_get_stacksize_np(self); X+ *bottom = (address) stacktop - *size; X+#elif defined(__OpenBSD__) X+ stack_t ss; X+ int rslt = pthread_stackseg_np(pthread_self(), &ss); X+ X+ if (rslt != 0) X+ fatal1("pthread_stackseg_np failed with err = %d", rslt); X+ X+ *bottom = (address)((char *)ss.ss_sp - ss.ss_size); X+ *size = ss.ss_size; X+#elif defined(_ALLBSD_SOURCE) X+ pthread_attr_t attr; X+ X+ int rslt = pthread_attr_init(&attr); X+ X+ // JVM needs to know exact stack location, abort if it fails X+ if (rslt != 0) X+ fatal1("pthread_attr_init failed with err = %d", rslt); X+ X+ rslt = pthread_attr_get_np(pthread_self(), &attr); X+ X+ if (rslt != 0) X+ fatal1("pthread_attr_get_np failed with err = %d", rslt); X+ X+ if (pthread_attr_getstackaddr(&attr, (void **)bottom) != 0 || X+ pthread_attr_getstacksize(&attr, size) != 0) { X+ fatal("Can not locate current stack attributes!"); X+ } X+ X+ pthread_attr_destroy(&attr); X+#else X if (os::Bsd::is_initial_thread()) { X // initial thread needs special handling because pthread_getattr_np() X // may return bogus value. X@@ -676,6 +893,7 @@ static void current_stack_region(address X pthread_attr_destroy(&attr); X X } X+#endif X assert(os::current_stack_pointer() >= *bottom && X os::current_stack_pointer() < *bottom + *size, "just checking"); X } X@@ -704,46 +922,44 @@ void os::print_context(outputStream *st, X ucontext_t *uc = (ucontext_t*)context; X st->print_cr("Registers:"); X #ifdef AMD64 X- st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); X- st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); X- st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); X- st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); X+ st->print( "RAX=" INTPTR_FORMAT, uc->context_rax); X+ st->print(", RBX=" INTPTR_FORMAT, uc->context_rbx); X+ st->print(", RCX=" INTPTR_FORMAT, uc->context_rcx); X+ st->print(", RDX=" INTPTR_FORMAT, uc->context_rdx); X st->cr(); X- st->print( "RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]); X- st->print(", RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]); X- st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]); X- st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]); X+ st->print( "RSP=" INTPTR_FORMAT, uc->context_rsp); X+ st->print(", RBP=" INTPTR_FORMAT, uc->context_rbp); X+ st->print(", RSI=" INTPTR_FORMAT, uc->context_rsi); X+ st->print(", RDI=" INTPTR_FORMAT, uc->context_rdi); X st->cr(); X- st->print( "R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); X- st->print(", R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]); X- st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]); X- st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]); X+ st->print( "R8 =" INTPTR_FORMAT, uc->context_r8); X+ st->print(", R9 =" INTPTR_FORMAT, uc->context_r9); X+ st->print(", R10=" INTPTR_FORMAT, uc->context_r10); X+ st->print(", R11=" INTPTR_FORMAT, uc->context_r11); X st->cr(); X- st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); X- st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); X- st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); X- st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); X+ st->print( "R12=" INTPTR_FORMAT, uc->context_r12); X+ st->print(", R13=" INTPTR_FORMAT, uc->context_r13); X+ st->print(", R14=" INTPTR_FORMAT, uc->context_r14); X+ st->print(", R15=" INTPTR_FORMAT, uc->context_r15); X st->cr(); X- st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); X- st->print(", EFL=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); X- st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); X- st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); X+ st->print( "RIP=" INTPTR_FORMAT, uc->context_rip); X+ st->print(", EFL=" INTPTR_FORMAT, uc->context_flags); X+ st->print(", ERR=" INTPTR_FORMAT, uc->context_err); X st->cr(); X- st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); X+ st->print(" TRAPNO=" INTPTR_FORMAT, uc->context_trapno); X #else X- st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]); X- st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]); X- st->print(", ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]); X- st->print(", EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]); X+ st->print( "EAX=" INTPTR_FORMAT, uc->context_eax); X+ st->print(", EBX=" INTPTR_FORMAT, uc->context_ebx); X+ st->print(", ECX=" INTPTR_FORMAT, uc->context_ecx); X+ st->print(", EDX=" INTPTR_FORMAT, uc->context_edx); X st->cr(); X- st->print( "ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_UESP]); X- st->print(", EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]); X- st->print(", ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]); X- st->print(", EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]); X+ st->print( "ESP=" INTPTR_FORMAT, uc->context_esp); X+ st->print(", EBP=" INTPTR_FORMAT, uc->context_ebp); X+ st->print(", ESI=" INTPTR_FORMAT, uc->context_esi); X+ st->print(", EDI=" INTPTR_FORMAT, uc->context_edi); X st->cr(); X- st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]); X- st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2); X- st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); X+ st->print( "EIP=" INTPTR_FORMAT, uc->context_eip); X+ st->print(", EFLAGS=" INTPTR_FORMAT, uc->context_eflags); X #endif // AMD64 X st->cr(); X st->cr(); Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp ./hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -30,8 +30,10 @@ X #ifndef AMD64 X // map stack pointer to thread pointer - see notes in threadLS_bsd_x86.cpp X #define SP_BITLENGTH 32 X+#ifndef PAGE_SHIFT X #define PAGE_SHIFT 12 X #define PAGE_SIZE (1UL << PAGE_SHIFT) X+#endif X static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; X #endif // !AMD64 X Xdiff -uNpr ../orig/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp ./hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp X--- ../orig/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp 2009-05-14 23:40:15.000000000 -0400 X+++ ./hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -34,7 +34,7 @@ X /******************************/ \ X /* Threads (NOTE: incomplete) */ \ X /******************************/ \ X- nonstatic_field(OSThread, _thread_id, pid_t) \ X+ nonstatic_field(OSThread, _thread_id, pthread_t) \ X nonstatic_field(OSThread, _pthread_id, pthread_t) \ X /* This must be the last entry, and must be present */ \ X last_entry() Xdiff -uNpr ../orig/hotspot/src/share/vm/adlc/adlc.hpp ./hotspot/src/share/vm/adlc/adlc.hpp X--- ../orig/hotspot/src/share/vm/adlc/adlc.hpp 2009-04-24 03:30:54.000000000 -0400 X+++ ./hotspot/src/share/vm/adlc/adlc.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -76,9 +76,9 @@ typedef unsigned int uintptr_t; X #endif X #endif // _WIN32 X X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X #include <inttypes.h> X-#endif // LINUX X+#endif // LINUX || _ALLBSD_SOURCE X X // Macros X #define uint32 unsigned int Xdiff -uNpr ../orig/hotspot/src/share/vm/ci/ciMethodBlocks.cpp ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp X--- ../orig/hotspot/src/share/vm/ci/ciMethodBlocks.cpp 2009-04-24 03:30:54.000000000 -0400 X+++ ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp 2009-05-14 23:41:34.000000000 -0400 X@@ -321,7 +321,7 @@ void ciBlock::set_exception_range(int st X } X X #ifndef PRODUCT X-static char *flagnames[] = { X+static const char *flagnames[] = { X "Processed", X "Handler", X "MayThrow", Xdiff -uNpr ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep ./hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep X--- ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep 2009-05-14 23:41:33.000000000 -0400 X@@ -28,6 +28,7 @@ binaryTreeDictionary.cpp X binaryTreeDictionary.cpp binaryTreeDictionary.hpp X binaryTreeDictionary.cpp globals.hpp X binaryTreeDictionary.cpp ostream.hpp X+binaryTreeDictionary.cpp space.inline.hpp X X binaryTreeDictionary.hpp freeBlockDictionary.hpp X binaryTreeDictionary.hpp freeList.hpp Xdiff -uNpr ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew ./hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew X--- ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew 2009-05-14 23:41:33.000000000 -0400 X@@ -30,6 +30,8 @@ asParNewGeneration.cpp cmsAdaptiveSize X asParNewGeneration.cpp cmsGCAdaptivePolicyCounters.hpp X asParNewGeneration.cpp defNewGeneration.inline.hpp X asParNewGeneration.cpp oop.pcgc.inline.hpp X+asParNewGeneration.cpp markOop.inline.hpp X+asParNewGeneration.cpp markSweep.inline.hpp X asParNewGeneration.cpp parNewGeneration.hpp X asParNewGeneration.cpp referencePolicy.hpp X X@@ -39,7 +41,7 @@ parCardTableModRefBS.cpp X parCardTableModRefBS.cpp java.hpp X parCardTableModRefBS.cpp mutexLocker.hpp X parCardTableModRefBS.cpp sharedHeap.hpp X-parCardTableModRefBS.cpp space.hpp X+parCardTableModRefBS.cpp space.inline.hpp X parCardTableModRefBS.cpp universe.hpp X parCardTableModRefBS.cpp virtualspace.hpp X Xdiff -uNpr ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge ./hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge X--- ../orig/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge 2009-05-14 23:41:33.000000000 -0400 X@@ -302,6 +302,8 @@ psPermGen.cpp X psPermGen.cpp psMarkSweepDecorator.hpp X psPermGen.cpp psParallelCompact.hpp X psPermGen.cpp psPermGen.hpp X+psPermGen.cpp markOop.inline.hpp X+psPermGen.cpp markSweep.inline.hpp X X psPermGen.hpp psOldGen.hpp X Xdiff -uNpr ../orig/hotspot/src/share/vm/includeDB_compiler2 ./hotspot/src/share/vm/includeDB_compiler2 X--- ../orig/hotspot/src/share/vm/includeDB_compiler2 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/includeDB_compiler2 2009-05-14 23:41:33.000000000 -0400 X@@ -140,6 +140,7 @@ c2_globals_<os_family>.hpp X c2_globals_<os_family>.hpp macros.hpp X X c2_init_<arch>.cpp compile.hpp X+c2_init_<arch>.cpp node.hpp X X c2compiler.cpp ad_<arch_model>.hpp X c2compiler.cpp c2compiler.hpp X@@ -833,6 +834,7 @@ parseHelper.cpp X phase.cpp compile.hpp X phase.cpp compileBroker.hpp X phase.cpp nmethod.hpp X+phase.cpp node.hpp X phase.cpp phase.hpp X X phase.hpp port.hpp Xdiff -uNpr ../orig/hotspot/src/share/vm/includeDB_core ./hotspot/src/share/vm/includeDB_core X--- ../orig/hotspot/src/share/vm/includeDB_core 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/includeDB_core 2009-05-14 23:41:33.000000000 -0400 X@@ -476,7 +476,7 @@ cardTableModRefBS.cpp X cardTableModRefBS.cpp java.hpp X cardTableModRefBS.cpp mutexLocker.hpp X cardTableModRefBS.cpp sharedHeap.hpp X-cardTableModRefBS.cpp space.hpp X+cardTableModRefBS.cpp space.inline.hpp X cardTableModRefBS.cpp universe.hpp X cardTableModRefBS.cpp virtualspace.hpp X X@@ -1978,7 +1978,7 @@ instanceKlass.cpp X instanceKlass.cpp vmSymbols.hpp X X instanceKlass.hpp accessFlags.hpp X-instanceKlass.hpp bitMap.hpp X+instanceKlass.hpp bitMap.inline.hpp X instanceKlass.hpp constMethodOop.hpp X instanceKlass.hpp constantPoolOop.hpp X instanceKlass.hpp handles.hpp Xdiff -uNpr ../orig/hotspot/src/share/vm/includeDB_features ./hotspot/src/share/vm/includeDB_features X--- ../orig/hotspot/src/share/vm/includeDB_features 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/includeDB_features 2009-05-14 23:41:33.000000000 -0400 X@@ -58,6 +58,8 @@ dump.cpp X X dump_<arch_model>.cpp assembler_<arch_model>.inline.hpp X dump_<arch_model>.cpp compactingPermGenGen.hpp X+dump_<arch_model>.cpp generation.inline.hpp X+dump_<arch_model>.cpp space.inline.hpp X X forte.cpp collectedHeap.inline.hpp X forte.cpp debugInfoRec.hpp Xdiff -uNpr ../orig/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp ./hotspot/src/share/vm/interpreter/bytecodeTracer.cpp X--- ../orig/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp 2009-04-24 03:30:55.000000000 -0400 X+++ ./hotspot/src/share/vm/interpreter/bytecodeTracer.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -77,7 +77,7 @@ class BytecodePrinter: public BytecodeCl X // the incoming method. We could lose a line of trace output. X // This is acceptable in a debug-only feature. X st->cr(); X- st->print("[%d] ", (int) Thread::current()->osthread()->thread_id()); X+ st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); X method->print_name(st); X st->cr(); X _current_method = method(); X@@ -90,7 +90,7 @@ class BytecodePrinter: public BytecodeCl X code = Bytecodes::code_at(bcp); X } X int bci = bcp - method->code_base(); X- st->print("[%d] ", (int) Thread::current()->osthread()->thread_id()); X+ st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); X if (Verbose) { X st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s", X BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code)); Xdiff -uNpr ../orig/hotspot/src/share/vm/opto/escape.cpp ./hotspot/src/share/vm/opto/escape.cpp X--- ../orig/hotspot/src/share/vm/opto/escape.cpp 2009-04-24 03:30:56.000000000 -0400 X+++ ./hotspot/src/share/vm/opto/escape.cpp 2009-05-14 23:41:34.000000000 -0400 X@@ -54,21 +54,21 @@ void PointsToNode::remove_edge(uint targ X } X X #ifndef PRODUCT X-static char *node_type_names[] = { X+static const char *node_type_names[] = { X "UnknownType", X "JavaObject", X "LocalVar", X "Field" X }; X X-static char *esc_names[] = { X+static const char *esc_names[] = { X "UnknownEscape", X "NoEscape ", X "ArgEscape ", X "GlobalEscape " X }; X X-static char *edge_type_suffix[] = { X+static const char *edge_type_suffix[] = { X "?", // UnknownEdge X "P", // PointsToEdge X "D", // DeferredEdge Xdiff -uNpr ../orig/hotspot/src/share/vm/prims/forte.cpp ./hotspot/src/share/vm/prims/forte.cpp X--- ../orig/hotspot/src/share/vm/prims/forte.cpp 2009-04-24 03:30:56.000000000 -0400 X+++ ./hotspot/src/share/vm/prims/forte.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -872,6 +872,11 @@ void AsyncGetCallTrace(ASGCT_CallTrace * X // Method to let libcollector know about a dynamically loaded function. X // Because it is weakly bound, the calls become NOP's when the library X // isn't present. X+#ifdef __APPLE__ X+// XXXDARWIN: Link errors occur even when __attribute__((weak_import)) X+// is added X+#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) X+#else X void collector_func_load(char* name, X void* null_argument_1, X void* null_argument_2, X@@ -882,6 +887,7 @@ void collector_func_load(char* name, X #pragma weak collector_func_load X #define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \ X ( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),0 : 0 ) X+#endif // __APPLE__ X #endif // !_WINDOWS X X } // end extern "C" Xdiff -uNpr ../orig/hotspot/src/share/vm/runtime/globals.hpp ./hotspot/src/share/vm/runtime/globals.hpp X--- ../orig/hotspot/src/share/vm/runtime/globals.hpp 2009-04-24 03:30:56.000000000 -0400 X+++ ./hotspot/src/share/vm/runtime/globals.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -294,7 +294,7 @@ class CommandLineFlags { X /* UseMembar is theoretically a temp flag used for memory barrier \ X * removal testing. It was supposed to be removed before FCS but has \ X * been re-added (see 6401008) */ \ X- product(bool, UseMembar, false, \ X+ product(bool, UseMembar, true, \ X "(Unstable) Issues membars on thread state transitions") \ X \ X product(bool, PrintCommandLineFlags, false, \ Xdiff -uNpr ../orig/hotspot/src/share/vm/runtime/os.cpp ./hotspot/src/share/vm/runtime/os.cpp X--- ../orig/hotspot/src/share/vm/runtime/os.cpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/runtime/os.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -155,7 +155,11 @@ char* os::iso8601_time(char* buffer, siz X } X // Save the results of localtime X const struct tm time_struct = *time_struct_temp; X+#if defined(_ALLBSD_SOURCE) X+ const time_t zone = (time_t) time_struct_temp->tm_gmtoff; X+#else X const time_t zone = timezone; X+#endif X X // If daylight savings time is in effect, X // we are 1 hour East of our time zone Xdiff -uNpr ../orig/hotspot/src/share/vm/runtime/vm_version.cpp ./hotspot/src/share/vm/runtime/vm_version.cpp X--- ../orig/hotspot/src/share/vm/runtime/vm_version.cpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/runtime/vm_version.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -141,7 +141,8 @@ const char* Abstract_VM_Version::vm_rele X X #define OS LINUX_ONLY("linux") \ X WINDOWS_ONLY("windows") \ X- SOLARIS_ONLY("solaris") X+ SOLARIS_ONLY("solaris") \ X+ BSD_ONLY("bsd") X X #define CPU IA32_ONLY("x86") \ X IA64_ONLY("ia64") \ Xdiff -uNpr ../orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp ./hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp X--- ../orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -74,12 +74,25 @@ X # include <sys/procfs.h> X # endif X X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X #include <inttypes.h> X #include <signal.h> X+#ifndef __OpenBSD__ X #include <ucontext.h> X+#endif X+#ifdef __APPLE__ X+ #include <AvailabilityMacros.h> X+ #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) X+ // Mac OS X 10.4 defines EFL_AC and EFL_ID, X+ // which conflict with hotspot variable names. X+ // X+ // This has been fixed in Mac OS X 10.5. X+ #undef EFL_AC X+ #undef EFL_ID X+ #endif X+#endif X #include <sys/time.h> X-#endif // LINUX X+#endif // LINUX || _ALLBSD_SOURCE X X // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures X // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in X@@ -115,17 +128,20 @@ X // pointer is stored as integer value. On some platforms, sizeof(intptr_t) > X // sizeof(void*), so here we want something which is integer type, but has the X // same size as a pointer. X-#ifdef LINUX X+#ifdef __GNUC__ X #ifdef _LP64 X #define NULL_WORD 0L X #else X- #define NULL_WORD 0 X+ // Cast 0 to intptr_t rather than int32_t since they are not the same type X+ // on platforms such as Mac OS X. X+ #define NULL_WORD ((intptr_t)0) X #endif X #else X #define NULL_WORD NULL X #endif X X-#ifndef LINUX X+ X+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) X // Compiler-specific primitive types X typedef unsigned short uint16_t; X #ifndef _UINT32_T X@@ -145,7 +161,7 @@ typedef unsigned int uintptr_t; X // prior definition of intptr_t, and add "&& !defined(XXX)" above. X #endif // _SYS_INT_TYPES_H X X-#endif // !LINUX X+#endif // !LINUX && !_ALLBSD_SOURCE X X // Additional Java basic types X X@@ -229,7 +245,9 @@ inline int g_isnan(float f) { return is X inline int g_isnan(float f) { return isnand(f); } X #endif X inline int g_isnan(double f) { return isnand(f); } X-#elif LINUX X+#elif defined(__APPLE__) X+inline int g_isnan(double f) { return isnan(f); } X+#elif defined(LINUX) || defined(_ALLBSD_SOURCE) X inline int g_isnan(float f) { return isnanf(f); } X inline int g_isnan(double f) { return isnan(f); } X #else Xdiff -uNpr ../orig/hotspot/src/share/vm/utilities/macros.hpp ./hotspot/src/share/vm/utilities/macros.hpp X--- ../orig/hotspot/src/share/vm/utilities/macros.hpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/utilities/macros.hpp 2009-05-14 23:41:33.000000000 -0400 X@@ -147,6 +147,16 @@ X #define NOT_WINDOWS(code) code X #endif X X+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) X+#define BSD_ONLY(code) code X+#define NOT_BSD(code) X+#else X+#define BSD_ONLY(code) X+#define NOT_BSD(code) code X+#endif X+ X+ X+ X #ifdef IA32 X #define IA32_ONLY(code) code X #define NOT_IA32(code) Xdiff -uNpr ../orig/hotspot/src/share/vm/utilities/ostream.cpp ./hotspot/src/share/vm/utilities/ostream.cpp X--- ../orig/hotspot/src/share/vm/utilities/ostream.cpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/utilities/ostream.cpp 2009-05-14 23:41:34.000000000 -0400 X@@ -780,7 +780,7 @@ bufferedStream::~bufferedStream() { X X #ifndef PRODUCT X X-#if defined(SOLARIS) || defined(LINUX) X+#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) X #include <sys/types.h> X #include <sys/socket.h> X #include <netinet/in.h> X@@ -832,7 +832,7 @@ bool networkStream::connect(const char * X server.sin_port = htons(port); X X server.sin_addr.s_addr = inet_addr(ip); X- if (server.sin_addr.s_addr == (unsigned long)-1) { X+ if (server.sin_addr.s_addr == (uint32_t)-1) { X #ifdef _WINDOWS X struct hostent* host = hpi::get_host_by_name((char*)ip); X #else Xdiff -uNpr ../orig/hotspot/src/share/vm/utilities/vmError.cpp ./hotspot/src/share/vm/utilities/vmError.cpp X--- ../orig/hotspot/src/share/vm/utilities/vmError.cpp 2009-04-24 03:30:57.000000000 -0400 X+++ ./hotspot/src/share/vm/utilities/vmError.cpp 2009-05-14 23:41:33.000000000 -0400 X@@ -34,13 +34,18 @@ const char *env_list[] = { X "JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH", X "JAVA_COMPILER", "PATH", "USERNAME", X X- // Env variables that are defined on Solaris/Linux X+ // Env variables that are defined on Solaris/Linux/BSD X "LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY", X "HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE", X X // defined on Linux X "LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM", X X+ // defined on Darwin X+ "DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH", X+ "DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_FRAMEWORK_PATH", X+ "DYLD_INSERT_LIBRARIES", X+ X // defined on Windows X "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", X X@@ -673,6 +678,11 @@ void VMError::report_and_die() { X reset_signal_handlers(); X X } else { X+ // If UseOsErrorReporting we call this for each level of the call stack X+ // while searching for the exception handler. Only the first level needs X+ // to be reported. X+ if (UseOSErrorReporting && log_done) return; X+ X // This is not the first error, see if it happened in a different thread X // or in the same thread during error reporting. X if (first_error_tid != mytid) { X@@ -793,7 +803,7 @@ void VMError::report_and_die() { X const char* ptr = OnError; X while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ X out.print_raw ("# Executing "); X-#if defined(LINUX) X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X out.print_raw ("/bin/sh -c "); X #elif defined(SOLARIS) X out.print_raw ("/usr/bin/sh -c "); Xdiff -uNpr ../orig/jdk/make/com/sun/java/pack/Makefile ./jdk/make/com/sun/java/pack/Makefile X--- ../orig/jdk/make/com/sun/java/pack/Makefile 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/java/pack/Makefile 2009-05-14 23:41:33.000000000 -0400 X@@ -61,6 +61,7 @@ vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR X X X ifeq ($(STANDALONE),true) X+ ifneq ($(SYSTEM_ZLIB),true) X ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME) X X ZIPOBJS = $(ZIPOBJDIR)/zcrc32.$(OBJECT_SUFFIX) \ X@@ -78,6 +79,10 @@ ifeq ($(STANDALONE),true) X ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X OTHER_CXXFLAGS += $(ZINCLUDE) X LDDFLAGS += $(ZIPOBJS) X+ else X+ LDDFLAGS += -lz X+ OTHER_CXXFLAGS += -DSYSTEM_ZLIB X+ endif X else X OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI X OTHER_LDLIBS += $(JVMLIB) X@@ -102,7 +107,11 @@ ifeq ($(PLATFORM), windows) X COMPILER_WARNINGS_FATAL=false X else X LDOUTPUT = -o #Have a space X+ifeq ($(PLATFORM), bsd) X+ LDDFLAGS += -pthread X+else X LDDFLAGS += -lc X+endif X OTHER_LDLIBS += $(LIBCXX) X # setup the list of libraries to link in... X ifeq ($(PLATFORM), linux) Xdiff -uNpr ../orig/jdk/make/com/sun/security/auth/module/Makefile ./jdk/make/com/sun/security/auth/module/Makefile X--- ../orig/jdk/make/com/sun/security/auth/module/Makefile 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/security/auth/module/Makefile 2009-05-14 23:41:33.000000000 -0400 X@@ -70,7 +70,7 @@ ifeq ($(PLATFORM), solaris) X include FILES_c_solaris.gmk X endif # solaris X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X LIBRARY = jaas_unix X include FILES_export_unix.gmk X include FILES_c_unix.gmk Xdiff -uNpr ../orig/jdk/make/com/sun/tools/attach/Exportedfiles.gmk ./jdk/make/com/sun/tools/attach/Exportedfiles.gmk X--- ../orig/jdk/make/com/sun/tools/attach/Exportedfiles.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/tools/attach/Exportedfiles.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -43,5 +43,7 @@ FILES_export = \ X sun/tools/attach/LinuxVirtualMachine.java X endif X X- X- X+ifeq ($(PLATFORM), bsd) X+FILES_export = \ X+ sun/tools/attach/BsdVirtualMachine.java X+endif Xdiff -uNpr ../orig/jdk/make/com/sun/tools/attach/FILES_c.gmk ./jdk/make/com/sun/tools/attach/FILES_c.gmk X--- ../orig/jdk/make/com/sun/tools/attach/FILES_c.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/tools/attach/FILES_c.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -39,4 +39,7 @@ FILES_c = \ X LinuxVirtualMachine.c X endif X X- X+ifeq ($(PLATFORM),bsd) X+FILES_c = \ X+ BsdVirtualMachine.c X+endif Xdiff -uNpr ../orig/jdk/make/com/sun/tools/attach/FILES_java.gmk ./jdk/make/com/sun/tools/attach/FILES_java.gmk X--- ../orig/jdk/make/com/sun/tools/attach/FILES_java.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/tools/attach/FILES_java.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -43,6 +43,11 @@ FILES_java += \ X sun/tools/attach/LinuxAttachProvider.java X endif X X+ifeq ($(PLATFORM), bsd) X+FILES_java += \ X+ sun/tools/attach/BsdAttachProvider.java X+endif X+ X # X # Files that need to be copied X # Xdiff -uNpr ../orig/jdk/make/com/sun/tools/attach/Makefile ./jdk/make/com/sun/tools/attach/Makefile X--- ../orig/jdk/make/com/sun/tools/attach/Makefile 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/com/sun/tools/attach/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -36,6 +36,9 @@ endif X ifeq ($(PLATFORM), linux) X FILES_m = mapfile-linux X endif X+ifeq ($(PLATFORM), bsd) X+FILES_m = mapfile-bsd X+endif X include $(BUILDDIR)/common/Mapfile-vers.gmk X X # Xdiff -uNpr ../orig/jdk/make/com/sun/tools/attach/mapfile-bsd ./jdk/make/com/sun/tools/attach/mapfile-bsd X--- ../orig/jdk/make/com/sun/tools/attach/mapfile-bsd 2009-05-14 23:40:16.000000000 -0400 X+++ ./jdk/make/com/sun/tools/attach/mapfile-bsd 2009-05-14 23:41:34.000000000 -0400 X@@ -30,14 +30,12 @@ SUNWprivate_1.1 { X Java_sun_tools_attach_BsdVirtualMachine_checkPermissions; X Java_sun_tools_attach_BsdVirtualMachine_close; X Java_sun_tools_attach_BsdVirtualMachine_connect; X- Java_sun_tools_attach_BsdVirtualMachine_getBsdThreadsManager; X- Java_sun_tools_attach_BsdVirtualMachine_isBsdThreads; X Java_sun_tools_attach_BsdVirtualMachine_open; X Java_sun_tools_attach_BsdVirtualMachine_sendQuitTo; X- Java_sun_tools_attach_BsdVirtualMachine_sendQuitToChildrenOf; X Java_sun_tools_attach_BsdVirtualMachine_socket; X Java_sun_tools_attach_BsdVirtualMachine_read; X Java_sun_tools_attach_BsdVirtualMachine_write; X+ Java_sun_tools_attach_BsdVirtualMachine_createAttachFile; X local: X *; X }; Xdiff -uNpr ../orig/jdk/make/common/Defs-bsd.gmk ./jdk/make/common/Defs-bsd.gmk X--- ../orig/jdk/make/common/Defs-bsd.gmk 2009-05-14 23:40:16.000000000 -0400 X+++ ./jdk/make/common/Defs-bsd.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -43,12 +43,6 @@ X # Get shared JDK settings X include $(JDK_MAKE_SHARED_DIR)/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 = $(BUILDDIR)/../src/solaris X endif # PLATFORM_SRC X@@ -61,7 +55,7 @@ ifndef OPENJDK X endif 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@@ -104,6 +98,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@@ -178,7 +176,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@@ -188,33 +186,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,8 +215,8 @@ AUTOMATIC_PCH_OPTION = X # X ifeq ($(VARIANT), OPT) X ifneq ($(NO_STRIP), true) X- # Debug 'strip -g' leaves local function Elf symbols (better stack traces) X- POST_STRIP_PROCESS = $(STRIP) -g X+ # Debug 'strip -S' leaves local function Elf symbols (better stack traces) X+ POST_STRIP_PROCESS = $(STRIP) -S X endif X endif X X@@ -245,13 +225,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@@ -280,7 +256,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@@ -291,13 +269,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 X@@ -318,6 +292,14 @@ override USE_EXECNAME = true X # DPS (Displayable PostScript) is available on Solaris machines X HAVE_DPS = no X X+ifeq ($(OS_VENDOR), FreeBSD) X+ SYSTEM_ZLIB = true X+endif X+ X+ifeq ($(OS_VENDOR), OpenBSD) X+ SYSTEM_ZLIB = true X+endif X+ X # X # Japanese manpages X # Xdiff -uNpr ../orig/jdk/make/common/Defs-linux.gmk ./jdk/make/common/Defs-linux.gmk X--- ../orig/jdk/make/common/Defs-linux.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/common/Defs-linux.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -292,7 +292,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/jdk/make/common/Defs.gmk ./jdk/make/common/Defs.gmk X--- ../orig/jdk/make/common/Defs.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/common/Defs.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -188,6 +188,24 @@ else X _OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH) X endif 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@@ -223,6 +241,7 @@ DEVTOOLS_FT_DIR_EXISTS = $(shell \ X X ifdef ALT_FREETYPE_LIB_PATH X FREETYPE_LIB_PATH = $(ALT_FREETYPE_LIB_PATH) X+ USING_SYSTEM_FT_LIB=true X else X ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true) X FREETYPE_LIB_PATH = $(DEVTOOLS_FT_DIR)/lib X@@ -287,6 +306,10 @@ ifdef PROGRAM X LDLIBS_COMMON = -ldl X endif X X+ ifeq ($(PLATFORM), bsd) X+ LDLIBS_COMMON = -pthread X+ endif X+ X endif # PROGRAM X X LDLIBS_COMMON += $(EXTRA_LIBS) Xdiff -uNpr ../orig/jdk/make/common/Program.gmk ./jdk/make/common/Program.gmk X--- ../orig/jdk/make/common/Program.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/common/Program.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -67,11 +67,27 @@ endif X # Create a dependency on libjli (Java Launcher Infrastructure) X # X # On UNIX, this is a relative dependency using $ORIGIN. Unfortunately, to X-# do this reliably on Linux takes a different syntax than Solaris. X+# do this reliably on Linux takes a different syntax than Solaris. BSD's X+# don't support $ORIGIN so build an archive instead. X # X # On Windows, this is done by using the same directory as the executable X # itself, as with all the Windows libraries. X # X+ifeq ($(PLATFORM), bsd) X+ ifeq ($(OS_VENDOR), Apple) X+ LDFLAGS += -Wl,-all_load X+ LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a X+ else X+ LDFLAGS += -Wl,--whole-archive X+ LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a X+ LDFLAGS += -Wl,--no-whole-archive X+# Work-around an dlsym(RTLD_DEFAULT) bug in at least FreeBSD & OpenBSD X+ LDFLAGS += -Wl,--export-dynamic X+ endif X+ ifeq ($(SYSTEM_ZLIB),true) X+ OTHER_LDLIBS += -lz X+ endif X+endif X ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems X LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli X OTHER_LDLIBS += -ljli X@@ -175,6 +191,10 @@ else # USE_PTHREADS X THREADLIBS = $(LIBTHREAD) X endif # USE_PTHREADS X X+ifeq ($(PLATFORM), bsd) X+THREADLIBS = -pthread X+endif X+ X # X # This rule only applies on unix. It supports quantify and its ilk. X # X@@ -243,15 +263,19 @@ endif X X X ifneq ($(PLATFORM), windows) X+ifneq ($(PLATFORM), bsd) X HAVE_GETHRTIME=true X endif X+endif X X ifeq ($(HAVE_GETHRTIME),true) X OTHER_CPPFLAGS += -DHAVE_GETHRTIME X endif X X OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin X+ifneq ($(SYSTEM_ZLIB),true) X OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X+endif X X # this may not be necessary... X ifeq ($(PLATFORM), windows) Xdiff -uNpr ../orig/jdk/make/common/internal/BinaryPlugs.gmk ./jdk/make/common/internal/BinaryPlugs.gmk X--- ../orig/jdk/make/common/internal/BinaryPlugs.gmk 2009-04-24 03:33:54.000000000 -0400 X+++ ./jdk/make/common/internal/BinaryPlugs.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -49,8 +49,6 @@ PLUG_JMF_CLASS_NAMES = \ X com/sun/jmx/snmp/SnmpDataTypeEnums.class \ X com/sun/jmx/snmp/SnmpDefinitions.class \ X com/sun/jmx/snmp/SnmpOid.class \ X-com/sun/jmx/snmp/SnmpOidDatabase.class \ X-com/sun/jmx/snmp/SnmpOidDatabaseSupport.class \ X com/sun/jmx/snmp/SnmpOidRecord.class \ X com/sun/jmx/snmp/SnmpOidTable.class \ X com/sun/jmx/snmp/SnmpOidTableSupport.class \ X@@ -60,22 +58,16 @@ com/sun/jmx/snmp/SnmpPeer.class \ X com/sun/jmx/snmp/SnmpTimeticks.class \ X com/sun/jmx/snmp/SnmpVarBind.class \ X com/sun/jmx/snmp/SnmpVarBindList.class \ X-com/sun/jmx/snmp/Timestamp.class \ X com/sun/jmx/snmp/daemon/SendQ.class \ X com/sun/jmx/snmp/daemon/SnmpInformRequest.class \ X-com/sun/jmx/snmp/daemon/SnmpQManager.class \ X-com/sun/jmx/snmp/daemon/SnmpRequestCounter.class \ X-com/sun/jmx/snmp/daemon/SnmpResponseHandler.class \ X-com/sun/jmx/snmp/daemon/SnmpSendServer.class \ X-com/sun/jmx/snmp/daemon/SnmpSession.class \ X-com/sun/jmx/snmp/daemon/SnmpSocket.class \ X-com/sun/jmx/snmp/daemon/SnmpTimerServer.class \ X-com/sun/jmx/snmp/daemon/WaitQ.class X+com/sun/jmx/snmp/daemon/SnmpSession.class X+ X+PLUG_GNU_CLASS_NAMES = gnu X X # Class list temp files (used by both import and export of plugs) X X PLUG_TEMPDIR=$(ABS_TEMPDIR)/plugs X-PLUG_CLASS_AREAS = jmf X+PLUG_CLASS_AREAS = jmf gnu X PLUG_CLISTS = $(PLUG_CLASS_AREAS:%=$(PLUG_TEMPDIR)/%.clist) X X # Create jargs file command X@@ -93,11 +85,18 @@ $(PLUG_TEMPDIR)/jmf.clist: X @for i in $(PLUG_JMF_CLASS_NAMES) ; do \ X $(ECHO) "$$i" >> $@; \ X done X+$(PLUG_TEMPDIR)/gnu.clist: X+ @$(prep-target) X+ @for i in $(PLUG_GNU_CLASS_NAMES) ; do \ X+ $(ECHO) "$$i" >> $@ ; \ X+ done X $(PLUG_TEMPDIR)/all.clist: $(PLUG_CLISTS) X @$(prep-target) X $(CAT) $(PLUG_CLISTS) > $@ X $(PLUG_TEMPDIR)/jmf.jargs: $(PLUG_TEMPDIR)/jmf.clist X $(plug-create-jargs) X+$(PLUG_TEMPDIR)/gnu.jargs: $(PLUG_TEMPDIR)/gnu.clist X+ $(plug-create-jargs) X $(PLUG_TEMPDIR)/all.jargs: $(PLUG_TEMPDIR)/all.clist X $(plug-create-jargs) X X@@ -153,11 +152,16 @@ endif # IMPORT_BINARY_PLUGS X X import-binary-plug-jmf-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/jmf.clist X $(call import-binary-plug-classes,$(PLUG_TEMPDIR)/jmf.clist) X+import-binary-plug-gnu-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/gnu.clist X+ $(call import-binary-plug-classes,$(PLUG_TEMPDIR)/gnu.clist) X+ X+ X X # Import all classes from the jar file X X import-binary-plug-jar: \ X- import-binary-plug-jmf-classes X+ import-binary-plug-jmf-classes \ X+ import-binary-plug-gnu-classes X X # Binary plug start/complete messages X X@@ -169,14 +173,12 @@ import-binary-plugs-completed: X X # Import lib files (only if they don't exist already) X X-import-binary-plugs-libs: \ X- $(PLUG_LIBRARY_NAMES:%=$(LIB_LOCATION)/%) X+import-binary-plugs-libs: X X # Import everything X X import-binary-plugs: \ X import-binary-plugs-started \ X- import-binary-plugs-libs \ X import-binary-plug-jar \ X import-binary-plugs-completed X Xdiff -uNpr ../orig/jdk/make/common/shared/Compiler-gcc.gmk ./jdk/make/common/shared/Compiler-gcc.gmk X--- ../orig/jdk/make/common/shared/Compiler-gcc.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/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+ 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.2 X+ X+ # Option used to create a shared library 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+ SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 ) X+endif X+ X ifeq ($(PLATFORM), solaris) X X # Settings specific to Solaris Xdiff -uNpr ../orig/jdk/make/common/shared/Compiler.gmk ./jdk/make/common/shared/Compiler.gmk X--- ../orig/jdk/make/common/shared/Compiler.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Compiler.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -37,8 +37,8 @@ ifeq ($(PLATFORM), solaris) X override CC_VERSION = sun X endif X X-# Linux uses GNU compilers by default X-ifeq ($(PLATFORM), linux) X+# Linux & BSD uses GNU compilers by default X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X override CC_VERSION = gcc X endif X Xdiff -uNpr ../orig/jdk/make/common/shared/Defs-bsd.gmk ./jdk/make/common/shared/Defs-bsd.gmk X--- ../orig/jdk/make/common/shared/Defs-bsd.gmk 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/make/common/shared/Defs-bsd.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -70,7 +70,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@@ -123,7 +123,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. X@@ -162,16 +162,12 @@ else X endif X MOTIF_INCLUDE = $(MOTIF_DIR)/include X X-# GCC29_COMPILER_PATH: is the path to where the gcc 2.9 compiler is installed X-# NOTE: Must end with / so that it could be empty, allowing PATH usage. X-ifneq "$(origin ALT_GCC29_COMPILER_PATH)" "undefined" X- GCC29_COMPILER_PATH :=$(call PrefixPath,$(ALT_GCC29_COMPILER_PATH)) X+ifeq ($(OS_VENDOR), Apple) X+ _CUPS_HEADERS_PATH=/usr/include X else X- GCC29_COMPILER_PATH = $(JDK_DEVTOOLS_DIR)/$(PLATFORM)/gcc29/usr/ X+ _CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include X endif X X-_CUPS_HEADERS_PATH=/usr/include X- X # Import JDK images allow for partial builds, components not built are X # imported (or copied from) these import areas when needed. X Xdiff -uNpr ../orig/jdk/make/common/shared/Defs-utils.gmk ./jdk/make/common/shared/Defs-utils.gmk X--- ../orig/jdk/make/common/shared/Defs-utils.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Defs-utils.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -77,6 +77,13 @@ ifndef FINDBUGS_HOME X endif X FINDBUGS = $(FINDBUGS_HOME)/bin/findbugs 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 # Utilities X ADB = $(UTILS_COMMAND_PATH)adb X AR = $(UTILS_CCS_BIN_PATH)ar X@@ -198,3 +205,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/jdk/make/common/shared/Defs.gmk ./jdk/make/common/shared/Defs.gmk X--- ../orig/jdk/make/common/shared/Defs.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Defs.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -143,7 +143,7 @@ $(shell \ X echo older; \ X else \ X if [ $(call MajorVersion,$1) -eq $(call MajorVersion,$2) -a \ X- $(call MinorVersion,$1) -lt $(call MinorVersion,$2) ]; then \ X+ `echo $(call MinorVersion,$1) | sed -e 's/\([0-9]*\)\(.*\)/\1/'` -lt $(call MinorVersion,$2) ]; then \ X echo older; \ X else \ X echo newer; \ Xdiff -uNpr ../orig/jdk/make/common/shared/Platform.gmk ./jdk/make/common/shared/Platform.gmk X--- ../orig/jdk/make/common/shared/Platform.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Platform.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -276,6 +276,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@@ -392,6 +462,13 @@ endif 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+# 736 is the max for OpenBSD. 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@@ -403,7 +480,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 \ X@@ -455,6 +532,15 @@ ifneq ($(PLATFORM), windows) X ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) X endif X X+# Darwin-specific Overrides X+ifeq ($(SYSTEM_UNAME),Darwin) X+ # The suffix applied to runtime libraries X+ LIBRARY_SUFFIX = dylib X+ # The suffix applied to link libraries X+ LIB_SUFFIX = dylib X+endif X+ X+ X # If blanks in the username, use the first 4 words and pack them together X _USER1:=$(subst ', ,$(_USER)) X _USER2:=$(subst ", ,$(_USER1)) Xdiff -uNpr ../orig/jdk/make/common/shared/Sanity-Settings.gmk ./jdk/make/common/shared/Sanity-Settings.gmk X--- ../orig/jdk/make/common/shared/Sanity-Settings.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Sanity-Settings.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -257,6 +257,7 @@ ifdef OPENJDK X ALL_SETTINGS+=$(call addHeading,OpenJDK-specific settings) X ALL_SETTINGS+=$(call addAltSetting,FREETYPE_HEADERS_PATH) X ALL_SETTINGS+=$(call addAltSetting,FREETYPE_LIB_PATH) X+ ALL_SETTINGS+=$(call addAltSetting,X11_PATH) X ALL_SETTINGS+=$(call addHeading,OPENJDK Import Binary Plug Settings) X ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_JARFILE) X ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_PATH) Xdiff -uNpr ../orig/jdk/make/common/shared/Sanity.gmk ./jdk/make/common/shared/Sanity.gmk X--- ../orig/jdk/make/common/shared/Sanity.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/common/shared/Sanity.gmk 2009-05-14 23:41:33.000000000 -0400 X@@ -96,6 +96,11 @@ ifeq ($(PLATFORM), windows) X $(EGREP) "\#define" | $(NAWK) '{print $$3}') X endif X X+ifeq ($(PLATFORM), bsd) X+ FREE_SPACE := $(shell BLOCKSIZE=512 $(DF) $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK) '{print $$2;}') X+ TEMP_FREE_SPACE := $(shell BLOCKSIZE=512 $(DF) $(TEMP_DISK) | $(TAIL) -1 | $(NAWK) '{print $$2;}') X+endif X+ X # Get the version numbers of what we are using X _MAKE_VER :=$(shell $(MAKE) --version 2>&1 | $(HEAD) -n 1) X _ZIP_VER :=$(shell $(ZIPEXE) -help 2>&1 | $(HEAD) -n 4 | $(EGREP) '^Zip') Xdiff -uNpr ../orig/jdk/make/docs/Makefile ./jdk/make/docs/Makefile X--- ../orig/jdk/make/docs/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/docs/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -232,7 +232,7 @@ JDI_HEADER = "Java Debug Interface" X # you get "No packages or classes specified." due to $(CLASSPATH_SEPARATOR) X # being interpreted as an end of command (newline) X X-JAAS_SOURCEPATH = "$(TOPDIR)/src/share/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/solaris/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/windows/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/linux/classes" X+JAAS_SOURCEPATH = "$(TOPDIR)/src/share/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/solaris/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/windows/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/linux/classes$(CLASSPATH_SEPARATOR)$(TOPDIR)/src/bsd/classes" X JAAS_DOCDIR = $(DOCSDIR)/jre/api/security/jaas/spec X JAAS_JAVADOCFLAGS = $(COMMON_JAVADOCFLAGS) \ X -encoding ascii \ Xdiff -uNpr ../orig/jdk/make/java/Makefile ./jdk/make/java/Makefile X--- ../orig/jdk/make/java/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -49,7 +49,7 @@ ifeq ($(PLATFORM), solaris) X endif X endif # PLATFORM X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X SUBDIRS += jexec X endif # PLATFORM X Xdiff -uNpr ../orig/jdk/make/java/hpi/hpi_common.gmk ./jdk/make/java/hpi/hpi_common.gmk X--- ../orig/jdk/make/java/hpi/hpi_common.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/hpi/hpi_common.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -86,5 +86,9 @@ endif X # Things that must be linked in. X # X ifneq ($(PLATFORM), windows) X+ifeq ($(PLATFORM), bsd) X+OTHER_LDLIBS += $(LIBM) X+else X OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl X endif X+endif Xdiff -uNpr ../orig/jdk/make/java/hpi/native/Makefile ./jdk/make/java/hpi/native/Makefile X--- ../orig/jdk/make/java/hpi/native/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/hpi/native/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -72,11 +72,18 @@ OTHER_CPPFLAGS += -DUSE_PTHREADS X ifeq ($(MOOT_PRIORITIES),true) X OTHER_CPPFLAGS += -DMOOT_PRIORITIES X endif X+ifeq ($(PLATFORM), bsd) X+LIBPOSIX4 = X+OTHER_LDLIBS += -pthread X+else X LIBPOSIX4 = -lposix4 X OTHER_LDLIBS += -lpthread $(LIBPOSIX4) X endif X+endif X X+ifneq ($(PLATFORM), bsd) X HAVE_GETHRVTIME=true X+endif X ifeq ($(HAVE_GETHRVTIME),true) X OTHER_CPPFLAGS += -DHAVE_GETHRVTIME X endif Xdiff -uNpr ../orig/jdk/make/java/instrument/Makefile ./jdk/make/java/instrument/Makefile X--- ../orig/jdk/make/java/instrument/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/instrument/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -102,6 +102,21 @@ ifeq ($(PLATFORM), windows) X # equivalent of strcasecmp is stricmp on Windows X CPPFLAGS_COMMON += -Dstrcasecmp=stricmp X else X+ifeq ($(PLATFORM), bsd) X+ ifeq ($(OS_VENDOR), Apple) X+ LDFLAGS += -Wl,-all_load X+ LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a X+ else X+ LDFLAGS += -Wl,--whole-archive X+ LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a X+ LDFLAGS += -Wl,--no-whole-archive X+ endif X+ X+ ICONV_PATH = $(PACKAGE_PATH) X+# Use CPPFLAGS instead of OTHER_INCLUDES to force this last X+ CPPFLAGS += -I$(ICONV_PATH)/include X+ OTHER_LDLIBS += -L$(ICONV_PATH)/lib -liconv X+else X LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli X OTHER_LDLIBS += -ljli X OTHER_LDLIBS += -ldl X@@ -114,6 +129,7 @@ else X LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/jli X endif X endif X+endif X X # X # Library to compile. Xdiff -uNpr ../orig/jdk/make/java/java/Makefile ./jdk/make/java/java/Makefile X--- ../orig/jdk/make/java/java/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/java/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -167,8 +167,10 @@ OTHER_INCLUDES += -I$(PLATFORM_SRC)/nati X # Is the altzone extern documented in ctime(3C) available? X # X ifneq ($(PLATFORM), windows) X+ifneq ($(PLATFORM), bsd) X HAVE_ALTZONE=true X endif X+endif X X ifeq ($(HAVE_ALTZONE),true) X OTHER_CPPFLAGS += -DHAVE_ALTZONE X@@ -205,9 +207,14 @@ ifeq ($(PLATFORM),windows) X OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ X -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib X else X+ifeq ($(PLATFORM), bsd) X+OTHER_LDLIBS += $(JVMLIB) -lverify \ X+ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) X+else X OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \ X -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) X endif X+endif X X # X # Rules. Xdiff -uNpr ../orig/jdk/make/java/java/localegen.sh ./jdk/make/java/java/localegen.sh X--- ../orig/jdk/make/java/java/localegen.sh 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/java/localegen.sh 2009-05-14 23:41:34.000000000 -0400 X@@ -55,9 +55,9 @@ sed_script="$SED -e \"s@^#warn .*@// -- X for FILE in $RESOURCE_NAMES X do X getlocalelist $FILE $EURO_FILES_LIST X- sed_script=$sed_script"-e \"s/#"$FILE"_EuroLocales#/$localelist/g\" " X+ sed_script=$sed_script"-e \"s@#"$FILE"_EuroLocales#@$localelist@g\" " X getlocalelist $FILE $NONEURO_FILES_LIST X- sed_script=$sed_script"-e \"s/#"$FILE"_NonEuroLocales#/$localelist/g\" " X+ sed_script=$sed_script"-e \"s@#"$FILE"_NonEuroLocales#@$localelist@g\" " X done X X sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE" Xdiff -uNpr ../orig/jdk/make/java/java_hprof_demo/Makefile ./jdk/make/java/java_hprof_demo/Makefile X--- ../orig/jdk/make/java/java_hprof_demo/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/java_hprof_demo/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -83,8 +83,10 @@ OTHER_INCLUDES = -I$(SRCDIR) \ X ifeq ($(PLATFORM), windows) X OTHER_LDLIBS += wsock32.lib winmm.lib X else X+ifneq ($(PLATFORM), bsd) X OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl X endif X+endif X X # X # Tell library.gmk to copy the txt file first Xdiff -uNpr ../orig/jdk/make/java/jli/Makefile ./jdk/make/java/jli/Makefile X--- ../orig/jdk/make/java/jli/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/jli/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -44,8 +44,10 @@ MS_RUNTIME_STATIC = true X X include $(BUILDDIR)/common/Defs.gmk X X+ifneq ($(SYSTEM_ZLIB),true) X ZLIB_VERSION = 1.1.3 X ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) X+endif X LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin X LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin X X@@ -56,7 +58,10 @@ FILES_c = \ X parse_manifest.c \ X version_comp.c \ X wildcard.c \ X- jli_util.c \ X+ jli_util.c X+ X+ifneq ($(SYSTEM_ZLIB),true) X+FILES_c += \ X inflate.c \ X infblock.c \ X inftrees.c \ X@@ -65,6 +70,7 @@ FILES_c = \ X infutil.c \ X zadler32.c \ X zutil.c X+endif X X OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS X X@@ -98,7 +104,11 @@ endif X X OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC) X OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC) X-OTHER_INCLUDES += -I$(ZIP_SRC) X+ifneq ($(SYSTEM_ZLIB),true) X+ OTHER_INCLUDES += -I$(ZIP_SRC) X+else X+ LDLIBS += -lz X+endif X X # X # Library to compile. X@@ -136,8 +146,29 @@ library:: $(STATIC_LIBRARY) X X endif # PLATFORM X X+ifeq ($(PLATFORM), bsd) X+ X+STATIC_LIBRARY_DIR = $(OBJDIR)/static X+STATIC_LIBRARY_NAME = lib$(LIBRARY).a X+STATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME) X+ X+$(STATIC_LIBRARY_DIR): $(OBJDIR) X+ @$(MKDIR) $(STATIC_LIBRARY_DIR) X+ X+$(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR) X+ @$(prep-target) X+ $(AR) -r $@ $(FILES_o) X+ X+library:: $(STATIC_LIBRARY) X+ X+endif # PLATFORM X+ X # X # Add to ambient vpath so we pick up the library files X # X-vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) X+vpath %.c $(LAUNCHER_SHARE_SRC) X+ifneq ($(SYSTEM_ZLIB),true) X+ vpath %.c $(ZIP_SRC) X+endif X+ X Xdiff -uNpr ../orig/jdk/make/java/management/Makefile ./jdk/make/java/management/Makefile X--- ../orig/jdk/make/java/management/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/management/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -85,6 +85,11 @@ vpath %.c $(PLATFORM_SRC)/native/com/sun X OTHER_INCLUDES += \ X -I$(SHARE_SRC)/native/sun/management X X+ifeq ($(PLATFORM),bsd) X+OTHER_INCLUDES += \ X+ -I$(PLATFORM_SRC)/hpi/include X+endif X+ X ifeq ($(PLATFORM),windows) X OTHER_LDLIBS += $(JVMLIB) X endif Xdiff -uNpr ../orig/jdk/make/java/net/FILES_c.gmk ./jdk/make/java/net/FILES_c.gmk X--- ../orig/jdk/make/java/net/FILES_c.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/net/FILES_c.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -43,6 +43,10 @@ ifeq ($(PLATFORM), linux) X FILES_c += linux_close.c X endif X X+ifeq ($(OS_VENDOR), FreeBSD) X+ FILES_c += bsd_close.c X+endif X+ X ifeq ($(PLATFORM), windows) X FILES_c += TwoStacksPlainSocketImpl.c X FILES_c += DualStackPlainSocketImpl.c Xdiff -uNpr ../orig/jdk/make/java/net/Makefile ./jdk/make/java/net/Makefile X--- ../orig/jdk/make/java/net/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/net/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -92,6 +92,12 @@ include $(BUILDDIR)/common/Mapfile-vers. X X include $(BUILDDIR)/common/Library.gmk X X+ifeq ($(PLATFORM), bsd) X+ ifdef DONT_ENABLE_IPV6 X+ OTHER_CFLAGS += -DDONT_ENABLE_IPV6 X+ endif X+ OTHER_LDLIBS = $(JVMLIB) -pthread X+else X ifeq ($(PLATFORM), windows) X OTHER_LDLIBS = ws2_32.lib $(JVMLIB) X # Will not compile at warning level 3 if warnings are fatal X@@ -102,6 +108,7 @@ endif X ifeq ($(PLATFORM), linux) X OTHER_LDLIBS += -lpthread X endif X+endif # PLATFORM == bsd X X CLASSES.export += java.lang.Integer java.io.FileDescriptor java.net.InetAddressImplFactory java.net.Inet4AddressImpl java.net.Inet6AddressImpl X Xdiff -uNpr ../orig/jdk/make/java/nio/Makefile ./jdk/make/java/nio/Makefile X--- ../orig/jdk/make/java/nio/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/nio/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -82,7 +82,7 @@ FILES_export += \ X sun/nio/ch/WindowsSelectorImpl.java X endif # PLATFORM = windows X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X FILES_java += \ X sun/nio/ch/AbstractPollSelectorImpl.java \ X sun/nio/ch/EPollArrayWrapper.java \ X@@ -126,6 +126,11 @@ OTHER_INCLUDES += \ X -I$(PLATFORM_SRC)/native/java/net \ X -I$(CLASSHDRDIR)/../../../java.lang/java/CClassHeaders X X+ifeq ($(PLATFORM), bsd) X+OTHER_INCLUDES += \ X+ -I$(PLATFORM_SRC)/hpi/include X+endif X+ X ifeq ($(PLATFORM),windows) X OTHER_LDLIBS += $(JVMLIB) ws2_32.lib \ X -libpath:$(LIBDIR) java.lib \ X@@ -137,6 +142,9 @@ ifeq ($(PLATFORM), linux) X COMPILER_WARNINGS_FATAL=true X OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread -ldl X endif X+ifeq ($(PLATFORM), bsd) X+OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -pthread X+endif X ifeq ($(PLATFORM), solaris) X OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl \ X -L$(LIBDIR)/$(LIBARCH) -ljava -lnet X@@ -159,6 +167,9 @@ endif X ifeq ($(PLATFORM), linux) X FILES_m = mapfile-linux X endif X+ifeq ($(PLATFORM), bsd) X+FILES_m = mapfile-bsd X+endif X include $(BUILDDIR)/common/Mapfile-vers.gmk X include $(BUILDDIR)/common/Library.gmk X Xdiff -uNpr ../orig/jdk/make/java/npt/Makefile ./jdk/make/java/npt/Makefile X--- ../orig/jdk/make/java/npt/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/npt/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -70,6 +70,18 @@ ifeq ($(PLATFORM), windows) X OTHER_LCF += -export:nptInitialize -export:nptTerminate X endif X X+# Add location of iconv headers & libs X+ifeq ($(PLATFORM), bsd) X+ ifeq ($(OS_VENDOR), Apple) X+ OTHER_LDLIBS += -liconv X+ else X+ ifneq ($(OS_NAME), netbsd) X+ CPPFLAGS += -I$(PACKAGE_PATH)/include X+ OTHER_LDLIBS += -L$(PACKAGE_PATH)/lib -liconv X+ endif X+ endif X+endif X+ X # X # Add to ambient vpath so we pick up the library files X # Xdiff -uNpr ../orig/jdk/make/java/redist/FILES.gmk ./jdk/make/java/redist/FILES.gmk X--- ../orig/jdk/make/java/redist/FILES.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/redist/FILES.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -38,6 +38,14 @@ SHARED_FONTFILES = \ X $(LIBDIR)/fonts/LucidaSansDemiBold.ttf \ X X ifeq ($(PLATFORM), linux) X+NEED_OBLIQUE_FONTS = true X+endif X+ X+ifeq ($(PLATFORM), bsd) X+NEED_OBLIQUE_FONTS = true X+endif X+ X+ifeq ($(NEED_OBLIQUE_FONTS), true) X X # The oblique versions of the font are derived from the base versions X # and since 2D can do this derivation on the fly at run time there is no Xdiff -uNpr ../orig/jdk/make/java/redist/Makefile ./jdk/make/java/redist/Makefile X--- ../orig/jdk/make/java/redist/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/redist/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -312,7 +312,7 @@ $(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/sha X $(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir X $(install-file) X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X X # The oblique fonts are only needed/wanted on Linux. X X@@ -326,7 +326,7 @@ $(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_ X $(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir X $(install-file) X X-endif # linux X+endif # linux || bsd X endif # !OPENJDK X X # Import internal files (ones that are stashed in this source tree) Xdiff -uNpr ../orig/jdk/make/java/security/Makefile ./jdk/make/java/security/Makefile X--- ../orig/jdk/make/java/security/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/security/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -51,7 +51,15 @@ ifeq ($(PLATFORM), windows) X ifneq ($(ARCH_DATA_MODEL), 64) X PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-windows X endif X+ X+else # windows X+ X+ifeq ($(PLATFORM), bsd) X+ ifeq ($(OS_VENDOR), OpenBSD) X+ PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-openbsd X+ endif X endif X+endif # windows X endif # PLATFORM X X Xdiff -uNpr ../orig/jdk/make/java/zip/FILES_c.gmk ./jdk/make/java/zip/FILES_c.gmk X--- ../orig/jdk/make/java/zip/FILES_c.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/zip/FILES_c.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -30,6 +30,10 @@ FILES_c = \ X Inflater.c \ X ZipFile.c \ X ZipEntry.c \ X+ zip_util.c X+ X+ifneq ($(SYSTEM_ZLIB),true) X+FILES_c += \ X zadler32.c \ X zcrc32.c \ X deflate.c \ X@@ -40,5 +44,5 @@ FILES_c = \ X inftrees.c \ X infcodes.c \ X infutil.c \ X- inffast.c \ X- zip_util.c X+ inffast.c X+endif Xdiff -uNpr ../orig/jdk/make/java/zip/Makefile ./jdk/make/java/zip/Makefile X--- ../orig/jdk/make/java/zip/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/java/zip/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -72,16 +72,24 @@ else X CPPFLAGS += -UDEBUG X endif X X-CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) X CPPFLAGS += -I$(SHARE_SRC)/native/java/io X CPPFLAGS += -I$(PLATFORM_SRC)/native/java/io X X+ifneq ($(SYSTEM_ZLIB),true) X+CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) X+ X # X # Add to ambient vpath so we pick up the library files X # X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/zlib-$(ZLIB_VERSION) X+endif X X # X # Link to JVM library for JVM_Zip* functions X # X+ifeq ($(SYSTEM_ZLIB),true) X+OTHER_LDLIBS = -lz X+else X OTHER_LDLIBS = $(JVMLIB) X+endif X+ Xdiff -uNpr ../orig/jdk/make/javax/sound/FILES_c.gmk ./jdk/make/javax/sound/FILES_c.gmk X--- ../orig/jdk/make/javax/sound/FILES_c.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/javax/sound/FILES_c.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -34,6 +34,8 @@ FILES_solaris = \ X X FILES_linux = X X+FILES_bsd = X+ X FILES_windows = \ X PLATFORM_API_WinOS_MidiIn.c \ X PLATFORM_API_WinOS_MidiOut.c \ Xdiff -uNpr ../orig/jdk/make/javax/sound/Makefile ./jdk/make/javax/sound/Makefile X--- ../orig/jdk/make/javax/sound/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/javax/sound/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -107,6 +107,19 @@ ifeq ($(PLATFORM), linux) X #MXSPP_ADD = $(PLATFORM)-$(ARCH)/ X endif # PLATFORM linux X X+# XXXBSD: ??? X+ifeq ($(PLATFORM), bsd) X+ # build with empty MIDI i/o X+ INCLUDE_MIDI = TRUE X+ # build with empty ports X+ INCLUDE_PORTS = TRUE X+ # build with empty direct audio X+ INCLUDE_DAUDIO = TRUE X+ ifeq ($(OS_VENDOR), OpenBSD) X+ LDFLAGS += -lossaudio X+ endif X+endif # PLATFORM bsd X+ X ifeq ($(PLATFORM), solaris) X ifneq ($(ARCH), amd64) X # build with ports and direct audio Xdiff -uNpr ../orig/jdk/make/javax/sound/SoundDefs.gmk ./jdk/make/javax/sound/SoundDefs.gmk X--- ../orig/jdk/make/javax/sound/SoundDefs.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/javax/sound/SoundDefs.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -40,6 +40,10 @@ ifeq ($(PLATFORM), linux) X CPPFLAGS += -DX_PLATFORM=X_LINUX X endif # PLATFORM linux X X+ifeq ($(PLATFORM), bsd) X+ CPPFLAGS += -DX_PLATFORM=X_BSD X+endif # PLATFORM bsd X+ X ifeq ($(PLATFORM), solaris) X CPPFLAGS += -DX_PLATFORM=X_SOLARIS X Xdiff -uNpr ../orig/jdk/make/jpda/back/Makefile ./jdk/make/jpda/back/Makefile X--- ../orig/jdk/make/jpda/back/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/jpda/back/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -49,8 +49,10 @@ OTHER_INCLUDES = -I$(SHARE_SRC)/transpor X -I$(GENNATIVESRCDIR)/jdwp X X ifneq ($(PLATFORM), windows) X+ifneq ($(PLATFORM), bsd) X OTHER_LDLIBS += -ldl X endif # PLATFORM X+endif # PLATFORM X X # X # This turns off all assert() checking in the optimized library Xdiff -uNpr ../orig/jdk/make/jpda/transport/socket/Makefile ./jdk/make/jpda/transport/socket/Makefile X--- ../orig/jdk/make/jpda/transport/socket/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/jpda/transport/socket/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -45,6 +45,11 @@ ifeq ($(PLATFORM), linux) X OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread X endif X X+ifeq ($(PLATFORM), bsd) X+ LIBSOCKET = X+ OTHER_LDLIBS += -pthread X+endif X+ X ifeq ($(PLATFORM), solaris) X OTHER_LDLIBS += -lnsl $(LIBSOCKET) X endif Xdiff -uNpr ../orig/jdk/make/sun/awt/Makefile ./jdk/make/sun/awt/Makefile X--- ../orig/jdk/make/sun/awt/Makefile 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/sun/awt/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -129,6 +129,14 @@ OTHER_CFLAGS += -DMOTIF_VERSION=2 X OTHER_LDLIBS = $(JVMLIB) $(LIBM) -ldl X endif X X+ifeq ($(PLATFORM), bsd) X+FILES_c = $(FILES_2D_c) X+FILES_c += awt_LoadLibrary.c X+OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH X+OTHER_CFLAGS += -DMOTIF_VERSION=2 X+OTHER_LDLIBS = $(JVMLIB) $(LIBM) X+endif X+ X FILES_c += initIDs.c X X # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SOLARIS/LINUX X@@ -241,7 +249,7 @@ vpath %.c $(SHARE_SRC)/native/$(PKGD X # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ WINDOWS X endif # PLATFORM X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv LINUX X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/opengl X vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/../java2d/opengl X@@ -421,6 +429,19 @@ FONTCONFIGS_SRC_PREFIX = $(PLATFORM). X # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SOLARIS X endif # PLATFORM X X+ifeq ($(PLATFORM), bsd) X+# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv BSD X+ X+FONTCONFIGS_SRC = $(PLATFORM_SRC)/classes/sun/awt/fontconfigs X+_FONTCONFIGS = \ X+ fontconfig.properties X+ X+FONTCONFIGS_SRC_PREFIX = $(PLATFORM). X+ X+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BSD X+endif # PLATFORM X+ X+ X FONTCONFIGS = $(_FONTCONFIGS:%=$(LIBDIR)/%.src) X BINARYFONTCONFIGS = $(_FONTCONFIGS:%.properties=$(LIBDIR)/%.bfc) X X@@ -514,6 +535,9 @@ CPPFLAGS += -I$(MOTIF_DIR)/include \ X -I$(OPENWIN_HOME)/include/X11/extensions \ X -I$(PLATFORM_SRC)/native/$(PKGDIR)/font X endif X+ifeq ($(PLATFORM), bsd) X+CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/font X+endif X CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \ X -I$(SHARE_SRC)/native/$(PKGDIR)/../font \ X -I$(PLATFORM_SRC)/native/$(PKGDIR)/../font \ X@@ -535,7 +559,13 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGD X -I$(PLATFORM_SRC)/native/$(PKGDIR) \ X $(EVENT_MODEL) X X-ifeq ($(PLATFORM), linux) X+# include these last so we don't pick up unintentional includes X+ifeq ($(PLATFORM), bsd) X+CPPFLAGS += -I$(OPENWIN_HOME)/include \ X+ -I$(OPENWIN_HOME)/include/X11/extensions X+endif X+ X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB) X endif X Xdiff -uNpr ../orig/jdk/make/sun/awt/mawt.gmk ./jdk/make/sun/awt/mawt.gmk X--- ../orig/jdk/make/sun/awt/mawt.gmk 2009-04-24 03:33:55.000000000 -0400 X+++ ./jdk/make/sun/awt/mawt.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -172,7 +172,7 @@ ifeq ($(PLATFORM), solaris) X OTHER_LDLIBS = $(LIBXM) -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi X endif X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH X OTHER_CFLAGS += -DMOTIF_VERSION=2 X OTHER_CFLAGS += -DXMSTRINGDEFINES=1 X@@ -183,7 +183,11 @@ endif X # !HEADLESS X X OTHER_LDLIBS += $(JVMLIB) $(LIBCXX) \ X- -lawt $(LIBM) -ldl X+ -lawt $(LIBM) X+ X+ifneq ($(PLATFORM), bsd) X+OTHER_LDLIBS += -ldl X+endif X X # X # Sun CC with -Xa misdefines __STDC__ to 0 (zero). X@@ -227,16 +231,33 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGD X -I$(PLATFORM_SRC)/native/$(PKGDIR) \ X $(EVENT_MODEL) X X+CPPFLAGS += -I$(CUPS_HEADERS_PATH) X+ X+ifndef HEADLESS X+CPPFLAGS += -I$(MOTIF_DIR)/include \ X+ -I$(OPENWIN_HOME)/include X+LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB) X+ X+endif # !HEADLESS X+ X ifeq ($(PLATFORM), linux) X # Checking for the X11/extensions headers at the additional location X CPPFLAGS += -I/X11R6/include/X11/extensions \ X -I/usr/include/X11/extensions X endif X X+ifeq ($(PLATFORM), bsd) X+ CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \ X+ -I$(OPENWIN_HOME)/include X+endif X+ X ifeq ($(PLATFORM), solaris) X CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions X endif X X+ifneq ($(PLATFORM), windows) X+ CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" X+endif X X LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \ X $(AWT_RUNPATH) Xdiff -uNpr ../orig/jdk/make/sun/font/Makefile ./jdk/make/sun/font/Makefile X--- ../orig/jdk/make/sun/font/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/font/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -177,6 +177,15 @@ else # PLATFORM X # Libraries to link, and other C flags. X # X X+ifeq ($(PLATFORM), bsd) X+OTHER_INCLUDES += -I$(X11_PATH)/include X+OTHER_LDLIBS += -lawt $(LIBM) $(LIBCXX) X+ ifeq ($(OS_VENDOR),Apple) X+ # XXXDARWIN Match BSD/Linux behavior -- the mawt.dylib symbols will X+ # be available at runtime. X+ OTHER_LDLIBS += -flat_namespace -undefined suppress X+ endif X+else X ifeq ($(PLATFORM), solaris) X # Note that on Solaris, fontmanager is built against the headless library. X LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/headless X@@ -187,6 +196,7 @@ else # PLATFORM is linux X OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X endif X endif X+endif X X endif # PLATFORM X Xdiff -uNpr ../orig/jdk/make/sun/image/generic/Makefile ./jdk/make/sun/image/generic/Makefile X--- ../orig/jdk/make/sun/image/generic/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/image/generic/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -69,5 +69,9 @@ CPPFLAGS += \ X -I$(PLATFORM_SRC)/native/$(PKGDIR)/medialib X X OTHER_CFLAGS += -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES X-OTHER_LDLIBS = $(LIBM) -ldl X+OTHER_LDLIBS = $(LIBM) X+ifneq ($(PLATFORM), bsd) X+OTHER_LDLIBS += -ldl X+endif X+ X Xdiff -uNpr ../orig/jdk/make/sun/jawt/Makefile ./jdk/make/sun/jawt/Makefile X--- ../orig/jdk/make/sun/jawt/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/jawt/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -98,9 +98,7 @@ else # PLATFORM X # X # Other extra flags needed for compiling. X # X-CPPFLAGS += -I$(OPENWIN_HOME)/include \ X- -I$(MOTIF_DIR)/include \ X- -I$(SHARE_SRC)/native/$(PKGDIR)/debug \ X+CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \ X -I$(SHARE_SRC)/native/$(PKGDIR)/image \ X -I$(SHARE_SRC)/native/$(PKGDIR)/image/cvutils \ X -I$(SHARE_SRC)/native/$(PKGDIR)/alphacomposite \ X@@ -114,6 +112,8 @@ CPPFLAGS += -I$(OPENWIN_HOME)/include \ X -I$(SHARE_SRC)/native/$(PKGDIR)/../dc/doe \ X -I$(SHARE_SRC)/native/$(PKGDIR)/../dc/path \ X -I$(PLATFORM_SRC)/native/$(PKGDIR)/../jdga \ X+ -I$(OPENWIN_HOME)/include \ X+ -I$(MOTIF_DIR)/include \ X $(EVENT_MODEL) X # X # Libraries to link in. X@@ -122,7 +122,7 @@ ifeq ($(PLATFORM), solaris) X OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt X endif # PLATFORM X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt X endif # PLATFORM X Xdiff -uNpr ../orig/jdk/make/sun/security/jgss/wrapper/Makefile ./jdk/make/sun/security/jgss/wrapper/Makefile X--- ../orig/jdk/make/sun/security/jgss/wrapper/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/security/jgss/wrapper/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -71,6 +71,10 @@ include $(BUILDDIR)/common/Library.gmk X # X # Libraries to link X # X-ifneq ($(PLATFORM), windows) X+ifneq (,$(findstring $(PLATFORM), linux solaris)) X OTHER_LDLIBS = -ldl $(JVMLIB) X endif X+ X+ifeq ($(PLATFORM), bsd) X+ OTHER_LDLIBS = $(JVMLIB) X+endif Xdiff -uNpr ../orig/jdk/make/sun/security/pkcs11/Makefile ./jdk/make/sun/security/pkcs11/Makefile X--- ../orig/jdk/make/sun/security/pkcs11/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/security/pkcs11/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -155,7 +155,7 @@ include $(BUILDDIR)/common/Library.gmk X # X # Libraries to link X # X-ifeq ($(PLATFORM), windows) X+ifneq (,$(findstring $(PLATFORM), windows bsd)) X OTHER_LDLIBS = $(JVMLIB) X else X OTHER_LDLIBS = -ldl $(JVMLIB) Xdiff -uNpr ../orig/jdk/make/sun/security/smartcardio/Makefile ./jdk/make/sun/security/smartcardio/Makefile X--- ../orig/jdk/make/sun/security/smartcardio/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/security/smartcardio/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -75,6 +75,10 @@ include $(BUILDDIR)/common/Library.gmk X ifeq ($(PLATFORM), windows) X OTHER_LDLIBS = $(JVMLIB) winscard.lib X else X- OTHER_LDLIBS = -ldl $(JVMLIB) X+ ifeq ($(PLATFORM), bsd) X+ OTHER_LDLIBS = $(JVMLIB) X+ else X+ OTHER_LDLIBS = -ldl $(JVMLIB) X+ endif X OTHER_CFLAGS = -D__sun_jdk X endif Xdiff -uNpr ../orig/jdk/make/sun/splashscreen/FILES_c.gmk ./jdk/make/sun/splashscreen/FILES_c.gmk X--- ../orig/jdk/make/sun/splashscreen/FILES_c.gmk 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/splashscreen/FILES_c.gmk 2009-05-14 23:41:34.000000000 -0400 X@@ -49,20 +49,6 @@ FILES_c = \ X dgif_lib.c \ X gif_err.c \ X gifalloc.c \ X- compress.c \ X- deflate.c \ X- gzio.c \ X- infblock.c \ X- infcodes.c \ X- inffast.c \ X- inflate.c \ X- inftrees.c \ X- infutil.c \ X- trees.c \ X- uncompr.c \ X- zadler32.c \ X- zcrc32.c \ X- zutil.c \ X jcomapi.c \ X jdapimin.c \ X jdapistd.c \ X@@ -108,3 +94,20 @@ FILES_c = \ X jfdctfst.c \ X jfdctint.c X X+ifneq ($(SYSTEM_ZLIB),true) X+ FILES_c += \ X+ compress.c \ X+ deflate.c \ X+ gzio.c \ X+ infblock.c \ X+ infcodes.c \ X+ inffast.c \ X+ inflate.c \ X+ inftrees.c \ X+ infutil.c \ X+ trees.c \ X+ uncompr.c \ X+ zadler32.c \ X+ zcrc32.c \ X+ zutil.c X+endif Xdiff -uNpr ../orig/jdk/make/sun/splashscreen/Makefile ./jdk/make/sun/splashscreen/Makefile X--- ../orig/jdk/make/sun/splashscreen/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/splashscreen/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -61,10 +61,26 @@ JAVALIB= X X CFLAGS += -DSPLASHSCREEN X X+CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen X+CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg X+ifneq ($(SYSTEM_ZLIB),true) X+ CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X+endif X+ X+ X ifneq ($(PLATFORM), windows) X CFLAGS += -DWITH_X11 X- CPPFLAGS += -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions X- OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext $(LIBM) -lpthread X+ ifeq ($(PLATFORM), bsd) X+ CFLAGS += -DPNG_NO_MMX_CODE X+ ICONV_PATH = $(PACKAGE_PATH) X+ CPPFLAGS += -I$(OPENWIN_HOME)/include \ X+ -I$(OPENWIN_HOME)/include/X11/extensions \ X+ -I$(ICONV_PATH)/include X+ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext -L$(ICONV_PATH)/lib -liconv $(LIBM) -pthread X+ else X+ CPPFLAGS += -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions X+ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext $(LIBM) -lpthread X+ endif X else # PLATFORM X CFLAGS += -DWITH_WIN32 X OTHER_LDLIBS += kernel32.lib user32.lib gdi32.lib X@@ -77,14 +93,13 @@ endif # PLATFORM X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/splashscreen X vpath %.c $(SHARE_SRC)/native/$(PKGDIR) X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/giflib X-vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X+ifneq ($(SYSTEM_ZLIB),true) X+ vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X+endif X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/libpng X vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/jpeg X vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen X X-CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen X-CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X- X ifeq ($(PLATFORM), linux) X ifeq ($(ARCH_DATA_MODEL), 64) X # 64-bit gcc has problems compiling MMX instructions. Xdiff -uNpr ../orig/jdk/make/sun/xawt/Makefile ./jdk/make/sun/xawt/Makefile X--- ../orig/jdk/make/sun/xawt/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/sun/xawt/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -53,6 +53,11 @@ LDFLAGS += -lpthread X dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) X endif X X+ifeq ($(PLATFORM), bsd) X+LDFLAGS += -pthread X+dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) X+endif X+ X # Since this library will be living in a subdirectory below the other libraries X # we need to add an extra runpath so that libraries in the upper directory X # are found at runtime. X@@ -86,7 +91,12 @@ vpath %.c $(SHARE_SRC)/native/sun/java X vpath %.c $(PLATFORM_SRC)/native/sun/java2d/opengl X vpath %.c $(PLATFORM_SRC)/native/sun/java2d/x11 X X-OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -ldl \ X+ifeq ($(PLATFORM), bsd) X+LIBDL= X+else X+LIBDL=-ldl X+endif X+OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 $(LIBDL) \ X $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi X X ifeq ($(PLATFORM), solaris) X@@ -94,8 +104,6 @@ CPPFLAGS += -DFUNCPROTO=15 X dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) X endif X X-CPPFLAGS += -I$(CUPS_HEADERS_PATH) X- X CPPFLAGS += -DXAWT -DXAWT_HACK \ X -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders \ X -I$(PLATFORM_SRC)/native/sun/awt \ X@@ -122,9 +130,11 @@ CPPFLAGS += -DXAWT -DXAWT_HACK \ X -I$(SHARE_SRC)/native/sun/awt \ X -I$(PLATFORM_SRC)/native/sun/awt X X+CPPFLAGS += -I$(CUPS_HEADERS_PATH) X+ X ifeq ($(PLATFORM), linux) X # Allows for builds on Debian GNU Linux, X11 is in a different place X- CPPFLAGS += -I/usr/X11R6/include/X11/extensions \ X+ CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \ X -I/usr/include/X11/extensions \ X -I$(MOTIF_DIR)/include \ X -I$(OPENWIN_HOME)/include X@@ -134,6 +144,14 @@ ifeq ($(PLATFORM), solaris) X CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions -I$(MOTIF_DIR)/include X endif X X+ifeq ($(PLATFORM), bsd) X+ CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions -I$(OPENWIN_HOME)/include X+endif X+ X+ifneq ($(PLATFORM), windows) X+ CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" X+endif X+ X ifeq ($(MILESTONE), internal) X CPPFLAGS += -DINTERNAL_BUILD X endif Xdiff -uNpr ../orig/jdk/make/tools/freetypecheck/Makefile ./jdk/make/tools/freetypecheck/Makefile X--- ../orig/jdk/make/tools/freetypecheck/Makefile 2009-04-24 03:33:56.000000000 -0400 X+++ ./jdk/make/tools/freetypecheck/Makefile 2009-05-14 23:41:34.000000000 -0400 X@@ -60,8 +60,12 @@ else X #add runtime lib search path to ensure test will be runnable X ifeq ($(PLATFORM), solaris) X FT_OPTIONS += -R $(FT_LIB) -lfreetype X- else #linux X- FT_OPTIONS += -Wl,-rpath -Wl,$(FT_LIB) -lfreetype X+ else X+ ifeq ($(PLATFORM), bsd) X+ FT_OPTIONS += -lfreetype -lz X+ else # linux X+ FT_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype X+ endif X endif X endif X Xdiff -uNpr ../orig/jdk/src/share/back/commonRef.c ./jdk/src/share/back/commonRef.c X--- ../orig/jdk/src/share/back/commonRef.c 2009-04-24 03:33:57.000000000 -0400 X+++ ./jdk/src/share/back/commonRef.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,6 +23,10 @@ X * have any questions. X */ X X+#if defined(_ALLBSD_SOURCE) X+#include <stdint.h> /* for uintptr_t */ X+#endif X+ X #include "util.h" X #include "commonRef.h" X Xdiff -uNpr ../orig/jdk/src/share/bin/java.c ./jdk/src/share/bin/java.c X--- ../orig/jdk/src/share/bin/java.c 2009-04-24 03:33:57.000000000 -0400 X+++ ./jdk/src/share/bin/java.c 2009-05-14 23:41:34.000000000 -0400 X@@ -104,6 +104,11 @@ static char *progname; X static char *launchername; X jboolean _launcher_debug = JNI_FALSE; X X+#ifdef __APPLE__ X+static jboolean continueInSameThread = JNI_FALSE; /* start VM in current thread */ X+#endif X+ X+ X /* X * Entries for splash screen environment variables. X * putenv is performed in SelectVersion. We need X@@ -146,6 +151,10 @@ static void PrintUsage(JNIEnv* env, jboo X static void SetPaths(int argc, char **argv); X X X+#ifdef __APPLE__ X+static int ContinueInSameThread(InvocationFunctions* ifn, int argc, char **argv, char *jarfile, char *classname, int ret); X+#endif X+ X /* Maximum supported entries from jvm.cfg. */ X #define INIT_MAX_KNOWN_VMS 10 X /* Values for vmdesc.flag */ X@@ -184,13 +193,13 @@ static jlong threadStackSize = 0; /* st X X int JNICALL JavaMain(void * args); /* entry point */ X X-struct JavaMainArgs { X+typedef struct { X int argc; X char ** argv; X char * jarfile; X char * classname; X InvocationFunctions ifn; X-}; X+} JavaMainArgs; X X /* X * Entry point. X@@ -332,49 +341,24 @@ main(int argc, char ** argv) X /* Show the splash screen if needed */ X ShowSplashScreen(); X X- /* X- * Done with all command line processing and potential re-execs so X- * clean up the environment. X- */ X- (void)UnsetEnv(ENV_ENTRY); X- (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY); X- (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY); X- X- JLI_MemFree(splash_jar_entry); X- JLI_MemFree(splash_file_entry); X X- /* X- * If user doesn't specify stack size, check if VM has a preference. X- * Note that HotSpot no longer supports JNI_VERSION_1_1 but it will X- * return its default stack size through the init args structure. X- */ X- if (threadStackSize == 0) { X- struct JDK1_1InitArgs args1_1; X- memset((void*)&args1_1, 0, sizeof(args1_1)); X- args1_1.version = JNI_VERSION_1_1; X- ifn.GetDefaultJavaVMInitArgs(&args1_1); /* ignore return value */ X- if (args1_1.javaStackSize > 0) { X- threadStackSize = args1_1.javaStackSize; X+#ifdef __APPLE__ X+ if (continueInSameThread == JNI_TRUE) { X+ return ContinueInSameThread(&ifn, argc, argv, jarfile, classname, ret); X+ } else { X+ return ContinueInNewThread(&ifn, argc, argv, jarfile, classname, ret); X } X- } X- X- { /* Create a new thread to create JVM and invoke main method */ X- struct JavaMainArgs args; X+#else X X- args.argc = argc; X- args.argv = argv; X- args.jarfile = jarfile; X- args.classname = classname; X- args.ifn = ifn; X+ return ContinueInNewThread(&ifn, argc, argv, jarfile, classname, ret); X+#endif X X- return ContinueInNewThread(JavaMain, threadStackSize, (void*)&args, ret); X- } X } X X int JNICALL X JavaMain(void * _args) X { X- struct JavaMainArgs *args = (struct JavaMainArgs *)_args; X+ JavaMainArgs *args = (JavaMainArgs *)_args; X int argc = args->argc; X char **argv = args->argv; X char *jarfile = args->jarfile; X@@ -1159,6 +1143,10 @@ ParseArguments(int *pargc, char ***pargv X } else if (strcmp(arg, "-X") == 0) { X printXUsage = JNI_TRUE; X return JNI_TRUE; X+#ifdef __APPLE__ X+ } else if (JLI_StrCmp(arg, "-XstartOnFirstThread") == 0) { X+ continueInSameThread = JNI_TRUE; X+#endif X /* X * The following case provide backward compatibility with old-style X * command line options. X@@ -1979,6 +1967,84 @@ KnownVMIndex(const char* name) X return -1; X } X X+static int X+ContinueInNewThread(InvocationFunctions* ifn, int argc, X+ char **argv, char *jarfile, char *classname, int ret) X+{ X+ X+ /* X+ * If user doesn't specify stack size, check if VM has a preference. X+ * Note that HotSpot no longer supports JNI_VERSION_1_1 but it will X+ * return its default stack size through the init args structure. X+ */ X+ if (threadStackSize == 0) { X+ struct JDK1_1InitArgs args1_1; X+ memset((void*)&args1_1, 0, sizeof(args1_1)); X+ args1_1.version = JNI_VERSION_1_1; X+ ifn->GetDefaultJavaVMInitArgs(&args1_1); /* ignore return value */ X+ if (args1_1.javaStackSize > 0) { X+ threadStackSize = args1_1.javaStackSize; X+ } X+ } X+ X+ { /* Create a new thread to create JVM and invoke main method */ X+ JavaMainArgs args; X+ int rslt; X+ X+ args.argc = argc; X+ args.argv = argv; X+ args.jarfile = jarfile; X+ args.classname = classname; X+ args.ifn = *ifn; X+ X+ rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args); X+ /* If the caller has deemed there is an error we X+ * simply return that, otherwise we return the value of X+ * the callee X+ */ X+ return (ret != 0) ? ret : rslt; X+ } X+} X+ X+ X+#ifdef __APPLE__ X+static int X+ContinueInSameThread(InvocationFunctions* ifn, int argc, X+ char **argv, char *jarfile, char *classname, int ret) X+{ X+ X+ /* X+ * If user doesn't specify stack size, check if VM has a preference. X+ * Note that HotSpot no longer supports JNI_VERSION_1_1 but it will X+ * return its default stack size through the init args structure. X+ */ X+ if (threadStackSize == 0) { X+ struct JDK1_1InitArgs args1_1; X+ memset((void*)&args1_1, 0, sizeof(args1_1)); X+ args1_1.version = JNI_VERSION_1_1; X+ ifn->GetDefaultJavaVMInitArgs(&args1_1); /* ignore return value */ X+ if (args1_1.javaStackSize > 0) { X+ threadStackSize = args1_1.javaStackSize; X+ } X+ } X+ X+ { /* Create create JVM and invoke main method */ X+ JavaMainArgs args; X+ int rslt; X+ X+ args.argc = argc; X+ args.argv = argv; X+ args.jarfile = jarfile; X+ args.classname = classname; X+ args.ifn = *ifn; X+ X+ rslt = JavaMain((void*)&args); X+ X+ return (ret != 0) ? ret : rslt; X+ } X+} X+#endif X+ X static void X FreeKnownVMs() X { Xdiff -uNpr ../orig/jdk/src/share/bin/java.h ./jdk/src/share/bin/java.h X--- ../orig/jdk/src/share/bin/java.h 2009-04-24 03:33:57.000000000 -0400 X+++ ./jdk/src/share/bin/java.h 2009-05-14 23:41:34.000000000 -0400 X@@ -91,11 +91,17 @@ jboolean RemovableMachineDependentOption X void PrintMachineDependentOptions(); X X const char *jlong_format_specifier(); X+ X /* X * Block current thread and continue execution in new thread X */ X-int ContinueInNewThread(int (JNICALL *continuation)(void *), X- jlong stack_size, void * args, int ret); X+int ContinueInNewThread0(int (JNICALL *continuation)(void *), X+ jlong stack_size, void * args); X+ X+ X+ static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv, X+ char* jarfile, char* classname, int ret); X+ X X /* sun.java.launcher.* platform properties. */ X void SetJavaLauncherPlatformProps(void); Xdiff -uNpr ../orig/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java ./jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java X--- ../orig/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java 2009-04-24 03:33:58.000000000 -0400 X+++ ./jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java 2009-05-14 23:41:34.000000000 -0400 X@@ -477,6 +477,10 @@ class Metacity implements SynthConstants X String[] dirs = new String[] { X userHome + sep + ".themes", X System.getProperty("swing.metacitythemedir"), X+ "/usr/X11R6/share/themes", X+ "/usr/X11R6/share/gnome/themes", X+ "/usr/local/share/themes", X+ "/usr/local/share/gnome/themes", X "/usr/share/themes", X "/usr/gnome/share/themes", // Debian/Redhat/Solaris X "/opt/gnome2/share/themes" // SuSE Xdiff -uNpr ../orig/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java ./jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java X--- ../orig/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java 2009-04-24 03:34:00.000000000 -0400 X+++ ./jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java 2009-05-14 23:41:34.000000000 -0400 X@@ -78,6 +78,9 @@ public class SnmpPduTrap extends SnmpPdu X */ X public long timeStamp ; X X+ // TODO: IcedTea: I am a stub. X+ static public int trapAuthenticationFailure = 0; X+ X X X /** Xdiff -uNpr ../orig/jdk/src/share/classes/java/awt/GraphicsEnvironment.java ./jdk/src/share/classes/java/awt/GraphicsEnvironment.java X--- ../orig/jdk/src/share/classes/java/awt/GraphicsEnvironment.java 2009-04-24 03:34:04.000000000 -0400 X+++ ./jdk/src/share/classes/java/awt/GraphicsEnvironment.java 2009-05-14 23:41:34.000000000 -0400 X@@ -148,7 +148,12 @@ public abstract class GraphicsEnvironmen X } else { X String osName = System.getProperty("os.name"); X headless = defaultHeadless = X- Boolean.valueOf(("Linux".equals(osName) || "SunOS".equals(osName)) && X+ Boolean.valueOf(("Linux".equals(osName) || X+ "SunOS".equals(osName) || X+ "FreeBSD".equals(osName) || X+ "NetBSD".equals(osName) || X+ "OpenBSD".equals(osName) || X+ "Darwin".equals(osName)) && X (System.getenv("DISPLAY") == null)); X } X } else if (nm.equals("true")) { Xdiff -uNpr ../orig/jdk/src/share/classes/java/util/TimeZone.java ./jdk/src/share/classes/java/util/TimeZone.java X--- ../orig/jdk/src/share/classes/java/util/TimeZone.java 2009-04-24 03:34:08.000000000 -0400 X+++ ./jdk/src/share/classes/java/util/TimeZone.java 2009-05-14 23:41:34.000000000 -0400 X@@ -779,15 +779,13 @@ abstract public class TimeZone implement X } X int gmtOffset = (hours * 60 + num) * 60 * 1000; X X+ zi = ZoneInfoFile.getCustomTimeZone(id, negative ? -gmtOffset : gmtOffset); X if (gmtOffset == 0) { X- zi = ZoneInfoFile.getZoneInfo(GMT_ID); X if (negative) { X zi.setID("GMT-00:00"); X } else { X zi.setID("GMT+00:00"); X } X- } else { X- zi = ZoneInfoFile.getCustomTimeZone(id, negative ? -gmtOffset : gmtOffset); X } X return zi; X } Xdiff -uNpr ../orig/jdk/src/share/classes/sun/awt/FontConfiguration.java ./jdk/src/share/classes/sun/awt/FontConfiguration.java X--- ../orig/jdk/src/share/classes/sun/awt/FontConfiguration.java 2009-04-24 03:34:16.000000000 -0400 X+++ ./jdk/src/share/classes/sun/awt/FontConfiguration.java 2009-05-14 23:41:34.000000000 -0400 X@@ -1073,7 +1073,7 @@ public abstract class FontConfiguration X */ X HashMap<String, Boolean> existsMap; X public boolean needToSearchForFile(String fileName) { X- if (!environment.isLinux) { X+ if (!environment.isLinuxOrBSD) { X return false; X } else if (existsMap == null) { X existsMap = new HashMap<String, Boolean>(); X@@ -1309,7 +1309,7 @@ public abstract class FontConfiguration X + "<filename." X + getString(table_componentFontNameIDs[ii]) X + "> entry is missing!!!"); X- if (!osName.contains("Linux")) { X+ if (!osName.contains("Linux") && !osName.contains("BSD") && !osName.contains("Darwin")) { X errors++; X } X } Xdiff -uNpr ../orig/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java ./jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java X--- ../orig/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java 2009-04-24 03:34:17.000000000 -0400 X+++ ./jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java 2009-05-14 23:41:34.000000000 -0400 X@@ -76,7 +76,7 @@ import sun.font.NativeFont; X public abstract class SunGraphicsEnvironment extends GraphicsEnvironment X implements FontSupport, DisplayChangedListener { X X- public static boolean isLinux; X+ public static boolean isLinuxOrBSD; X public static boolean isSolaris; X public static boolean isWindows; X public static boolean noType1Font; X@@ -164,7 +164,15 @@ public abstract class SunGraphicsEnviron X public Object run() { X String osName = System.getProperty("os.name"); X if ("Linux".equals(osName)) { X- isLinux = true; X+ isLinuxOrBSD = true; X+ } else if ("FreeBSD".equals(osName)) { X+ isLinuxOrBSD = true; X+ } else if ("Darwin".equals(osName)) { X+ isLinuxOrBSD = true; X+ } else if ("NetBSD".equals(osName)) { X+ isLinuxOrBSD = true; X+ } else if ("OpenBSD".equals(osName)) { X+ isLinuxOrBSD = true; X } else if ("SunOS".equals(osName)) { X isSolaris = true; X } else if ("Windows".equals(osName)) { X@@ -227,8 +235,8 @@ public abstract class SunGraphicsEnviron X * Pass "true" to registerFonts method as on-screen these X * JRE fonts always go through the T2K rasteriser. X */ X- if (isLinux) { X- /* Linux font configuration uses these fonts */ X+ if (isLinuxOrBSD) { X+ /* Linux/BSD font configuration uses these fonts */ X registerFontDir(jreFontDirName); X } X registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK, Xdiff -uNpr ../orig/jdk/src/share/classes/sun/print/PSPrinterJob.java ./jdk/src/share/classes/sun/print/PSPrinterJob.java X--- ../orig/jdk/src/share/classes/sun/print/PSPrinterJob.java 2009-04-24 03:34:21.000000000 -0400 X+++ ./jdk/src/share/classes/sun/print/PSPrinterJob.java 2009-05-14 23:41:34.000000000 -0400 X@@ -1531,7 +1531,9 @@ public class PSPrinterJob extends Raster X pFlags |= NOSHEET; X ncomps+=1; X } X- if (System.getProperty("os.name").equals("Linux")) { X+ X+ String osname = System.getProperty("os.name"); X+ if (osname.equals("Linux") || osname.equals("FreeBSD") || osname.equals("NetBSD") || osname.equals("OpenBSD") || osname.equals("Darwin")) { X execCmd = new String[ncomps]; X execCmd[n++] = "/usr/bin/lpr"; X if ((pFlags & PRINTER) != 0) { Xdiff -uNpr ../orig/jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider ./jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider X--- ../orig/jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider 2009-04-24 03:34:25.000000000 -0400 X+++ ./jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider 2009-05-14 23:41:34.000000000 -0400 X@@ -30,3 +30,4 @@ X #[solaris]sun.tools.attach.SolarisAttachProvider X #[windows]sun.tools.attach.WindowsAttachProvider X #[linux]sun.tools.attach.LinuxAttachProvider X+#[bsd]sun.tools.attach.BsdAttachProvider Xdiff -uNpr ../orig/jdk/src/share/classes/sun/tools/jar/Main.java ./jdk/src/share/classes/sun/tools/jar/Main.java X--- ../orig/jdk/src/share/classes/sun/tools/jar/Main.java 2009-04-24 03:34:25.000000000 -0400 X+++ ./jdk/src/share/classes/sun/tools/jar/Main.java 2009-05-14 23:41:34.000000000 -0400 X@@ -46,6 +46,7 @@ class Main { X String zname = ""; X String[] files; X String rootjar = null; X+ String cwd; X Hashtable filesTable = new Hashtable(); X Vector paths = new Vector(); X Vector v; X@@ -770,6 +771,19 @@ class Main { X * Extracts specified entries from JAR file. X */ X void extract(InputStream in, String files[]) throws IOException { X+ // Current working directory X+ X+ cwd = System.getProperty("user.dir"); X+ if (cwd == null) { X+ fatalError(getMsg("error.no.cwd")); X+ } X+ cwd = (new File(cwd)).getCanonicalPath(); X+ if (!cwd.endsWith(File.separator)) { X+ cwd += File.separator; X+ } X+ X+ // Extract the files X+ X ZipInputStream zis = new ZipInputStream(in); X ZipEntry e; X // Set of all directory entries specified in archive. Dissallows X@@ -817,6 +831,10 @@ class Main { X ZipEntry rc = null; X String name = e.getName(); X File f = new File(e.getName().replace('/', File.separatorChar)); X+ if (!f.getCanonicalPath().startsWith(cwd)) { X+ output(formatMsg("out.ignore.entry", name)); X+ return null; X+ } X if (e.isDirectory()) { X if (f.exists()) { X if (!f.isDirectory()) { X@@ -838,6 +856,10 @@ class Main { X } else { X if (f.getParent() != null) { X File d = new File(f.getParent()); X+ if (!d.getCanonicalPath().startsWith(cwd)) { X+ output(formatMsg("out.ignore.entry", name)); X+ return null; X+ } X if (!d.exists() && !d.mkdirs() || !d.isDirectory()) { X throw new IOException(formatMsg( X "error.create.dir", d.getPath())); Xdiff -uNpr ../orig/jdk/src/share/classes/sun/tools/jar/resources/jar.properties ./jdk/src/share/classes/sun/tools/jar/resources/jar.properties X--- ../orig/jdk/src/share/classes/sun/tools/jar/resources/jar.properties 2009-04-24 03:34:25.000000000 -0400 X+++ ./jdk/src/share/classes/sun/tools/jar/resources/jar.properties 2009-05-14 23:41:34.000000000 -0400 X@@ -44,6 +44,8 @@ error.create.dir=\ X {0} : could not create directory X error.incorrect.length=\ X incorrect length while processing: {0} X+error.no.cwd=\ X+ {0} : could not determine current working directory X out.added.manifest=\ X added manifest X out.update.manifest=\ Xdiff -uNpr ../orig/jdk/src/share/hpi/include/hpi_impl.h ./jdk/src/share/hpi/include/hpi_impl.h X--- ../orig/jdk/src/share/hpi/include/hpi_impl.h 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/hpi/include/hpi_impl.h 2009-05-14 23:41:34.000000000 -0400 X@@ -138,7 +138,11 @@ int sysConnect(int fd, struct sockaddr * X int sysBind(int fd, struct sockaddr *him, int len); X int sysAccept(int fd, struct sockaddr *him, int *len); X int sysGetSockName(int fd, struct sockaddr *him, int *len); X-#ifdef _LP64 X+#if defined(_LP64) || defined(_ALLBSD_SOURCE) X+// XXXBSD: The implementations all use ssize_t, except on Windows, X+// regardless of _LP64. The resulting mismatch between "int" and "ssize_t" X+// causes gcc on Darwin to report a conflicting types error. X+// Appears to be an upstream issue introduced in 1.7 X ssize_t sysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to, X int tolen); X ssize_t sysRecvFrom(int fd, char *buf, int nbytes, int flags, Xdiff -uNpr ../orig/jdk/src/share/lib/security/java.security-openbsd ./jdk/src/share/lib/security/java.security-openbsd X--- ../orig/jdk/src/share/lib/security/java.security-openbsd 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/share/lib/security/java.security-openbsd 2009-05-14 23:41:34.000000000 -0400 X@@ -66,7 +66,14 @@ security.provider.8=sun.security.smartca X # On Windows systems, the URLs file:/dev/random and file:/dev/urandom X # enables use of the Microsoft CryptoAPI seed functionality. X # X-securerandom.source=file:/dev/urandom X+# On OpenBSD use file:///dev/srandom for strong but blocking random X+# generator, file:/dev/random for hardware random generators, X+# file:///dev/arandom for non-blocking high-quality pseudo-random X+# data and file:///dev/urandom for non-blocking random data that X+# does not guarantee the data to be strong. See random(4) for more X+# info. X+# X+securerandom.source=file:///dev/arandom X # X # The entropy gathering device is described as a URL and can also X # be specified with the system property "java.security.egd". For example, Xdiff -uNpr ../orig/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h ./jdk/src/share/native/com/sun/java/util/jar/pack/defines.h X--- ../orig/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2009-05-14 23:41:34.000000000 -0400 X@@ -32,6 +32,10 @@ X #include <unistd.h> X #endif X X+#ifndef NO_ZLIB X+# include <zconf.h> X+#endif X+ X #ifndef FULL X #define FULL 1 /* Adds <500 bytes to the zipped final product. */ X #endif X@@ -89,11 +93,13 @@ extern void assert_failed(const char*); X // bytes and byte arrays X X typedef unsigned int uint; X+#ifdef NO_ZLIB X #ifdef _LP64 X typedef unsigned int uLong; // Historical zlib, should be 32-bit. X #else X typedef unsigned long uLong; X #endif X+#endif X #ifdef _MSC_VER X typedef LONGLONG jlong; X typedef DWORDLONG julong; Xdiff -uNpr ../orig/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp ./jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp X--- ../orig/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp 2009-05-14 23:41:34.000000000 -0400 X@@ -33,9 +33,14 @@ X #include <limits.h> X #include <time.h> X X+/* !PRODUCT needs intptr_t */ X+#if defined(_ALLBSD_SOURCE) && !defined(PRODUCT) X+#include <stdint.h> X+#endif X+ X #if defined(unix) && !defined(PRODUCT) X #include "pthread.h" X-#define THREAD_SELF ((int)pthread_self()) X+#define THREAD_SELF ((intptr_t) pthread_self()) X #endif X X #include "defines.h" X@@ -58,9 +63,9 @@ int main(int argc, char **argv) { X // Single-threaded, implementation, not reentrant. X // Includes a weak error check against MT access. X #ifndef THREAD_SELF X-#define THREAD_SELF (0) X+#define THREAD_SELF ((intptr_t) 0) X #endif X-NOT_PRODUCT(static int uThread = -1;) X+NOT_PRODUCT(static intptr_t uThread = -1;) X X unpacker* unpacker::non_mt_current = null; X unpacker* unpacker::current() { X@@ -69,7 +74,7 @@ unpacker* unpacker::current() { X } X static void set_current_unpacker(unpacker* u) { X unpacker::non_mt_current = u; X- assert(((uThread = (u == null) ? -1 : THREAD_SELF), X+ assert(((uThread = (u == null) ? ((intptr_t) -1) : THREAD_SELF), X true)); X } X Xdiff -uNpr ../orig/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c ./jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c X--- ../orig/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c 2009-05-14 23:41:34.000000000 -0400 X@@ -33,7 +33,11 @@ X X #include <jni.h> X // for malloc X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X #include "SoundDefs.h" X #include "DirectAudio.h" X #include "Utilities.h" Xdiff -uNpr ../orig/jdk/src/share/native/com/sun/media/sound/Platform.c ./jdk/src/share/native/com/sun/media/sound/Platform.c X--- ../orig/jdk/src/share/native/com/sun/media/sound/Platform.c 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/com/sun/media/sound/Platform.c 2009-05-14 23:41:34.000000000 -0400 X@@ -99,5 +99,17 @@ JNIEXPORT jint JNICALL Java_com_sun_medi X return com_sun_media_sound_Platform_LIB_ALSA; X } X #endif X+#if (X_PLATFORM == X_BSD) X+ switch (feature) { X+ case com_sun_media_sound_Platform_FEATURE_MIDIIO: X+ return com_sun_media_sound_Platform_LIB_MAIN; X+ case com_sun_media_sound_Platform_FEATURE_PORTS: X+ return com_sun_media_sound_Platform_LIB_MAIN; X+ case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: X+ // XXXBSD: When native Direct Audio support is ported change X+ // this back to returning com_sun_media_sound_Platform_LIB_MAIN X+ return 0; X+ } X+#endif X return 0; X } Xdiff -uNpr ../orig/jdk/src/share/native/com/sun/media/sound/SoundDefs.h ./jdk/src/share/native/com/sun/media/sound/SoundDefs.h X--- ../orig/jdk/src/share/native/com/sun/media/sound/SoundDefs.h 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/com/sun/media/sound/SoundDefs.h 2009-05-14 23:41:34.000000000 -0400 X@@ -31,6 +31,7 @@ X #define X_WINDOWS 1 X #define X_SOLARIS 2 X #define X_LINUX 3 X+#define X_BSD 4 X X // types for X_ARCH X #define X_I586 1 X@@ -49,7 +50,7 @@ X X X // following is needed for _LP64 X-#if ((X_PLATFORM == X_SOLARIS) || (X_PLATFORM == X_LINUX)) X+#if ((X_PLATFORM == X_SOLARIS) || (X_PLATFORM == X_LINUX) || (X_PLATFORM == X_BSD)) X #include <sys/types.h> X #endif X X@@ -129,4 +130,9 @@ typedef char SBYTE; X #endif X X X+#if X_PLATFORM == X_BSD X+#define INLINE inline X+#endif X+ X+ X #endif // __SOUNDDEFS_INCLUDED__ Xdiff -uNpr ../orig/jdk/src/share/native/common/check_code.c ./jdk/src/share/native/common/check_code.c X--- ../orig/jdk/src/share/native/common/check_code.c 2009-04-24 03:34:28.000000000 -0400 X+++ ./jdk/src/share/native/common/check_code.c 2009-05-14 23:41:34.000000000 -0400 X@@ -1069,7 +1069,7 @@ verify_method(context_type *context, jcl X * Make sure that branches don't go into the middle of nowhere. X */ X X-static jint ntohl(jint n) X+static jint _ck_ntohl(jint n) X { X unsigned char *p = (unsigned char *)&n; X return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; X@@ -1148,26 +1148,26 @@ verify_opcode_operands(context_type *con X } X } X if (opcode == opc_tableswitch) { X- keys = ntohl(lpc[2]) - ntohl(lpc[1]) + 1; X+ keys = _ck_ntohl(lpc[2]) - _ck_ntohl(lpc[1]) + 1; X delta = 1; X } else { X- keys = ntohl(lpc[1]); /* number of pairs */ X+ keys = _ck_ntohl(lpc[1]); /* number of pairs */ X delta = 2; X /* Make sure that the tableswitch items are sorted */ X for (k = keys - 1, lptr = &lpc[2]; --k >= 0; lptr += 2) { X- int this_key = ntohl(lptr[0]); /* NB: ntohl may be unsigned */ X- int next_key = ntohl(lptr[2]); X+ int this_key = _ck_ntohl(lptr[0]); /* NB: ntohl may be unsigned */ X+ int next_key = _ck_ntohl(lptr[2]); X if (this_key >= next_key) { X CCerror(context, "Unsorted lookup switch"); X } X } X } X saved_operand = NEW(int, keys + 2); X- if (!isLegalTarget(context, offset + ntohl(lpc[0]))) X+ if (!isLegalTarget(context, offset + _ck_ntohl(lpc[0]))) X CCerror(context, "Illegal default target in switch"); X- saved_operand[keys + 1] = code_data[offset + ntohl(lpc[0])]; X+ saved_operand[keys + 1] = code_data[offset + _ck_ntohl(lpc[0])]; X for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) { X- int target = offset + ntohl(lptr[0]); X+ int target = offset + _ck_ntohl(lptr[0]); X if (!isLegalTarget(context, target)) X CCerror(context, "Illegal branch in opc_tableswitch"); X saved_operand[k + 1] = code_data[target]; X@@ -1615,7 +1615,7 @@ static int instruction_length(unsigned c X if (lpc + 2 >= (int *)end) { X return -1; /* do not read pass the end */ X } X- index = ntohl(lpc[2]) - ntohl(lpc[1]); X+ index = _ck_ntohl(lpc[2]) - _ck_ntohl(lpc[1]); X if ((index < 0) || (index > 65535)) { X return -1; /* illegal */ X } else { X@@ -1628,7 +1628,7 @@ static int instruction_length(unsigned c X int npairs; X if (lpc + 1 >= (int *)end) X return -1; /* do not read pass the end */ X- npairs = ntohl(lpc[1]); X+ npairs = _ck_ntohl(lpc[1]); X /* There can't be more than 64K labels because of the limit X * on per-method byte code length. X */ Xdiff -uNpr ../orig/jdk/src/share/native/java/io/io_util.h ./jdk/src/share/native/java/io/io_util.h X--- ../orig/jdk/src/share/native/java/io/io_util.h 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/java/io/io_util.h 2009-05-14 23:41:34.000000000 -0400 X@@ -29,7 +29,15 @@ X extern jfieldID IO_fd_fdID; X extern jfieldID IO_handle_fdID; X X-#if !defined(O_DSYNC) || !defined(O_SYNC) X+#ifdef _ALLBSD_SOURCE X+#include <fcntl.h> X+#ifndef O_SYNC X+#define O_SYNC O_FSYNC X+#endif X+#ifndef O_DSYNC X+#define O_DSYNC O_FSYNC X+#endif X+#elif !defined(O_DSYNC) || !defined(O_SYNC) X #define O_SYNC (0x0800) X #define O_DSYNC (0x2000) X #endif Xdiff -uNpr ../orig/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h ./jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h X--- ../orig/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2009-05-14 23:41:34.000000000 -0400 X@@ -25,6 +25,10 @@ X * have any questions. X */ X X+#ifdef __OpenBSD__ X+#include <sys/types.h> X+#endif X+#include <machine/endian.h> X #include "jfdlibm.h" X X #ifdef __NEWVALID /* special setup for Sun test regime */ X@@ -47,11 +51,13 @@ X #define __LOp(x) *(1+(int*)x) X #endif X X+#ifndef __P X #ifdef __STDC__ X #define __P(p) p X #else X #define __P(p) () X #endif X+#endif X X /* X * ANSI/POSIX Xdiff -uNpr ../orig/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h ./jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h X--- ../orig/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h 2009-05-14 23:41:34.000000000 -0400 X@@ -61,7 +61,7 @@ X #define log1p jlog1p X #define expm1 jexpm1 X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #define __ieee754_sqrt __j__ieee754_sqrt X #define __ieee754_acos __j__ieee754_acos X #define __ieee754_acosh __j__ieee754_acosh Xdiff -uNpr ../orig/jdk/src/share/native/java/util/zip/Inflater.c ./jdk/src/share/native/java/util/zip/Inflater.c X--- ../orig/jdk/src/share/native/java/util/zip/Inflater.c 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/java/util/zip/Inflater.c 2009-05-14 23:41:34.000000000 -0400 X@@ -67,6 +67,10 @@ Java_java_util_zip_Inflater_init(JNIEnv X return jlong_zero; X } else { X char *msg; X+// BSDXXX needed for FreeBSD 5.4 and below with system zlib X+#if defined(__FreeBSD__) && __FreeBSD__ < 6 X+ strm->adler = 1; X+#endif X switch (inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS)) { X case Z_OK: X return ptr_to_jlong(strm); X@@ -202,6 +206,10 @@ Java_java_util_zip_Inflater_reset(JNIEnv X if (inflateReset(jlong_to_ptr(strm)) != Z_OK) { X JNU_ThrowInternalError(env, 0); X } X+// BSDXXX needed for FreeBSD 5.4 and below with system zlib X+#if defined(__FreeBSD__) && __FreeBSD__ < 6 X+ ((z_stream *)jlong_to_ptr(strm))->adler = 1; X+#endif X } X X JNIEXPORT void JNICALL Xdiff -uNpr ../orig/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h ./jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h X--- ../orig/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h 2009-05-14 23:41:34.000000000 -0400 X@@ -42,44 +42,49 @@ X /* for _LP64 */ X #include <sys/types.h> X X+/** X+ * Privatise the symbols to the JDK. X+ */ X+#define Z_PREFIX X+ X /* X * If you *really* need a unique prefix for all types and library functions, X * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. X */ X #ifdef Z_PREFIX X-# define deflateInit_ z_deflateInit_ X-# define deflate z_deflate X-# define deflateEnd z_deflateEnd X-# define inflateInit_ z_inflateInit_ X-# define inflate z_inflate X-# define inflateEnd z_inflateEnd X-# define deflateInit2_ z_deflateInit2_ X-# define deflateSetDictionary z_deflateSetDictionary X-# define deflateCopy z_deflateCopy X-# define deflateReset z_deflateReset X-# define deflateParams z_deflateParams X-# define inflateInit2_ z_inflateInit2_ X-# define inflateSetDictionary z_inflateSetDictionary X-# define inflateSync z_inflateSync X-# define inflateSyncPoint z_inflateSyncPoint X-# define inflateReset z_inflateReset X-# define compress z_compress X-# define compress2 z_compress2 X-# define uncompress z_uncompress X-# define adler32 z_adler32 X-# define crc32 z_crc32 X-# define get_crc_table z_get_crc_table X- X-# define Byte z_Byte X-# define uInt z_uInt X-# define uLong z_uLong X-# define Bytef z_Bytef X-# define charf z_charf X-# define intf z_intf X-# define uIntf z_uIntf X-# define uLongf z_uLongf X-# define voidpf z_voidpf X-# define voidp z_voidp X+# define deflateInit_ _java_z_deflateInit_ X+# define deflate _java_z_deflate X+# define deflateEnd _java_z_deflateEnd X+# define inflateInit_ _java_z_inflateInit_ X+# define inflate _java_z_inflate X+# define inflateEnd _java_z_inflateEnd X+# define deflateInit2_ _java_z_deflateInit2_ X+# define deflateSetDictionary _java_z_deflateSetDictionary X+# define deflateCopy _java_z_deflateCopy X+# define deflateReset _java_z_deflateReset X+# define deflateParams _java_z_deflateParams X+# define inflateInit2_ _java_z_inflateInit2_ X+# define inflateSetDictionary _java_z_inflateSetDictionary X+# define inflateSync _java_z_inflateSync X+# define inflateSyncPoint _java_z_inflateSyncPoint X+# define inflateReset _java_z_inflateReset X+# define compress _java_z_compress X+# define compress2 _java_z_compress2 X+# define uncompress _java_z_uncompress X+# define adler32 _java_z_adler32 X+# define crc32 _java_z_crc32 X+# define get_crc_table _java_z_get_crc_table X+ X+# define Byte _java_z_Byte X+# define uInt _java_z_uInt X+# define uLong _java_z_uLong X+# define Bytef _java_z_Bytef X+# define charf _java_z_charf X+# define intf _java_z_intf X+# define uIntf _java_z_uIntf X+# define uLongf _java_z_uLongf X+# define voidpf _java_z_voidpf X+# define voidp _java_z_voidp X #endif X X #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/debug/debug_util.h ./jdk/src/share/native/sun/awt/debug/debug_util.h X--- ../orig/jdk/src/share/native/sun/awt/debug/debug_util.h 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/debug/debug_util.h 2009-05-14 23:41:34.000000000 -0400 X@@ -50,7 +50,9 @@ typedef void * dmutex_t; X #include <stdio.h> X #include <string.h> X #include <assert.h> X+#if !defined(_ALLBSD_SOURCE) X #include <malloc.h> X+#endif X #include <limits.h> X X /* keep these after the other headers */ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c ./jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c X--- ../orig/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c 2009-05-14 23:41:34.000000000 -0400 X@@ -24,7 +24,11 @@ X */ X X #include "BufImgSurfaceData.h" X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include "malloc.h" X+#endif X X #include "sun_awt_image_BufImgSurfaceData.h" X Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/image/DataBufferNative.c ./jdk/src/share/native/sun/awt/image/DataBufferNative.c X--- ../orig/jdk/src/share/native/sun/awt/image/DataBufferNative.c 2009-04-24 03:34:29.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/image/DataBufferNative.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,7 +23,11 @@ X * have any questions. X */ X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include "malloc.h" X+#endif X X #include "SurfaceData.h" X #include "sun_awt_image_DataBufferNative.h" Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c 2009-05-14 23:41:34.000000000 -0400 X@@ -86,7 +86,7 @@ typedef struct { X #endif /* MLIB_USE_FTOI_CLAMPING */ X X /***************************************************************/ X-#if defined(_LITTLE_ENDIAN) && !defined(_NO_LONGLONG) X+#if (BYTE_ORDER == LITTLE_ENDIAN) && !defined(_NO_LONGLONG) X X /* NB: Explicit cast to DTYPE is necessary to avoid warning from Microsoft VC compiler. X And we need to explicitly define cast behavior if source exceeds destination range. X@@ -103,7 +103,7 @@ typedef struct { X dp[0 ] = (DTYPE) ((res0) & DTYPE_MASK); \ X dp[chan1] = (DTYPE) ((res1) & DTYPE_MASK) X X-#endif /* defined(_LITTLE_ENDIAN) && !defined(_NO_LONGLONG) */ X+#endif /* (BYTE_ORDER == LITTLE_ENDIAN) && !defined(_NO_LONGLONG) */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -114,17 +114,17 @@ typedef struct { X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | ((mlib_s64)sp[0] & 0xffffffff) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | ((mlib_s64)sp[chan1] & 0xffffffff) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X #endif /* _NO_LONGLONG */ X Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c 2009-05-14 23:41:34.000000000 -0400 X@@ -126,7 +126,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -138,7 +138,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -149,17 +149,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c 2009-05-14 23:41:34.000000000 -0400 X@@ -94,7 +94,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -106,7 +106,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -117,17 +117,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c 2009-05-14 23:41:34.000000000 -0400 X@@ -126,7 +126,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -138,7 +138,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -149,17 +149,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c 2009-05-14 23:41:34.000000000 -0400 X@@ -95,7 +95,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -107,7 +107,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -118,17 +118,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c 2009-05-14 23:41:34.000000000 -0400 X@@ -126,7 +126,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -138,7 +138,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -149,17 +149,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c 2009-05-14 23:41:34.000000000 -0400 X@@ -94,7 +94,7 @@ X #define D2I(x) CLAMP_S32((x) SAT_OFF) X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define STORE2(res0, res1) \ X dp[0 ] = res1; \ X@@ -106,7 +106,7 @@ X dp[0 ] = res0; \ X dp[chan1] = res1 X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X #ifdef _NO_LONGLONG X@@ -117,17 +117,17 @@ X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[chan1]) << 32) | S64TOS32((mlib_s64)sp[0]) X X-#else /* _LITTLE_ENDIAN */ X+#else X X #define LOAD_BUFF(buff) \ X *(mlib_s64*)(buff + i) = (((mlib_s64)sp[0]) << 32) | S64TOS32((mlib_s64)sp[chan1]) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #endif /* _NO_LONGLONG */ X X /***************************************************************/ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c 2009-05-14 23:41:34.000000000 -0400 X@@ -95,7 +95,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X dst = dp[0]; X if (ld_offset + size < 32) { X dmask = (mask0 << (32 - size)) >> ld_offset; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src = (src0 >> (ld_offset - ls_offset)); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -104,12 +104,12 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X #else X src = (src0 >> (ld_offset - ls_offset)); X dp[0] = (dst & (~dmask)) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X return; X } X X dmask = mask0 >> ld_offset; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src = (src0 >> (ld_offset - ls_offset)); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -118,7 +118,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X #else X src = (src0 >> (ld_offset - ls_offset)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X j = 32 - ld_offset; X dp++; X ls_offset += j; X@@ -131,7 +131,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X X if (ld_offset + size < 32) { X dmask = (mask0 << (32 - size)) >> ld_offset; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 << shift) | (src1 >> (32 - shift)); X@@ -141,12 +141,12 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X #else X src = (src0 << shift) | (src1 >> (32 - shift)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X return; X } X X dmask = mask0 >> ld_offset; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 << shift) | (src1 >> (32 - shift)); X@@ -156,7 +156,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X #else X src = (src0 << shift) | (src1 >> (32 - shift)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X j = 32 - ld_offset; X dp++; X sp++; X@@ -164,19 +164,19 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X } X X if (j < size) src1 = sp[0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X for (; j <= size - 32; j += 32) { X src0 = src1; X src1 = sp[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 << ls_offset) | (src1 >> (32 - ls_offset)); X dp[0] = (src << 24) | ((src & 0xFF00) << 8) | ((src >> 8) & 0xFF00) | (src >> 24); X #else X dp[0] = (src0 << ls_offset) | (src1 >> (32 - ls_offset)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp++; X dp++; X } X@@ -187,7 +187,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X if (ls_offset + j > 32) src1 = sp[1]; X dst = dp[0]; X dmask = mask0 << (32 - j); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 << ls_offset) | (src1 >> (32 - ls_offset)); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -196,7 +196,7 @@ void mlib_ImageCopy_bit_na(const mlib_u8 X #else X src = (src0 << ls_offset) | (src1 >> (32 - ls_offset)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X X #else /* _LONGLONG */ X@@ -315,7 +315,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X dst = dp[0]; X if (ld_offset >= size) { X dmask = (lmask0 << (32 - size)) >> (ld_offset - size); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src = (src0 << (ls_offset - ld_offset)); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -324,12 +324,12 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X #else X src = (src0 << (ls_offset - ld_offset)); X dp[0] = (dst & (~dmask)) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X return; X } X X dmask = lmask0 << (32 - ld_offset); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src = (src0 << (ls_offset - ld_offset)); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -338,7 +338,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X #else X src = (src0 << (ls_offset - ld_offset)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X j = ld_offset; X dp--; X ls_offset -= j; X@@ -351,7 +351,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X X if (ld_offset >= size) { X dmask = (lmask0 << (32 - size)) >> (ld_offset - size); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 >> shift) | (src1 << (32 - shift)); X@@ -361,12 +361,12 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X #else X src = (src0 >> shift) | (src1 << (32 - shift)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X return; X } X X dmask = lmask0 << (32 - ld_offset); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src0 = (src0 << 24) | ((src0 & 0xFF00) << 8) | ((src0 >> 8) & 0xFF00) | (src0 >> 24); X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 >> shift) | (src1 << (32 - shift)); X@@ -376,7 +376,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X #else X src = (src0 >> shift) | (src1 << (32 - shift)); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X j = ld_offset; X dp--; X sp--; X@@ -384,22 +384,22 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X } X X if (j < size) src1 = sp[0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X #ifdef __SUNPRO_C X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (; j <= size - 32; j += 32) { X src0 = src1; X src1 = sp[-1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 >> (32 - ls_offset)) | (src1 << ls_offset); X dp[0] = (src << 24) | ((src & 0xFF00) << 8) | ((src >> 8) & 0xFF00) | (src >> 24); X #else X dp[0] = (src0 >> (32 - ls_offset)) | (src1 << ls_offset); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp--; X dp--; X } X@@ -410,7 +410,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X if (ls_offset < j) src1 = sp[-1]; X dst = dp[0]; X dmask = lmask0 >> (32 - j); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X src1 = (src1 << 24) | ((src1 & 0xFF00) << 8) | ((src1 >> 8) & 0xFF00) | (src1 >> 24); X src = (src0 >> (32 - ls_offset)) | (src1 << ls_offset); X dst = (dst << 24) | ((dst & 0xFF00) << 8) | ((dst >> 8) & 0xFF00) | (dst >> 24); X@@ -419,7 +419,7 @@ void mlib_ImageCopy_bit_na_r(const mlib_ X #else X src = (src0 >> (32 - ls_offset)) | (src1 << ls_offset); X dp[0] = (dst & ~dmask) | (src & dmask); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X X #else /* _LONGLONG */ Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c 2009-05-14 23:41:34.000000000 -0400 X@@ -168,7 +168,7 @@ X } X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define READ_U8_D64(table0, table1, table2, table3) \ X t0 = *(mlib_d64*)((mlib_u8*)table0 + ((s0 << 3) & 0x7F8)); \ X@@ -184,7 +184,7 @@ X t2 = *(mlib_d64*)((mlib_u8*)table2 + ((s0 >> 5) & 0x7F8)); \ X t3 = *(mlib_d64*)((mlib_u8*)table3 + ((s0 << 3) & 0x7F8)) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X void mlib_ImageLookUp_U8_D64(const mlib_u8 *src, X@@ -612,7 +612,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 8, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 5) & 0x7F8)); X@@ -622,12 +622,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 21) & 0x7F8)); X@@ -637,7 +637,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[4] = t0; X dp[5] = t1; X@@ -645,7 +645,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X dp[7] = t3; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 5) & 0x7F8)); X@@ -655,12 +655,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 21) & 0x7F8)); X@@ -670,7 +670,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X@@ -718,7 +718,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 12, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X@@ -732,14 +732,14 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t3 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t4 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t5 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X dp[4] = t4; X dp[5] = t5; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X@@ -753,7 +753,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t3 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t4 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t5 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[6] = t0; X dp[7] = t1; X@@ -763,7 +763,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X dp[11] = t5; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X@@ -777,14 +777,14 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t3 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t4 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t5 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X dp[4] = t4; X dp[5] = t5; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X@@ -798,7 +798,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t3 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t4 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t5 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[6] = t0; X dp[7] = t1; X dp[8] = t2; X@@ -851,7 +851,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 16, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X@@ -861,12 +861,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 21) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 21) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 5) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 5) & 0x7F8)); X@@ -876,12 +876,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X dp[7] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X@@ -891,12 +891,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 5) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 5) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[8] = t0; X dp[9] = t1; X dp[10] = t2; X dp[11] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 21) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 21) & 0x7F8)); X@@ -906,7 +906,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[12] = t0; X dp[13] = t1; X@@ -914,7 +914,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X dp[15] = t3; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 << 3) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X@@ -924,12 +924,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 21) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 21) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 5) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 5) & 0x7F8)); X@@ -939,12 +939,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 13) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X dp[7] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 13) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 13) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 13) & 0x7F8)); X@@ -954,12 +954,12 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 5) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 5) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 >> 5) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[8] = t0; X dp[9] = t1; X dp[10] = t2; X dp[11] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_d64 *) ((mlib_u8 *) tab0 + ((s0 >> 21) & 0x7F8)); X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 >> 21) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 >> 21) & 0x7F8)); X@@ -969,7 +969,7 @@ void mlib_ImageLookUpSI_U8_D64(const mli X t1 = *(mlib_d64 *) ((mlib_u8 *) tab1 + ((s0 << 3) & 0x7F8)); X t2 = *(mlib_d64 *) ((mlib_u8 *) tab2 + ((s0 << 3) & 0x7F8)); X t3 = *(mlib_d64 *) ((mlib_u8 *) tab3 + ((s0 << 3) & 0x7F8)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[12] = t0; X dp[13] = t1; X dp[14] = t2; Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c 2009-05-14 23:41:34.000000000 -0400 X@@ -88,7 +88,7 @@ typedef union { X } d64_2_f32; X X /***************************************************************/ X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X static const mlib_u32 mlib_bit_mask[16] = { X 0x00000000u, 0xFF000000u, 0x00FF0000u, 0xFFFF0000u, X@@ -126,7 +126,7 @@ static const mlib_u32 mlib_bit_mask_3[3* X 0x00000000u, 0x00FFFFFFu, 0xFF000000u, 0xFFFFFFFFu X }; X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X mlib_status mlib_ImageLookUp_Bit_U8_1(const mlib_u8 *src, X@@ -228,13 +228,13 @@ mlib_status mlib_ImageLookUp_Bit_U8_1(co X #endif /* __SUNPRO_C */ X for (; i <= (size - 16); i += 16) { X s0 = *(mlib_u16*)sa; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *da++ = dd_array[s0 & 0xFF]; X *da++ = dd_array[s0 >> 8]; X #else X *da++ = dd_array[s0 >> 8]; X *da++ = dd_array[s0 & 0xFF]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sa += 2; X } X X@@ -258,20 +258,20 @@ mlib_status mlib_ImageLookUp_Bit_U8_1(co X val1 = p_dd[2*val0+1]; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); X #else X emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ((mlib_u32*)da)[0] = (val1 & emask) | (((mlib_u32*)da)[0] &~ emask); X X #else /* _NO_LONGLONG */ X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); X #else X mlib_u64 emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X ((mlib_u64*)da)[0] = (((mlib_u64*)dd_array)[sa[0]] & emask) | (((mlib_u64*)da)[0] &~ emask); X X@@ -323,13 +323,13 @@ mlib_status mlib_ImageLookUp_Bit_U8_2(co X X val0 = table[0][0]; X val1 = table[0][1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X val0 = val0 | (table[1][0] << 8); X val1 = val1 | (table[1][1] << 8); X #else X val0 = (val0 << 8) | table[1][0]; X val1 = (val1 << 8) | table[1][1]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X val0 |= (val0 << 16); X val1 |= (val1 << 16); X X@@ -394,11 +394,11 @@ mlib_status mlib_ImageLookUp_Bit_U8_2(co X dd1 = dd2; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); X #else X emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ((mlib_u32*)da)[0] = (dd1 & emask) | (((mlib_u32*)da)[0] &~ emask); X X #else /* _NO_LONGLONG */ X@@ -412,11 +412,11 @@ mlib_status mlib_ImageLookUp_Bit_U8_2(co X dd = ((mlib_u64*)dd_array)[s0 & 0xf]; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); X #else X emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ((mlib_u64*)da)[0] = (dd & emask) | (((mlib_u64*)da)[0] &~ emask); X X #endif /* _NO_LONGLONG */ X@@ -462,7 +462,7 @@ mlib_status mlib_ImageLookUp_Bit_U8_3(co X X buffs = buff + size; X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X l0 = (table[0][0] << 24) | (table[2][0] << 16) | (table[1][0] << 8) | (table[0][0]); X h0 = (table[0][1] << 24) | (table[2][1] << 16) | (table[1][1] << 8) | (table[0][1]); X l1 = (l0 >> 8); l1 |= (l1 << 24); X@@ -476,7 +476,7 @@ mlib_status mlib_ImageLookUp_Bit_U8_3(co X h1 = (h0 << 8); h1 |= (h1 >> 24); X l2 = (l1 << 8); l2 |= (l2 >> 24); X h2 = (h1 << 8); h2 |= (h2 >> 24); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /* calculate lookup table */ X #ifdef __SUNPRO_C X@@ -564,11 +564,11 @@ mlib_status mlib_ImageLookUp_Bit_U8_3(co X dd = ((mlib_u32*)(d_array12 + (s0 & 0xF)))[1]; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); X #else X emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = (dd & emask) | (da[0] &~ emask); X } X X@@ -611,13 +611,13 @@ mlib_status mlib_ImageLookUp_Bit_U8_4(co X X buffs = buff + size; X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X l = (table[3][0] << 24) | (table[2][0] << 16) | (table[1][0] << 8) | (table[0][0]); X h = (table[3][1] << 24) | (table[2][1] << 16) | (table[1][1] << 8) | (table[0][1]); X #else X l = (table[0][0] << 24) | (table[1][0] << 16) | (table[2][0] << 8) | (table[3][0]); X h = (table[0][1] << 24) | (table[1][1] << 16) | (table[2][1] << 8) | (table[3][1]); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X ((mlib_u32*)lh)[0] = l; ((mlib_u32*)lh)[1] = l; X ((mlib_u32*)lh)[2] = l; ((mlib_u32*)lh)[3] = h; Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c ./jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c 2009-05-14 23:41:34.000000000 -0400 X@@ -30,7 +30,7 @@ X typedef union { X mlib_d64 db; X struct { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X mlib_s32 int1, int0; X #else X mlib_s32 int0, int1; Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c ./jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c 2009-05-14 23:41:34.000000000 -0400 X@@ -275,11 +275,11 @@ void mlib_ImageCopy_bit_al(const mlib_u8 X for (i = 0; j <= (b_size - 4); j += 4, i++) { X src0 = src1; X src1 = pws[i + 1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X pwd[i] = (src0 >> lshift) | (src1 << rshift); X #else X pwd[i] = (src0 << lshift) | (src1 >> rshift); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X X sa += i << 2; X@@ -381,11 +381,11 @@ void mlib_c_ImageCopy_u8(const mlib_imag X for (; j <= (src_width - 4); j += 4) { X src0 = src1; X src1 = ps[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *((mlib_s32 *) (pdst_row + j)) = (src0 >> shl) | (src1 << shr); X #else X *((mlib_s32 *) (pdst_row + j)) = (src0 << shl) | (src1 >> shr); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ps++; X } X } X@@ -414,11 +414,11 @@ void mlib_c_ImageCopy_u8(const mlib_imag X for (; j <= (src_width - 8); j += 8) { X src0 = src1; X src1 = ps[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *((mlib_s64 *) (pdst_row + j)) = (src0 >> shl) | (src1 << shr); X #else X *((mlib_s64 *) (pdst_row + j)) = (src0 << shl) | (src1 >> shr); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ps++; X } X } X@@ -484,11 +484,11 @@ void mlib_c_ImageCopy_s16(const mlib_ima X for (; j <= (src_width - 2); j += 2) { X src0 = src1; X src1 = ps[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *((mlib_s32 *) (pdst_row + j)) = (src0 >> 16) | (src1 << 16); X #else X *((mlib_s32 *) (pdst_row + j)) = (src0 << 16) | (src1 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ps++; X } X } X@@ -516,11 +516,11 @@ void mlib_c_ImageCopy_s16(const mlib_ima X for (; j <= (src_width - 4); j += 4) { X src0 = src1; X src1 = ps[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *((mlib_s64 *) (pdst_row + j)) = (src0 >> shl) | (src1 << shr); X #else X *((mlib_s64 *) (pdst_row + j)) = (src0 << shl) | (src1 >> shr); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ps++; X } X } X@@ -585,11 +585,11 @@ void mlib_c_ImageCopy_s32(const mlib_ima X for (; j <= (src_width - 2); j += 2) { X src0 = src1; X src1 = ps[1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *((mlib_s64 *) (pdst_row + j)) = (src0 >> 32) | (src1 << 32); X #else X *((mlib_s64 *) (pdst_row + j)) = (src0 << 32) | (src1 >> 32); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X ps++; X } X } X@@ -687,11 +687,11 @@ void mlib_ImageCopy_na(const mlib_u8 *sp X #endif /* __SUNPRO_C */ X for (; n > SIZE; n -= SIZE) { X s1 = *tmp++; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *(TYPE *) dp = (s0 >> shl) | (s1 << shr); X #else X *(TYPE *) dp = (s0 << shl) | (s1 >> shr); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = s1; X dp += SIZE; X sp += SIZE; Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c ./jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c 2009-05-14 23:41:34.000000000 -0400 X@@ -120,7 +120,7 @@ X } \ X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X /***************************************************************/ X #define READ_U8_U8_ALIGN(table0, table1, table2, table3) \ X@@ -163,7 +163,7 @@ X t2 = *(mlib_u32*)((mlib_u8*)table2 + ((s0 >> 14) & 0x3FC)); \ X t3 = *(mlib_u32*)((mlib_u8*)table3 + ((s0 >> 22) & 0x3FC)) X X-#else /* _LITTLE_ENDIAN */ X+#else /* BYTE_ORDER == ... */ X X /***********/ X #define READ_U8_U8_ALIGN(table0, table1, table2, table3) \ X@@ -206,7 +206,7 @@ X t2 = *(mlib_u32*)((mlib_u8*)table2 + ((s0 >> 6) & 0x3FC)); \ X t3 = *(mlib_u32*)((mlib_u8*)table3 + ((s0 << 2) & 0x3FC)) X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X /***************************************************************/ X void mlib_c_ImageLookUp_U8_U8(const mlib_u8 *src, X@@ -297,11 +297,11 @@ void mlib_c_ImageLookUp_U8_U8(const mlib X da[0] = t; X da++; X dp = (mlib_u8 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = tab[s2 >> 8]; X #else X *dp++ = tab[s2 & 0xFF]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp = (mlib_u8 *) sa; X i += 5; X for (; i < size; i++, dp++, sp++) X@@ -403,11 +403,11 @@ void mlib_c_ImageLookUp_U8_U8(const mlib X da[0] = t; X da++; X dp = (mlib_u8 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = tab0[s2 >> 8]; X #else X *dp++ = tab0[s2 & 0xFF]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp = (mlib_u8 *) sa; X i += 5; X X@@ -544,11 +544,11 @@ void mlib_c_ImageLookUp_U8_U8(const mlib X da[0] = t; X da++; X dp = (mlib_u8 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = tab1[s2 >> 8]; X #else X *dp++ = tab1[s2 & 0xFF]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp = (mlib_u8 *) sa; X i += 5; X X@@ -694,11 +694,11 @@ void mlib_c_ImageLookUp_U8_U8(const mlib X da[0] = t; X da++; X dp = (mlib_u8 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = tab0[s2 >> 8]; X #else X *dp++ = tab0[s2 & 0xFF]; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sp = (mlib_u8 *) sa; X i += 5; X X@@ -1852,21 +1852,21 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X s0 = tab0[0]; X s1 = tab1[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s2 = (s1 << 8) + s0; X #else X s2 = (s0 << 8) + s1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X tab[i - 1] = (mlib_u16) s2; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s2 = (s1 << 8) + s0; X #else X s2 = (s0 << 8) + s1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[255] = (mlib_u16) s2; X X for (j = 0; j < ysize; j++, dst += dlb, src += slb) { X@@ -1897,11 +1897,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X for (i = 0; i < size - 3; i += 2, da++, sa += 2) { X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t = (t1 << 16) + t0; X #else X t = (t0 << 16) + t1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X da[0] = t; X@@ -1909,11 +1909,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t = (t1 << 16) + t0; X #else X t = (t0 << 16) + t1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = t; X da++; X X@@ -1927,13 +1927,13 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X if (off > 1) { X t0 = tab[sa[0]]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[1] = (t0 >> 8); X dp[0] = t0; X #else X dp[0] = (t0 >> 8); X dp[1] = t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sa++; X size--; X dp += 2; X@@ -1941,11 +1941,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X t0 = tab[sa[0]]; X sa++; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = t0; X #else X *dp++ = (t0 >> 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X da = (mlib_s32 *) dp; X X@@ -1959,11 +1959,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X for (i = 0; i < size - 4; i += 2, da++, sa += 2) { X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t = (t0 >> 8) + (t1 << 8) + (t2 << 24); X #else X t = (t0 << 24) + (t1 << 8) + (t2 >> 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X t0 = t2; X s0 = sa[0]; X s1 = sa[1]; X@@ -1972,29 +1972,29 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t = (t0 >> 8) + (t1 << 8) + (t2 << 24); X #else X t = (t0 << 24) + (t1 << 8) + (t2 >> 8); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = t; X da++; X dp = (mlib_u8 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[0] = (t2 >> 8); X #else X dp[0] = t2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X if ((size & 1) == 0) { X t0 = tab[sa[0]]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[2] = (t0 >> 8); X dp[1] = t0; X #else X dp[1] = (t0 >> 8); X dp[2] = t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -2012,22 +2012,22 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X s1 = tab1[0]; X s2 = tab2[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s3 = (s2 << 24) + (s1 << 16) + (s0 << 8); X #else X s3 = (s0 << 16) + (s1 << 8) + s2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X s2 = tab2[i]; X tab[i - 1] = s3; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s3 = (s2 << 24) + (s1 << 16) + (s0 << 8); X #else X s3 = (s0 << 16) + (s1 << 8) + s2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[255] = s3; X X for (j = 0; j < ysize; j++, dst += dlb, src += slb) { X@@ -2064,24 +2064,24 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X for (i = 0; i < size - 7; i += 4, da += 3, sa += 4) { X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t0 >> 8) + (t1 << 16); X res2 = (t1 >> 16); X #else X da[0] = (t0 << 8) + (t1 >> 16); X res2 = (t1 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += (t0 << 8); X res1 = (t0 >> 24) + t1; X #else X res2 += (t0 >> 8); X res1 = (t0 << 24) + t1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[2]; X s1 = sa[3]; X da[1] = res2; X@@ -2090,24 +2090,24 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t0 >> 8) + (t1 << 16); X res2 = (t1 >> 16); X #else X da[0] = (t0 << 8) + (t1 >> 16); X res2 = (t1 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab[s0]; X t1 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += (t0 << 8); X res1 = (t0 >> 24) + t1; X #else X res2 += (t0 >> 8); X res1 = (t0 << 24) + t1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[1] = res2; X da[2] = res1; X da += 3; X@@ -2143,11 +2143,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X s2 = tab2[0]; X s3 = tab3[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s4 = (s3 << 24) + (s2 << 16) + (s1 << 8) + s0; X #else X s4 = (s0 << 24) + (s1 << 16) + (s2 << 8) + s3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X s2 = tab2[i]; X@@ -2155,11 +2155,11 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X tab[i - 1] = s4; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s4 = (s3 << 24) + (s2 << 16) + (s1 << 8) + s0; X #else X s4 = (s0 << 24) + (s1 << 16) + (s2 << 8) + s3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[255] = s4; X X for (j = 0; j < ysize; j++, dst += dlb, src += slb) { X@@ -2225,13 +2225,13 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X for (i = 0; i < size - 4; i += 2, da += 2, sa += 2) { X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> shift) + (t1 << shift1); X res2 = (t1 >> shift) + (t2 << shift1); X #else X res1 = (t0 << shift) + (t1 >> shift1); X res2 = (t1 << shift) + (t2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X t0 = t2; X s0 = sa[0]; X s1 = sa[1]; X@@ -2241,28 +2241,28 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> shift) + (t1 << shift1); X res2 = (t1 >> shift) + (t2 << shift1); X #else X res1 = (t0 << shift) + (t1 >> shift1); X res2 = (t1 << shift) + (t2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res1; X da[1] = res2; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = (da[2] >> shift1); X da[2] = (t2 >> shift) + (t0 << shift1); X #else X t0 = (da[2] << shift1); X da[2] = (t2 << shift) + (t0 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da += 2; X dp = (mlib_u8 *) da + (4 - off); X X if ((size & 1) == 0) { X t0 = tab[sa[0]]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[3] = (mlib_u8) (t0 >> 24); X dp[2] = (mlib_u8) (t0 >> 16); X dp[1] = (mlib_u8) (t0 >> 8); X@@ -2272,7 +2272,7 @@ void mlib_c_ImageLookUpSI_U8_U8(const ml X dp[1] = (mlib_u8) (t0 >> 16); X dp[2] = (mlib_u8) (t0 >> 8); X dp[3] = (mlib_u8) t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -2348,13 +2348,13 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res2 = (t5 << 8) + t4; X #else X da[0] = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res2 = (t4 << 24) + (t5 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab0[s0]; X@@ -2363,13 +2363,13 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += ((t1 << 24) + (t0 << 16)); X res1 = (t5 << 24) + (t4 << 16) + (t3 << 8) + t2; X #else X res2 += ((t0 << 8) + t1); X res1 = (t2 << 24) + (t3 << 16) + (t4 << 8) + t5; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[2]; X s1 = sa[3]; X da[1] = res2; X@@ -2382,13 +2382,13 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res2 = (t5 << 8) + t4; X #else X da[0] = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res2 = (t4 << 24) + (t5 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab0[s0]; X@@ -2397,13 +2397,13 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += ((t1 << 24) + (t0 << 16)); X res1 = (t5 << 24) + (t4 << 16) + (t3 << 8) + t2; X #else X res2 += ((t0 << 8) + t1); X res1 = (t2 << 24) + (t3 << 16) + (t4 << 8) + t5; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[1] = res2; X da[2] = res1; X da += 3; X@@ -2455,11 +2455,11 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X da[0] = res; X } X@@ -2468,11 +2468,11 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res; X X } X@@ -2496,11 +2496,11 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t2 = tab2[s0]; X t3 = tab3[s0]; X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res1 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X s0 = sa[0]; X sa++; X@@ -2513,13 +2513,13 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res = (res1 >> shift) + (res2 << shift1); X #else X res2 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res = (res1 << shift) + (res2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X res1 = res2; X s0 = sa[0]; X da[0] = res; X@@ -2529,21 +2529,21 @@ void mlib_c_ImageLookUpSI_S16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res = (res1 >> shift) + (res2 << shift1); X #else X res2 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res = (res1 << shift) + (res2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (da[1] >> shift1); X da[1] = (res2 >> shift) + (res1 << shift1); X #else X res1 = (da[1] << shift1); X da[1] = (res2 << shift) + (res1 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -2617,13 +2617,13 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res2 = (t5 << 8) + t4; X #else X da[0] = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res2 = (t4 << 24) + (t5 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab0[s0]; X@@ -2632,13 +2632,13 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += ((t1 << 24) + (t0 << 16)); X res1 = (t5 << 24) + (t4 << 16) + (t3 << 8) + t2; X #else X res2 += ((t0 << 8) + t1); X res1 = (t2 << 24) + (t3 << 16) + (t4 << 8) + t5; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[2]; X s1 = sa[3]; X da[1] = res2; X@@ -2651,13 +2651,13 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X da[0] = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res2 = (t5 << 8) + t4; X #else X da[0] = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res2 = (t4 << 24) + (t5 << 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X s1 = sa[1]; X t0 = tab0[s0]; X@@ -2666,13 +2666,13 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t3 = tab0[s1]; X t4 = tab1[s1]; X t5 = tab2[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 += ((t1 << 24) + (t0 << 16)); X res1 = (t5 << 24) + (t4 << 16) + (t3 << 8) + t2; X #else X res2 += ((t0 << 8) + t1); X res1 = (t2 << 24) + (t3 << 16) + (t4 << 8) + t5; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[1] = res2; X da[2] = res1; X da += 3; X@@ -2724,11 +2724,11 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X da[0] = res; X } X@@ -2737,11 +2737,11 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res; X X } X@@ -2765,11 +2765,11 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t2 = tab2[s0]; X t3 = tab3[s0]; X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X #else X res1 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X s0 = sa[0]; X sa++; X@@ -2782,13 +2782,13 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res = (res1 >> shift) + (res2 << shift1); X #else X res2 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res = (res1 << shift) + (res2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X res1 = res2; X s0 = sa[0]; X da[0] = res; X@@ -2798,21 +2798,21 @@ void mlib_c_ImageLookUpSI_U16_U8(const m X t1 = tab1[s0]; X t2 = tab2[s0]; X t3 = tab3[s0]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res2 = (t3 << 24) + (t2 << 16) + (t1 << 8) + t0; X res = (res1 >> shift) + (res2 << shift1); X #else X res2 = (t0 << 24) + (t1 << 16) + (t2 << 8) + t3; X res = (res1 << shift) + (res2 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (da[1] >> shift1); X da[1] = (res2 >> shift) + (res1 << shift1); X #else X res1 = (da[1] << shift1); X da[1] = (res2 << shift) + (res1 >> shift1); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -2863,21 +2863,21 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X s0 = tab0[0]; X s1 = tab1[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s2 = (s1 << 16) + s0; X #else X s2 = (s0 << 16) + s1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X tab[i - 1] = s2; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s2 = (s1 << 16) + s0; X #else X s2 = (s0 << 16) + s1; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[255] = s2; X X for (j = 0; j < ysize; j++, dst += dlb, src += slb) { X@@ -2919,11 +2919,11 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X else { X X t0 = tab[*sa++]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = (mlib_u16) (t0); X #else X *dp++ = (mlib_u16) (t0 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da = (mlib_u32 *) dp; X s0 = sa[0]; X s1 = sa[1]; X@@ -2935,13 +2935,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X for (i = 0; i < size - 4; i += 2, da += 2, sa += 2) { X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> 16) + (t1 << 16); X res2 = (t1 >> 16) + (t2 << 16); X #else X res1 = (t0 << 16) + (t1 >> 16); X res2 = (t1 << 16) + (t2 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X t0 = t2; X s0 = sa[0]; X s1 = sa[1]; X@@ -2951,32 +2951,32 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X X t1 = tab[s0]; X t2 = tab[s1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> 16) + (t1 << 16); X res2 = (t1 >> 16) + (t2 << 16); X #else X res1 = (t0 << 16) + (t1 >> 16); X res2 = (t1 << 16) + (t2 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res1; X da[1] = res2; X da += 2; X dp = (mlib_u16 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[0] = (mlib_u16) (t2 >> 16); X #else X dp[0] = (mlib_u16) t2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X if ((size & 1) == 0) { X t0 = tab[sa[0]]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[2] = (mlib_u16) (t0 >> 16); X dp[1] = (mlib_u16) t0; X #else X dp[1] = (mlib_u16) (t0 >> 16); X dp[2] = (mlib_u16) t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -2994,13 +2994,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X s1 = tab1[0]; X s2 = tab2[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s3 = (s0 << 16); X s4 = (s2 << 16) + s1; X #else X s3 = s0; X s4 = (s1 << 16) + s2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X s2 = tab2[i]; X@@ -3008,13 +3008,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X tab[2 * i - 1] = s4; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s4 = (s2 << 16) + s1; X tab[510] = s0 << 16; X #else X s4 = (s1 << 16) + s2; X tab[510] = s0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[511] = s4; X X for (j = 0; j < ysize; j++, dst += dlb, src += slb) { X@@ -3050,13 +3050,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab + s0 + 4); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab + s1); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab + s1 + 4); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> 16) + (t1 << 16); X res2 = (t1 >> 16) + t2; X #else X res1 = (t0 << 16) + (t1 >> 16); X res2 = (t1 << 16) + t2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0] << 3; X s1 = sa[1] << 3; X da[0] = res1; X@@ -3068,13 +3068,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab + s0 + 4); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab + s1); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab + s1 + 4); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t0 >> 16) + (t1 << 16); X res2 = (t1 >> 16) + t2; X #else X res1 = (t0 << 16) + (t1 >> 16); X res2 = (t1 << 16) + t2; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res1; X da[1] = res2; X da[2] = t3; X@@ -3105,13 +3105,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X s2 = tab2[0]; X s3 = tab3[0]; X for (i = 1; i < 256; i++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s4 = (s1 << 16) + s0; X s5 = (s3 << 16) + s2; X #else X s4 = (s0 << 16) + s1; X s5 = (s2 << 16) + s3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = tab0[i]; X s1 = tab1[i]; X s2 = tab2[i]; X@@ -3120,13 +3120,13 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X tab[2 * i - 1] = s5; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X s4 = (s1 << 16) + s0; X s5 = (s3 << 16) + s2; X #else X s4 = (s0 << 16) + s1; X s5 = (s2 << 16) + s3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X tab[510] = s4; X tab[511] = s5; X X@@ -3181,18 +3181,18 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X X t4 = tab[2 * sa[0]]; X t5 = tab[2 * sa[0] + 1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *dp++ = (mlib_u16) (t4); X #else X *dp++ = (mlib_u16) (t4 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X sa++; X da = (mlib_u32 *) dp; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X *da++ = (t4 >> 16) + (t5 << 16); X #else X *da++ = (t4 << 16) + (t5 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0] << 3; X s1 = sa[1] << 3; X sa += 2; X@@ -3205,7 +3205,7 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab + s0 + 4); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab + s1); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab + s1 + 4); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t5 >> 16) + (t0 << 16); X res2 = (t0 >> 16) + (t1 << 16); X res3 = (t1 >> 16) + (t2 << 16); X@@ -3215,7 +3215,7 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X res2 = (t0 << 16) + (t1 >> 16); X res3 = (t1 << 16) + (t2 >> 16); X res4 = (t2 << 16) + (t3 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0] << 3; X s1 = sa[1] << 3; X da[0] = res1; X@@ -3229,7 +3229,7 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab + s0 + 4); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab + s1); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab + s1 + 4); X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X res1 = (t5 >> 16) + (t0 << 16); X res2 = (t0 >> 16) + (t1 << 16); X res3 = (t1 >> 16) + (t2 << 16); X@@ -3239,36 +3239,36 @@ void mlib_c_ImageLookUpSI_U8_S16(const m X res2 = (t0 << 16) + (t1 >> 16); X res3 = (t1 << 16) + (t2 >> 16); X res4 = (t2 << 16) + (t3 >> 16); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X da[0] = res1; X da[1] = res2; X da[2] = res3; X da[3] = res4; X da += 4; X dp = (mlib_u16 *) da; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[0] = (mlib_u16) (t3 >> 16); X #else X dp[0] = (mlib_u16) t3; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X X if ((size & 1) == 0) { X t0 = tab[2 * sa[0]]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[2] = (mlib_u16) (t0 >> 16); X dp[1] = (mlib_u16) t0; X #else X dp[1] = (mlib_u16) (t0 >> 16); X dp[2] = (mlib_u16) t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X t0 = tab[2 * sa[0] + 1]; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X dp[4] = (mlib_u16) (t0 >> 16); X dp[3] = (mlib_u16) t0; X #else X dp[3] = (mlib_u16) (t0 >> 16); X dp[4] = (mlib_u16) t0; X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X } X } X } X@@ -3439,7 +3439,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 8, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 6) & 0x3FC)); X@@ -3449,12 +3449,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 22) & 0x3FC)); X@@ -3464,7 +3464,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[4] = t0; X dp[5] = t1; X@@ -3472,7 +3472,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X dp[7] = t3; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 6) & 0x3FC)); X@@ -3482,12 +3482,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 22) & 0x3FC)); X@@ -3497,7 +3497,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X@@ -3545,7 +3545,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 12, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X@@ -3559,14 +3559,14 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t3 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t4 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t5 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X dp[4] = t4; X dp[5] = t5; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X@@ -3580,7 +3580,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t3 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t4 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t5 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[6] = t0; X dp[7] = t1; X@@ -3590,7 +3590,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X dp[11] = t5; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X@@ -3604,14 +3604,14 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t3 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t4 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t5 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X dp[4] = t4; X dp[5] = t5; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X@@ -3625,7 +3625,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t3 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t4 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t5 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[6] = t0; X dp[7] = t1; X dp[8] = t2; X@@ -3678,7 +3678,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X #pragma pipeloop(0) X #endif /* __SUNPRO_C */ X for (i = 0; i < size - 7; i += 4, dp += 16, sa++) { X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X@@ -3688,12 +3688,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 22) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 22) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 6) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 6) & 0x3FC)); X@@ -3703,12 +3703,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X dp[7] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X@@ -3718,12 +3718,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 6) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 6) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[8] = t0; X dp[9] = t1; X dp[10] = t2; X dp[11] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 22) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 22) & 0x3FC)); X@@ -3733,7 +3733,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X s0 = sa[0]; X dp[12] = t0; X dp[13] = t1; X@@ -3741,7 +3741,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X dp[15] = t3; X } X X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 << 2) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X@@ -3751,12 +3751,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 22) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 22) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[0] = t0; X dp[1] = t1; X dp[2] = t2; X dp[3] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 6) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 6) & 0x3FC)); X@@ -3766,12 +3766,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 14) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[4] = t0; X dp[5] = t1; X dp[6] = t2; X dp[7] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 14) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 14) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 14) & 0x3FC)); X@@ -3781,12 +3781,12 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 6) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 6) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 >> 6) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[8] = t0; X dp[9] = t1; X dp[10] = t2; X dp[11] = t3; X-#ifdef _LITTLE_ENDIAN X+#if (BYTE_ORDER == LITTLE_ENDIAN) X t0 = *(mlib_u32 *) ((mlib_u8 *) tab0 + ((s0 >> 22) & 0x3FC)); X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 >> 22) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 >> 22) & 0x3FC)); X@@ -3796,7 +3796,7 @@ void mlib_c_ImageLookUpSI_U8_S32(const m X t1 = *(mlib_u32 *) ((mlib_u8 *) tab1 + ((s0 << 2) & 0x3FC)); X t2 = *(mlib_u32 *) ((mlib_u8 *) tab2 + ((s0 << 2) & 0x3FC)); X t3 = *(mlib_u32 *) ((mlib_u8 *) tab3 + ((s0 << 2) & 0x3FC)); X-#endif /* _LITTLE_ENDIAN */ X+#endif /* BYTE_ORDER == LITTLE_ENDIAN */ X dp[12] = t0; X dp[13] = t1; X dp[14] = t2; Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h ./jdk/src/share/native/sun/awt/medialib/mlib_image.h X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_image.h 2009-05-14 23:41:34.000000000 -0400 X@@ -27,6 +27,11 @@ X #ifndef MLIB_IMAGE_H X #define MLIB_IMAGE_H X X+#ifdef __OpenBSD__ X+#include <sys/types.h> X+#endif X+#include <machine/endian.h> X+ X #include <mlib_types.h> X #include <mlib_status.h> X #include <mlib_sys.h> Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c ./jdk/src/share/native/sun/awt/medialib/mlib_sys.c X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_sys.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,9 +26,15 @@ X X #include <stdlib.h> X #include <string.h> X+#ifdef _ALLBSD_SOURCE X+#include <unistd.h> X+#endif X #include <mlib_types.h> X #include <mlib_sys_proto.h> X #include "mlib_SysMath.h" X+#if defined(_ALLBSD_SOURCE) X+#include <sys/param.h> X+#endif X X /***************************************************************/ X X@@ -86,7 +92,12 @@ void *__mlib_malloc(mlib_u32 size) X * alignment. -- from stdlib.h of MS VC++5.0. X */ X return (void *) malloc(size); X-#else /* _MSC_VER */ X+#elif defined(__FreeBSD__) && (__FreeBSD_version >= 700013) X+ void *ret; X+ return posix_memalign(&ret, 8, size) ? NULL : ret; X+#elif defined(_ALLBSD_SOURCE) X+ return valloc(size); X+#else X return (void *) memalign(8, size); X #endif /* _MSC_VER */ X } Xdiff -uNpr ../orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h ./jdk/src/share/native/sun/awt/medialib/mlib_types.h X--- ../orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/awt/medialib/mlib_types.h 2009-05-14 23:41:34.000000000 -0400 X@@ -59,7 +59,10 @@ typedef double mlib_d64; X X #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__GNUC__) X X-#if defined(__linux__) X+#if defined(_ALLBSD_SOURCE) X+#include <stddef.h> /* for ptrdiff_t */ X+#include <stdint.h> /* for uintptr_t */ X+#elif defined(__linux__) X #include <stdint.h> /* for uintptr_t */ X #include <malloc.h> /* for ptrdiff_t */ X #else Xdiff -uNpr ../orig/jdk/src/share/native/sun/font/AccelGlyphCache.c ./jdk/src/share/native/sun/font/AccelGlyphCache.c X--- ../orig/jdk/src/share/native/sun/font/AccelGlyphCache.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/font/AccelGlyphCache.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,7 +23,11 @@ X * have any questions. X */ X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X #include "jni.h" X #include "AccelGlyphCache.h" X #include "Trace.h" Xdiff -uNpr ../orig/jdk/src/share/native/sun/font/DrawGlyphList.c ./jdk/src/share/native/sun/font/DrawGlyphList.c X--- ../orig/jdk/src/share/native/sun/font/DrawGlyphList.c 2009-04-24 03:34:30.000000000 -0400 X+++ ./jdk/src/share/native/sun/font/DrawGlyphList.c 2009-05-14 23:41:34.000000000 -0400 X@@ -26,7 +26,11 @@ X #include "jlong.h" X #include "math.h" X #include "string.h" X+#ifdef _ALLBSD_SOURCE X+#include "stdlib.h" X+#else X #include "malloc.h" X+#endif X #include "sunfontids.h" X #include "fontscalerdefs.h" X #include "glyphblitting.h" Xdiff -uNpr ../orig/jdk/src/share/native/sun/font/sunFont.c ./jdk/src/share/native/sun/font/sunFont.c X--- ../orig/jdk/src/share/native/sun/font/sunFont.c 2009-04-24 03:34:31.000000000 -0400 X+++ ./jdk/src/share/native/sun/font/sunFont.c 2009-05-14 23:41:34.000000000 -0400 X@@ -24,7 +24,9 @@ X */ X X #include "stdlib.h" X+#ifndef _ALLBSD_SOURCE X #include "malloc.h" X+#endif X #include "string.h" X #include "gdefs.h" X #include "jlong.h" Xdiff -uNpr ../orig/jdk/src/share/native/sun/java2d/SurfaceData.c ./jdk/src/share/native/sun/java2d/SurfaceData.c X--- ../orig/jdk/src/share/native/sun/java2d/SurfaceData.c 2009-04-24 03:34:31.000000000 -0400 X+++ ./jdk/src/share/native/sun/java2d/SurfaceData.c 2009-05-14 23:41:34.000000000 -0400 X@@ -28,7 +28,11 @@ X #include "jni_util.h" X #include "Disposer.h" X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include "malloc.h" X+#endif X #include "string.h" X X /** Xdiff -uNpr ../orig/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h ./jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h X--- ../orig/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h 2009-04-24 03:34:31.000000000 -0400 X+++ ./jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h 2009-05-14 23:41:34.000000000 -0400 X@@ -26,6 +26,9 @@ X #ifndef OGLFuncs_h_Included X #define OGLFuncs_h_Included X X+#ifdef _ALLBSD_SOURCE X+#include <dlfcn.h> X+#endif X #include "jni.h" X #include "J2D_GL/gl.h" X #include "J2D_GL/glext.h" Xdiff -uNpr ../orig/jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c ./jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c X--- ../orig/jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c 2009-04-24 03:34:31.000000000 -0400 X+++ ./jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c 2009-05-14 23:41:34.000000000 -0400 X@@ -25,7 +25,11 @@ X X #ifndef HEADLESS X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X X #include "sun_java2d_pipe_BufferedOpCodes.h" X Xdiff -uNpr ../orig/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c ./jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c X--- ../orig/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c 2009-04-24 03:34:31.000000000 -0400 X+++ ./jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c 2009-05-14 23:41:34.000000000 -0400 X@@ -25,7 +25,11 @@ X X #ifndef HEADLESS X X+#ifdef _ALLBSD_SOURCE X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X #include <math.h> X #include <jlong.h> X Xdiff -uNpr ../orig/jdk/src/share/transport/socket/socketTransport.c ./jdk/src/share/transport/socket/socketTransport.c X--- ../orig/jdk/src/share/transport/socket/socketTransport.c 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/share/transport/socket/socketTransport.c 2009-05-14 23:41:34.000000000 -0400 X@@ -65,6 +65,9 @@ static jdwpTransportEnv single_env = (jd X #define HEADER_SIZE 11 X #define MAX_DATA_SIZE 1000 X X+static jint recv_fully(int, char *, int); X+static jint send_fully(int, char *, int); X+ X /* X * Record the last error for this thread. X */ X@@ -153,7 +156,7 @@ handshake(int fd, jlong timeout) { X } X buf = b; X buf += received; X- n = dbgsysRecv(fd, buf, strlen(hello)-received, 0); X+ n = recv_fully(fd, buf, strlen(hello)-received); X if (n == 0) { X setLastError(0, "handshake failed - connection prematurally closed"); X return JDWPTRANSPORT_ERROR_IO_ERROR; X@@ -179,7 +182,7 @@ handshake(int fd, jlong timeout) { X } X } X X- if (dbgsysSend(fd, hello, strlen(hello), 0) != (int)strlen(hello)) { X+ if (send_fully(fd, hello, strlen(hello)) != (int)strlen(hello)) { X RETURN_IO_ERROR("send failed during handshake"); X } X return JDWPTRANSPORT_ERROR_NONE; X@@ -554,19 +557,19 @@ socketTransport_writePacket(jdwpTranspor X /* Do one send for short packets, two for longer ones */ X if (data_len <= MAX_DATA_SIZE) { X memcpy(header + HEADER_SIZE, data, data_len); X- if (dbgsysSend(socketFD, (char *)&header, HEADER_SIZE + data_len, 0) != X+ if (send_fully(socketFD, (char *)&header, HEADER_SIZE + data_len) != X HEADER_SIZE + data_len) { X RETURN_IO_ERROR("send failed"); X } X } else { X memcpy(header + HEADER_SIZE, data, MAX_DATA_SIZE); X- if (dbgsysSend(socketFD, (char *)&header, HEADER_SIZE + MAX_DATA_SIZE, 0) != X+ if (send_fully(socketFD, (char *)&header, HEADER_SIZE + MAX_DATA_SIZE) != X HEADER_SIZE + MAX_DATA_SIZE) { X RETURN_IO_ERROR("send failed"); X } X /* Send the remaining data bytes right out of the data area. */ X- if (dbgsysSend(socketFD, (char *)data + MAX_DATA_SIZE, X- data_len - MAX_DATA_SIZE, 0) != data_len - MAX_DATA_SIZE) { X+ if (send_fully(socketFD, (char *)data + MAX_DATA_SIZE, X+ data_len - MAX_DATA_SIZE) != data_len - MAX_DATA_SIZE) { X RETURN_IO_ERROR("send failed"); X } X } X@@ -574,13 +577,33 @@ socketTransport_writePacket(jdwpTranspor X return JDWPTRANSPORT_ERROR_NONE; X } X X-static jint X+jint X recv_fully(int f, char *buf, int len) X { X int nbytes = 0; X while (nbytes < len) { X int res = dbgsysRecv(f, buf + nbytes, len - nbytes, 0); X if (res < 0) { X+ if (errno == EINTR) X+ continue; X+ return res; X+ } else if (res == 0) { X+ break; /* eof, return nbytes which is less than len */ X+ } X+ nbytes += res; X+ } X+ return nbytes; X+} X+ X+jint X+send_fully(int f, char *buf, int len) X+{ X+ int nbytes = 0; X+ while (nbytes < len) { X+ int res = dbgsysSend(f, buf + nbytes, len - nbytes, 0); X+ if (res < 0) { X+ if (errno == EINTR) X+ continue; X return res; X } else if (res == 0) { X break; /* eof, return nbytes which is less than len */ Xdiff -uNpr ../orig/jdk/src/solaris/back/exec_md.c ./jdk/src/solaris/back/exec_md.c X--- ../orig/jdk/src/solaris/back/exec_md.c 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/solaris/back/exec_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -30,7 +30,7 @@ X #include "sys.h" X #include "util.h" X X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X /* Linux */ X #define FORK() fork() X #else Xdiff -uNpr ../orig/jdk/src/solaris/back/linker_md.c ./jdk/src/solaris/back/linker_md.c X--- ../orig/jdk/src/solaris/back/linker_md.c 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/solaris/back/linker_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -48,6 +48,12 @@ X #include "threads_md.h" X #endif X X+#ifdef __APPLE__ X+#define LIB_SUFFIX "dylib" X+#else X+#define LIB_SUFFIX "so" X+#endif X+ X /* X * create a string for the JNI native function name by adding the X * appropriate decorations. X@@ -77,9 +83,9 @@ dbgsysBuildLibName(char *holder, int hol X } X X if (pnamelen == 0) { X- (void)snprintf(holder, holderlen, "lib%s.so", fname); X+ (void)snprintf(holder, holderlen, "lib%s." LIB_SUFFIX, fname); X } else { X- (void)snprintf(holder, holderlen, "%s/lib%s.so", pname, fname); X+ (void)snprintf(holder, holderlen, "%s/lib%s." LIB_SUFFIX, pname, fname); X } X } X Xdiff -uNpr ../orig/jdk/src/solaris/back/util_md.h ./jdk/src/solaris/back/util_md.h X--- ../orig/jdk/src/solaris/back/util_md.h 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/solaris/back/util_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -28,6 +28,7 @@ X X #include <limits.h> X #include <sys/types.h> X+#include <machine/endian.h> X X #ifdef _LP64 X typedef unsigned long UNSIGNED_JLONG; X@@ -43,7 +44,7 @@ typedef unsigned long UNSIGNED_JINT; X X /* On little endian machines, convert java big endian numbers. */ X X-#if defined(_LITTLE_ENDIAN) X+#if (BYTE_ORDER == LITTLE_ENDIAN) X X #define HOST_TO_JAVA_CHAR(x) (((x & 0xff) << 8) | ((x >> 8) & (0xff))) X #define HOST_TO_JAVA_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & (0xff))) Xdiff -uNpr ../orig/jdk/src/solaris/bin/java_md.c ./jdk/src/solaris/bin/java_md.c X--- ../orig/jdk/src/solaris/bin/java_md.c 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/solaris/bin/java_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -24,6 +24,7 @@ X */ X X #include "java.h" X+#include "jvm_md.h" X #include <dirent.h> X #include <dlfcn.h> X #include <fcntl.h> X@@ -34,17 +35,33 @@ X #include <sys/stat.h> X #include <unistd.h> X #include <sys/types.h> X+#if defined(_ALLBSD_SOURCE) X+#include <sys/time.h> X+#endif X+#ifndef _SC_PHYS_PAGES X+#include <sys/sysctl.h> X+#endif X+ X #include "manifest_info.h" X #include "version_comp.h" X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <pthread.h> X #else X #include <thread.h> X #endif X X+#ifdef __APPLE__ X+#define JVM_DLL "libjvm.dylib" X+#define JAVA_DLL "libjava.dylib" X+/* FALLBACK avoids naming conflicts with system libraries X+ * (eg, ImageIO's libJPEG.dylib) */ X+#define LD_LIBRARY_PATH "DYLD_FALLBACK_LIBRARY_PATH" X+#else X #define JVM_DLL "libjvm.so" X #define JAVA_DLL "libjava.so" X+#define LD_LIBRARY_PATH "LD_LIBRARY_PATH" X+#endif X X /* X * If a processor / os combination has the ability to run binaries of X@@ -75,14 +92,31 @@ X #endif X X /* pointer to environment */ X+#ifdef __APPLE__ X+#include <crt_externs.h> X+#define environ (*_NSGetEnviron()) X+#else X extern char **environ; X+#endif X X /* X * A collection of useful strings. One should think of these as #define X * entries, but actual strings can be more efficient (with many compilers). X */ X-#ifdef __linux__ X-static const char *system_dir = "/usr/java"; X+#if defined(__FreeBSD__) X+static const char *system_dir = "/usr/local/openjdk6"; X+static const char *user_dir = "/java"; X+#elif defined(__NetBSD__) X+static const char *system_dir = "/usr/local/openjdk6"; X+static const char *user_dir = "/java"; X+#elif defined(__OpenBSD__) X+static const char *system_dir = "/usr/local/openjdk6"; X+static const char *user_dir = "/java"; X+#elif defined(__APPLE__) X+static const char *system_dir = "/usr/local/openjdk6"; X+static const char *user_dir = "/java"; X+#elif defined(__linux__) X+static const char *system_dir = "/usr/local/java"; X static const char *user_dir = "/java"; X #else /* Solaris */ X static const char *system_dir = "/usr/jdk"; X@@ -404,10 +438,10 @@ CreateExecutionEnvironment(int *_argcp, X * If not on Solaris, assume only a single LD_LIBRARY_PATH X * variable. X */ X- runpath = getenv("LD_LIBRARY_PATH"); X+ runpath = getenv(LD_LIBRARY_PATH); X #endif /* __sun */ X X-#ifdef __linux X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /* X * On linux, if a binary is running as sgid or suid, glibc sets X * LD_LIBRARY_PATH to the empty string for security purposes. (In X@@ -431,7 +465,7 @@ CreateExecutionEnvironment(int *_argcp, X new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) + X 2*strlen(jrepath) + 2*strlen(arch) + X strlen(jvmpath) + 52); X- newpath = new_runpath + strlen("LD_LIBRARY_PATH="); X+ newpath = new_runpath + strlen(LD_LIBRARY_PATH "="); X X X /* X@@ -446,7 +480,7 @@ CreateExecutionEnvironment(int *_argcp, X X /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */ X X- sprintf(new_runpath, "LD_LIBRARY_PATH=" X+ sprintf(new_runpath, LD_LIBRARY_PATH "=" X "%s:" X "%s/lib/%s:" X "%s/../lib/%s", X@@ -977,6 +1011,7 @@ jboolean RemovableMachineDependentOption X /* Compute physical memory by asking the OS */ X uint64_t X physical_memory(void) { X+#ifdef _SC_PHYS_PAGES X const uint64_t pages = (uint64_t) sysconf(_SC_PHYS_PAGES); X const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE); X const uint64_t result = pages * page_size; X@@ -988,6 +1023,28 @@ physical_memory(void) { X " physical memory: " UINT64_FORMAT " (%.3fGB)\n", X pages, page_size, result, result / (double) GB); X } X+#else X+#ifdef HW_PHYSMEM64 X+ int64_t physmem; X+ int name[2] = { CTL_HW, HW_PHYSMEM64 }; X+#else X+ unsigned long physmem; X+ int name[2] = { CTL_HW, HW_PHYSMEM }; X+#endif X+ size_t physmem_len = sizeof(physmem); X+ uint64_t result; X+# define UINT64_FORMAT "%" PRIu64 X+ X+ if (sysctl(name, 2, &physmem, &physmem_len, NULL, 0) == -1) X+ physmem = 256 * MB; X+ X+ result = (uint64_t)physmem; X+ X+ if (_launcher_debug) { X+ printf("physical memory: " UINT64_FORMAT " (%.3fGB)\n", X+ result, result / (double) GB); X+ } X+#endif X return result; X } X X@@ -1083,7 +1140,7 @@ get_cpuid(uint32_t arg, X X #endif /* __sun && i586 */ X X-#if defined(__linux__) && defined(i586) X+#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(i586) X X /* X * A utility method for asking the CPU about itself. X@@ -1692,9 +1749,23 @@ UnsetEnv(char *name) X return(borrowed_unsetenv(name)); X } X X+#if defined(_ALLBSD_SOURCE) X+/* X+ * BSD's implementation of CounterGet() X+ */ X+int64_t X+CounterGet() X+{ X+ struct timeval tv; X+ gettimeofday(&tv, NULL); X+ return (tv.tv_sec * 1000) + tv.tv_usec; X+} X+#endif X+ X+ X /* --- Splash Screen shared library support --- */ X X-static const char* SPLASHSCREEN_SO = "libsplashscreen.so"; X+static const char* SPLASHSCREEN_SO = JNI_LIB_NAME("splashscreen"); X X static void* hSplashLib = NULL; X X@@ -1722,13 +1793,15 @@ jlong_format_specifier() { X return "%lld"; X } X X+ X+ X /* X * Block current thread and continue execution in a new thread X */ X int X-ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args, int ret) { X+ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) { X int rslt; X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X pthread_t tid; X pthread_attr_t attr; X pthread_attr_init(&attr); X@@ -1765,13 +1838,11 @@ ContinueInNewThread(int (JNICALL *contin X rslt = continuation(args); X } X #endif X- /* If the caller has deemed there is an error we X- * simply return that, otherwise we return the value of X- * the callee X- */ X- return (ret != 0) ? ret : rslt; X+ return rslt; X } X X+ X+ X /* Coarse estimation of number of digits assuming the worst case is a 64-bit pid. */ X #define MAX_PID_STR_SZ 20 X Xdiff -uNpr ../orig/jdk/src/solaris/bin/java_md.h ./jdk/src/solaris/bin/java_md.h X--- ../orig/jdk/src/solaris/bin/java_md.h 2009-04-24 03:34:32.000000000 -0400 X+++ ./jdk/src/solaris/bin/java_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -58,10 +58,14 @@ X #include <sys/time.h> X #define CounterGet() (gethrtime()/1000) X #define Counter2Micros(counts) (counts) X+#elif defined(_ALLBSD_SOURCE) X+/* CounterGet() is implemented in java_md.c */ X+int64_t CounterGet(void); X+#define Counter2Micros(counts) (counts) X #else X #define CounterGet() (0) X #define Counter2Micros(counts) (1) X-#endif /* HAVE_GETHRTIME */ X+#endif /* HAVE_GETHRTIME || _ALLBSD_SOURCE */ X X /* X * Function prototypes. Xdiff -uNpr ../orig/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java ./jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java X--- ../orig/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2009-05-14 23:41:34.000000000 -0400 X@@ -403,7 +403,7 @@ public class X11GraphicsEnvironment X if (fontID != null) { X fileName = (String)fontNameMap.get(fontID); X /* On Linux check for the Lucida Oblique fonts */ X- if (fileName == null && isLinux && !isOpenJDK()) { X+ if (fileName == null && isLinuxOrBSD && !isOpenJDK()) { X if (oblmap == null) { X initObliqueLucidaFontMap(); X } X@@ -639,7 +639,7 @@ public class X11GraphicsEnvironment X if (fontConfigDirs == null) { X return; X } X- if (isLinux) { X+ if (isLinuxOrBSD) { X fontConfigDirs.add(jreLibDirName+File.separator+"oblique-fonts"); X } X fontdirs = (String[])fontConfigDirs.toArray(new String[0]); Xdiff -uNpr ../orig/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java ./jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java X--- ../orig/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2009-05-14 23:41:34.000000000 -0400 X@@ -119,7 +119,11 @@ public class UnixPrintServiceLookup exte X } X X static boolean isBSD() { X- return osname.equals("Linux"); X+ return (osname.equals("Linux") || X+ osname.equals("FreeBSD") || X+ osname.equals("Darwin") || X+ osname.equals("NetBSD") || X+ osname.equals("OpenBSD")); X } X X static final int UNINITIALIZED = -1; Xdiff -uNpr ../orig/jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java ./jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java X--- ../orig/jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java 2009-05-14 23:41:34.000000000 -0400 X@@ -38,9 +38,6 @@ import java.util.Properties; X */ X public class BsdVirtualMachine extends HotSpotVirtualMachine { X X- // Indicates if this machine uses the old BsdThreads X- static boolean isBsdThreads; X- X // The patch to the socket file created by the target VM X String path; X X@@ -65,25 +62,10 @@ public class BsdVirtualMachine extends H X // Then we attempt to find the socket file again. X path = findSocketFile(pid); X if (path == null) { X- File f = createAttachFile(pid); X+ File f = new File("/tmp/.attach_pid" + pid); X+ createAttachFile(f.getPath()); X try { X- // On BsdThreads each thread is a process and we don't have the X- // pid of the VMThread which has SIGQUIT unblocked. To workaround X- // this we get the pid of the "manager thread" that is created X- // by the first call to pthread_create. This is parent of all X- // threads (except the initial thread). X- if (isBsdThreads) { X- int mpid; X- try { X- mpid = getBsdThreadsManager(pid); X- } catch (IOException x) { X- throw new AttachNotSupportedException(x.getMessage()); X- } X- assert(mpid >= 1); X- sendQuitToChildrenOf(mpid); X- } else { X- sendQuitTo(pid); X- } X+ sendQuitTo(pid); X X // give the target VM time to start the attach mechanism X int i = 0; X@@ -265,37 +247,14 @@ public class BsdVirtualMachine extends H X // First check for a .java_pid<pid> file in the working directory X // of the target process X String fn = ".java_pid" + pid; X- String path = "/proc/" + pid + "/cwd/" + fn; X+ String path = "/tmp/" + fn; X File f = new File(path); X if (!f.exists()) { X- // Not found, so try /tmp X- path = "/tmp/" + fn; X- f = new File(path); X- if (!f.exists()) { X- return null; // not found X- } X+ return null; // not found X } X return path; X } X X- // On Solaris/Bsd a simple handshake is used to start the attach mechanism X- // if not already started. The client creates a .attach_pid<pid> file in the X- // target VM's working directory (or /tmp), and the SIGQUIT handler checks X- // for the file. X- private File createAttachFile(int pid) throws IOException { X- String fn = ".attach_pid" + pid; X- String path = "/proc/" + pid + "/cwd/" + fn; X- File f = new File(path); X- try { X- f.createNewFile(); X- } catch (IOException x) { X- path = "/tmp/" + fn; X- f = new File(path); X- f.createNewFile(); X- } X- return f; X- } X- X /* X * Write/sends the given to the target VM. String is transmitted in X * UTF-8 encoding. X@@ -318,12 +277,6 @@ public class BsdVirtualMachine extends H X X //-- native methods X X- static native boolean isBsdThreads(); X- X- static native int getBsdThreadsManager(int pid) throws IOException; X- X- static native void sendQuitToChildrenOf(int pid) throws IOException; X- X static native void sendQuitTo(int pid) throws IOException; X X static native void checkPermissions(String path) throws IOException; X@@ -338,8 +291,9 @@ public class BsdVirtualMachine extends H X X static native void write(int fd, byte buf[], int off, int bufLen) throws IOException; X X+ static native void createAttachFile(String path); X+ X static { X System.loadLibrary("attach"); X- isBsdThreads = isBsdThreads(); X } X } Xdiff -uNpr ../orig/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c ./jdk/src/solaris/demo/jvmti/hprof/hprof_md.c X--- ../orig/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/demo/jvmti/hprof/hprof_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -33,7 +33,7 @@ X #include <sys/stat.h> X #include <fcntl.h> X X-#ifndef LINUX X+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) X #include <procfs.h> X #endif X X@@ -76,7 +76,7 @@ md_sleep(unsigned seconds) X void X md_init(void) X { X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X /* No Hi-Res timer option? */ X #else X if ( gdata->micro_state_accounting ) { X@@ -238,7 +238,7 @@ md_timeofday(void) X jlong X md_get_microsecs(void) X { X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X return (jlong)(md_timeofday() * (jlong)1000); /* Milli to micro */ X #else X return (jlong)(gethrtime()/(hrtime_t)1000); /* Nano seconds to micro seconds */ X@@ -256,7 +256,7 @@ md_get_timemillis(void) X jlong X md_get_thread_cpu_timemillis(void) X { X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X return md_timeofday(); X #else X return (jlong)(gethrvtime()/1000); /* Nano seconds to milli seconds */ X@@ -271,7 +271,7 @@ md_get_prelude_path(char *path, int path X Dl_info dlinfo; X X libdir[0] = 0; X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X addr = (void*)&Agent_OnLoad; X #else X /* Just using &Agent_OnLoad will get the first external symbol with Xdiff -uNpr ../orig/jdk/src/solaris/hpi/include/interrupt.h ./jdk/src/solaris/hpi/include/interrupt.h X--- ../orig/jdk/src/solaris/hpi/include/interrupt.h 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/hpi/include/interrupt.h 2009-05-14 23:41:34.000000000 -0400 X@@ -75,7 +75,7 @@ void intrDispatch(int interrupt, void *s X * N_INTERRUPTS - The number of interrupt channels. These X * are numbered from 0 to (N_INTERRUPTS - 1). X */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(__FreeBSD__) X #define N_INTERRUPTS NSIG /* 0 to NSIG - 1*/ X #else X #define N_INTERRUPTS 32 /* 0 to 31 */ X@@ -111,6 +111,10 @@ void intrInitMD(void); X #error signal.h has not been included? X #endif X X+#if defined(__FreeBSD__) && !defined(SA_SIGINFO) X+#error signal.h has not been included? X+#endif X+ X #ifdef SA_SIGINFO X /* Thread implementation dependent interrupt dispatcher. */ X void intrDispatchMD(int sig, siginfo_t *info, void *uc); Xdiff -uNpr ../orig/jdk/src/solaris/hpi/include/largefile.h ./jdk/src/solaris/hpi/include/largefile.h X--- ../orig/jdk/src/solaris/hpi/include/largefile.h 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/hpi/include/largefile.h 2009-05-14 23:41:34.000000000 -0400 X@@ -34,6 +34,10 @@ X #include "largefile_linux.h" X #endif X X+#ifdef _ALLBSD_SOURCE X+#include "largefile_bsd.h" X+#endif X+ X /* X * Prototypes for wrappers that we define. These wrapper functions X * are low-level I/O routines that will use 64 bit versions if Xdiff -uNpr ../orig/jdk/src/solaris/hpi/include/largefile_bsd.h ./jdk/src/solaris/hpi/include/largefile_bsd.h X--- ../orig/jdk/src/solaris/hpi/include/largefile_bsd.h 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/solaris/hpi/include/largefile_bsd.h 2009-05-14 23:41:34.000000000 -0400 X@@ -23,14 +23,28 @@ X * have any questions. X */ X X-#ifndef _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_ X-#define _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_ X- X-/* X- * For building on glibc-2.0 we need to define stat64 here. X- */ X+#ifndef _JAVASOFT_BSD_LARGEFILE_SUPPORT_H_ X+#define _JAVASOFT_BSD_LARGEFILE_SUPPORT_H_ X X #include <sys/types.h> X #include <sys/stat.h> X X-#endif /* _JAVASOFT_LINUX_LARGEFILE_SUPPORT_H_ */ X+/* define compatibility macros */ X+#define off64_t off_t X+#define stat64 stat X+ X+#define F_SETLK64 F_SETLK X+#define F_SETLKW64 F_SETLKW X+ X+#define lseek64 lseek X+#define ftruncate64 ftruncate X+#define open64 open X+#define fstat64 fstat X+#define flock64 flock X+#define mmap64 mmap X+#define fdatasync fsync X+ X+#define pread64 pread X+#define pwrite64 pwrite X+ X+#endif /* _JAVASOFT_BSD_LARGEFILE_SUPPORT_H_ */ Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/include/threads_md.h ./jdk/src/solaris/hpi/native_threads/include/threads_md.h X--- ../orig/jdk/src/solaris/hpi/native_threads/include/threads_md.h 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/include/threads_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -36,6 +36,8 @@ X #define N_TRACED_REGS 12 X #elif i386 X #define N_TRACED_REGS 7 X+#elif i586 /* BSDNOTE: just in case */ X+#define N_TRACED_REGS 7 X #elif amd64 X #define N_TRACED_REGS 15 X #elif ppc X@@ -51,10 +53,12 @@ X #define N_TRACED_REGS 32 X #endif X X+#if !defined(_ALLBSD_SOURCE) X /* Turn on if we want all java threads to be bound tolwps */ X /* #define BOUND_THREADS */ X /* Use /proc soln to stop lwps in place of siglwp soln */ X #define PROCLWP X+#endif X X /* X * Thread C stack overflow check X@@ -132,7 +136,7 @@ struct sys_thread { X lwpid_t lwpid; X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X void *sp; X #else X unsigned long sp; /* sp at time of last (native) thread switch */ X@@ -186,12 +190,14 @@ struct sys_thread { X X #define SYS_THREAD_NULL ((sys_thread_t *) 0) X X+#if !defined(_ALLBSD_SOURCE) X /* X * following macro copied from sys/signal.h since inside #ifdef _KERNEL there. X */ X #ifndef sigmask X #define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) X #endif X+#endif X X #ifdef __linux__ X extern thread_key_t intrJmpbufkey; Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/src/condvar_md.c ./jdk/src/solaris/hpi/native_threads/src/condvar_md.c X--- ../orig/jdk/src/solaris/hpi/native_threads/src/condvar_md.c 2009-04-24 03:34:33.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/src/condvar_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -58,7 +58,7 @@ condvarDestroy(condvar_t *condvar) X { X int err; X X-#ifdef __linux__ X+#ifdef USE_PTHREADS X err = pthread_cond_destroy((cond_t *) &condvar->cond); X #else X err = cond_destroy((cond_t *) condvar); Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/src/monitor_md.c ./jdk/src/solaris/hpi/native_threads/src/monitor_md.c X--- ../orig/jdk/src/solaris/hpi/native_threads/src/monitor_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/src/monitor_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -147,7 +147,7 @@ sysMonitorEnter(sys_thread_t *self, sys_ X mid->monitor_owner = self; X mid->entry_count = 1; X return SYS_OK; X- } else if (err == EBUSY) { /* it's already locked */ X+ } else if (err == EBUSY || err == EDEADLK) { /* it's already locked */ X if (mid->monitor_owner == self) { X mid->entry_count++; X return SYS_OK; Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c ./jdk/src/solaris/hpi/native_threads/src/sys_api_td.c X--- ../orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/src/sys_api_td.c 2009-05-14 23:41:34.000000000 -0400 X@@ -39,6 +39,10 @@ X #include <sys/ioctl.h> X #endif X X+#ifdef __OpenBSD__ X+#include <sys/ioctl.h> X+#endif X+ X #include <sys/socket.h> X #include <setjmp.h> X #include <signal.h> X@@ -57,6 +61,10 @@ X #error If there was no policy change, this could be a makefile error. X #endif X X+#if defined(_ALLBSD_SOURCE) && defined(NO_INTERRUPTIBLE_IO) X+#error If there was no policy change, this could be a makefile error. X+#endif X+ X #ifdef NO_INTERRUPTIBLE_IO X #undef CLOSEIO X #else Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c ./jdk/src/solaris/hpi/native_threads/src/threads_bsd.c X--- ../orig/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/src/threads_bsd.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,79 +23,44 @@ X * have any questions. X */ X X-/* X- * Implementation of HPI that can not be expressed with POSIX threads. X- * Note that even if you are building with USE_PTHREADS, we have to X- * explicitly undef it here because pthread.h and thread.h can not be X- * included in the same file, and this file needs only thread.h. X- */ X-#undef USE_PTHREADS X+#ifdef __APPLE__ X+ X+/* We need the mach API, which must be be included before any other system includes. X+ * Additionally, java and mach both define thread_state_t, so temporarily redefine it. */ X+#define thread_state_t mach_thread_state_t X+#include <mach/mach.h> X+#undef thread_state_t X+ X+#endif X X #include "hpi_impl.h" X #include "monitor_md.h" X #include "threads_md.h" X #include "np.h" X X-#include <thread.h> X-#include <sys/lwp.h> X+#include <sys/types.h> X+#include <sys/sysctl.h> X+ X+#include <pthread.h> X+#if defined(__FreeBSD__) || defined(__OpenBSD__) X+#include <pthread_np.h> X+#endif X+#ifdef __NetBSD__ X+#include <errno.h> X+#define pthread_attr_get_np(a, b) 0 X+#define pthread_suspend_all_np() 0 X+#define pthread_resume_all_np() 0 X+#endif X+ X+#include <time.h> X+#include <string.h> X #include <signal.h> X #include <sys/signal.h> X #include <sys/resource.h> X-#include <sys/procfs.h> X #include <stdlib.h> X #include <string.h> X-#include <fcntl.h> X #include <errno.h> X X-#include <sys/syscall.h> X-extern int syscall(int, ...); X- X- X-/* X- * Forward declarations. X- */ X-static int procfd; X-static void stop_lwps(); X-static void clear_onproc_flags(); X-static void restart_lwps(); X-static void MakeProcName(register char *procname, register pid_t pid); X-static void GC_msec_sleep(int n); X- X- X-/* X- * Make sure that we link against a verion of libthread that has at least X- * the bug fixes and the interface for getting the stack from threads that X- * aren't on LWPs. Otherwise we should exit with some informative message. X- */ X-extern ulong_t __gettsp(thread_t); X- X-static const char * gettspMessage = X-"You must install a Bsd patch to run the native threads version of the\n" X-"Java runtime. The green threads version will work without this patch.\n" X-"Please check the native threads release notes for more information.\n" X-"\n" X-"If you are embedding the VM in a native application, please make sure that\n" X-"the native application is linked with libthread.so (-lthread).\n" X-"\n" X-"Exiting.\n"; X- X-static void X-checkForCorrectLibthread() X-{ X- if (&__gettsp == 0) { X- fprintf(stderr, gettspMessage); X- exit(1); X- } X-} X-#ifdef __GNUC__ X-static void checkForCorrectLibthread() __attribute__((constructor)); X-#else X-#pragma init(checkForCorrectLibthread) X-#endif X- X-#pragma weak __gettsp X- X- X /* X * Suspend said thread. Used to implement java.lang.Thread.suspend(), X * which is deprecated. X@@ -103,10 +68,16 @@ static void checkForCorrectLibthread() _ X int X np_suspend(sys_thread_t *tid) X { X- return thr_suspend(tid->sys_thread); X+#ifdef __APPLE__ X+ if (thread_suspend(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS) X+ return SYS_OK; X+ else X+ return SYS_ERR; X+#else X+ return pthread_suspend_np(tid->sys_thread); X+#endif X } X X- X /* X * Resume a suspended thread. Used to implement java.lang.Thread.resume(), X * which is deprecated. X@@ -114,7 +85,14 @@ np_suspend(sys_thread_t *tid) X int X np_continue(sys_thread_t *tid) X { X- return thr_continue(tid->sys_thread); X+#ifdef __APPLE__ X+ if (thread_resume(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS) X+ return SYS_OK; X+ else X+ return SYS_ERR; X+#else X+ return pthread_resume_np(tid->sys_thread); X+#endif X } X X /* X@@ -127,26 +105,74 @@ void np_initialize_thread(sys_thread_t * X X X /* X+ * Internal helper function to get stack information about specified thread. X+ */ X+#ifdef __APPLE__ X+static int X+get_stackinfo(pthread_t tid, void **addr, long *sizep) X+{ X+ void *stacktop = pthread_get_stackaddr_np(tid); X+ *sizep = pthread_get_stacksize_np(tid); X+ *addr = stacktop - *sizep; X+ X+ return (SYS_OK); X+} X+#elif defined(__OpenBSD__) X+static int X+get_stackinfo(pthread_t tid, void **addr, long *sizep) X+{ X+ stack_t ss; X+ X+ if (pthread_stackseg_np(tid, &ss) == 0) { X+ *addr = (void *)(ss.ss_sp) - ss.ss_size; X+ *sizep = (long)(ss.ss_size); X+ return SYS_OK; X+ } else { X+ return SYS_ERR; /* pthreads_stackseg_np failed. */ X+ } X+} X+#else X+static int X+get_stackinfo(pthread_t tid, pthread_attr_t attr, void **addr, long *sizep) X+{ X+ size_t s; X+ void *p; X+ int ret = SYS_ERR; X+ X+ if (pthread_attr_get_np(tid, &attr) != 0) X+ goto err; X+ if (pthread_attr_getstackaddr(&attr, &p) != 0) X+ goto err; X+ if (pthread_attr_getstacksize(&attr, &s) != 0) X+ goto err; X+ *addr = p; X+ *sizep = s; X+ ret = SYS_OK; X+err: X+ X+ return (ret); X+} X+#endif X+ X+/* X * Get the stack start address, and max stack size for the current thread. X */ X int X np_stackinfo(void **addr, long *size) X { X- stack_t stkseg; X+#if defined(__OpenBSD__) || defined(__APPLE__) X+ return(get_stackinfo(pthread_self(), addr, size)); X+#else X+ pthread_attr_t attr; X+ int ret = SYS_ERR; X X- if (thr_stksegment(&stkseg) == 0) { X- *addr = (void *)(stkseg.ss_sp); X- if (thr_main()) { X- struct rlimit r; X- getrlimit(RLIMIT_STACK, &r); X- *size = (long)r.rlim_cur; X- } else { X- *size = (long)(stkseg.ss_size); X- } X- return SYS_OK; X- } else { X- return SYS_ERR; /* thr_stksegment failed. */ X+ if (pthread_attr_init(&attr) == 0) { X+ ret = get_stackinfo(pthread_self(), attr, addr, size); X+ pthread_attr_destroy(&attr); X } X+ X+ return (ret); X+#endif X } X X /* X@@ -155,309 +181,194 @@ np_stackinfo(void **addr, long *size) X void X np_profiler_init(sys_thread_t *tid) X { X- tid->lwp_id = _lwp_self(); X } X X int X np_profiler_suspend(sys_thread_t *tid) X { X- return _lwp_suspend(tid->lwp_id); X+ return np_suspend(tid); X } X X int X np_profiler_continue(sys_thread_t *tid) X { X- return _lwp_continue(tid->lwp_id); X+ return np_continue(tid); X } X X bool_t X np_profiler_thread_is_running(sys_thread_t *tid) X { X- unsigned long sum = 0; X- int i; X- prstatus_t lwpstatus; X- int lwpfd; X- int res; X- X- lwpfd = syscall(SYS_ioctl, procfd, PIOCOPENLWP, &(tid->lwp_id)); X- sysAssert(lwpfd >= 0); X- X- retry: X- res = syscall(SYS_ioctl, lwpfd, PIOCSTATUS, &lwpstatus); X- sysAssert(res >= 0); X- X- if (!(lwpstatus.pr_flags & PR_STOPPED)) { X- GC_msec_sleep(1); X- goto retry; X- } X- X- close(lwpfd); X- X-#if defined(sparc) X- sum += lwpstatus.pr_reg[R_SP]; X- sum += lwpstatus.pr_reg[R_PC]; X- X- sum += lwpstatus.pr_reg[R_G1]; X- sum += lwpstatus.pr_reg[R_G2]; X- sum += lwpstatus.pr_reg[R_G3]; X- sum += lwpstatus.pr_reg[R_G4]; X- X- sum += lwpstatus.pr_reg[R_O0]; X- sum += lwpstatus.pr_reg[R_O1]; X- sum += lwpstatus.pr_reg[R_O2]; X- sum += lwpstatus.pr_reg[R_O3]; X- sum += lwpstatus.pr_reg[R_O4]; X- sum += lwpstatus.pr_reg[R_O5]; X- X- sum += lwpstatus.pr_reg[R_I0]; X- sum += lwpstatus.pr_reg[R_I1]; X- sum += lwpstatus.pr_reg[R_I2]; X- sum += lwpstatus.pr_reg[R_I3]; X- sum += lwpstatus.pr_reg[R_I4]; X- sum += lwpstatus.pr_reg[R_I5]; X- sum += lwpstatus.pr_reg[R_I6]; X- sum += lwpstatus.pr_reg[R_I7]; X- X- sum += lwpstatus.pr_reg[R_L0]; X- sum += lwpstatus.pr_reg[R_L1]; X- sum += lwpstatus.pr_reg[R_L2]; X- sum += lwpstatus.pr_reg[R_L3]; X- sum += lwpstatus.pr_reg[R_L4]; X- sum += lwpstatus.pr_reg[R_L5]; X- sum += lwpstatus.pr_reg[R_L6]; X- sum += lwpstatus.pr_reg[R_L7]; X-#elif defined(amd64) X- sum += lwpstatus.pr_reg[REG_RIP]; X- sum += lwpstatus.pr_reg[REG_RSP]; X- X- sum += lwpstatus.pr_reg[REG_RAX]; X- sum += lwpstatus.pr_reg[REG_RCX]; X- sum += lwpstatus.pr_reg[REG_RDX]; X- sum += lwpstatus.pr_reg[REG_RBX]; X- sum += lwpstatus.pr_reg[REG_RBP]; X- sum += lwpstatus.pr_reg[REG_RSI]; X- sum += lwpstatus.pr_reg[REG_RDI]; X- X- sum += lwpstatus.pr_reg[REG_R8]; X- sum += lwpstatus.pr_reg[REG_R9]; X- sum += lwpstatus.pr_reg[REG_R10]; X- sum += lwpstatus.pr_reg[REG_R11]; X- sum += lwpstatus.pr_reg[REG_R12]; X- sum += lwpstatus.pr_reg[REG_R13]; X- sum += lwpstatus.pr_reg[REG_R14]; X- sum += lwpstatus.pr_reg[REG_R15]; X-#elif defined(i386) X- sum += lwpstatus.pr_reg[EIP]; X- sum += lwpstatus.pr_reg[UESP]; X- X- sum += lwpstatus.pr_reg[EAX]; X- sum += lwpstatus.pr_reg[ECX]; X- sum += lwpstatus.pr_reg[EDX]; X- sum += lwpstatus.pr_reg[EBX]; X- sum += lwpstatus.pr_reg[EBP]; X- sum += lwpstatus.pr_reg[ESI]; X- sum += lwpstatus.pr_reg[EDI]; X-#endif X- X- if (tid->last_sum == sum) { X- return FALSE; X- } X- tid->last_sum = sum; X- X return TRUE; X } X X X-/* X- * If building for Bsd native threads, open up the /proc file X- * descriptor to be used when doing GC. The open is done at JVM start-up so X- * as to reserve this fd, to prevent GC stall due to exhausted fds. This fd X- * will never be closed, and will alwyas be present. X- */ X int X np_initialize() X { X- char procname[32]; X- MakeProcName(procname, getpid()); X- if ((procfd = open(procname, O_RDONLY, 0)) < 0) { X- VM_CALL(jio_fprintf)(stderr, "Cannot open %s for GC", procname); X- return SYS_ERR; X- } X return SYS_OK; X } X X-static void X-MakeProcName(register char *procname, register pid_t pid) X-{ X- register char * s; X+/* prototypes */ X X- (void) strcpy(procname, "/proc/00000"); X- s = procname + strlen(procname); X- while (pid) { X- *--s = pid%10 + '0'; X- pid /= 10; X- } X-} X+static void record_thread_regs(); X X /* X * Suspend all other threads, and record their contexts (register X * set or stack pointer) into the sys_thread structure, so that a X * garbage collect can be run. X */ X+#ifdef __APPLE__ X int X np_single(void) X-{ X- int ret; X+{ X+ sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); X X+ /* Iterate over all the threads in the task, suspending each one. X+ * We have to loop until no new threads appear, and all are suspended */ X+ mach_port_t self = pthread_mach_thread_np(pthread_self()); X+ X+ X+ mach_msg_type_number_t cur_count, prev_count, i, j, k; X+ thread_act_array_t cur_list, prev_list; X+ bool_t changes; X+ X+ changes = TRUE; X+ cur_count = prev_count = 0; X+ cur_list = prev_list = NULL; X+ do { X+ /* Get a list of all threads */ X+ if (task_threads(self, &cur_list, &cur_count) != KERN_SUCCESS) X+ return SYS_ERR; X+ X+ /* For each thread, check if it was previously suspended. If it X+ * was not, suspend it now, and set the changes flag to 'true' */ X+ changes = FALSE; X+ for (i = 0; i < cur_count; i++) { X+ mach_msg_type_number_t j; X+ bool_t found = FALSE; X+ X+ /* Check the previous thread list */ X+ for (j = 0; j < prev_count; j++) { X+ if (prev_list[j] == cur_list[i]) { X+ found = TRUE; X+ break; X+ } X+ } X+ X+ /* If the thread wasn't previously suspended, suspend it now and set the change flag */ X+ if (found) { X+ /* Don't suspend ourselves! */ X+ if (cur_list[i] != self) X+ thread_suspend(cur_list[i]); X+ changes = TRUE; X+ } X+ } X+ X+ /* Deallocate the previous list, if necessary */ X+ for (k = 0; k < prev_count; k++) X+ mach_port_deallocate(self, prev_list[k]); X+ X+ vm_deallocate(self, (vm_address_t)prev_list, sizeof(thread_t) * prev_count); X+ X+ /* Set up the 'new' list for the next loop iteration */ X+ prev_list = cur_list; X+ prev_count = cur_count; X+ } while (changes); X+ X+ /* Deallocate the last-allocated list. */ X+ for (i = 0; i < prev_count; i++) X+ mach_port_deallocate(self, prev_list[i]); X+ X+ vm_deallocate(self, (vm_address_t)prev_list, sizeof(thread_t) * prev_count); X+ X+ /* Record registers and return */ X+ record_thread_regs(); X+ return SYS_OK; X+} X+#else X+int X+np_single(void) X+{ X sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); X X- stop_lwps(); X- ret = SYS_OK; X- return ret; X+ pthread_suspend_all_np(); X+ record_thread_regs(); X+ return SYS_OK; X } X+#endif X X /* X- * Continue threads suspended earlier. But clear their context X- * recorded in sys_thread structure first. X+ * Continue threads suspended earlier. X */ X+#ifdef __APPLE__ X void X np_multi(void) X { X sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); X- clear_onproc_flags(); X- restart_lwps(); X-} X X-/* /proc solution to stop and restrt lwps */ X-/* make sure gc is run as a bound thread */ X-/* make sure signals are turned off for gc thread */ X-/* what about new lwps getting created in the meantime? */ X- X-#define MAX_LWPS 1024 X- X-static prstatus_t Mystatus; X-static id_t lwpid_list_buf[MAX_LWPS]; X-static id_t oldlwpid_list_buf[MAX_LWPS]; X-static sys_thread_t *onproct_list_buf[MAX_LWPS]; X-static id_t *lwpid_list = lwpid_list_buf; X-static id_t *oldlwpid_list = oldlwpid_list_buf; X-static sys_thread_t **onproct_list = onproct_list_buf; X-static int lwpid_list_len; X-static int oldlwpid_list_len; X-static int onproct_ix = 0; X-static int gcprio; X-static sigset_t gcmask; X+ mach_msg_type_number_t thr_count, i; X+ thread_act_array_t thr_list; X+ mach_port_t self; X X-static void X-clear_onproc_flags() X-{ X- int i; X+ self = pthread_mach_thread_np(pthread_self()); X X- for (i = 0; i < onproct_ix; i++) { X- ((sys_thread_t *)(onproct_list[i]))->onproc = FALSE; X- } X- onproct_ix = 0; X-} X+ /* Get a list of all threads. This has to succeed! */ X+ if (task_threads(self, &thr_list, &thr_count) != KERN_SUCCESS) X+ abort(); X X+ /* Iterate over all the threads in the task, unsuspend, and deallocate */ X+ for (i = 0; i < thr_count; i++) { X+ // XXXDARWIN: Assumes that the current thread was the thread used X+ // to call np_single. Is that true? X X-/* Sleep for n milliseconds, n < 1000 */ X-static void X-GC_msec_sleep(int n) X-{ X- struct timespec ts; X+ if (thr_list[i] != self) X+ thread_resume(thr_list[i]); X X- ts.tv_sec = 0; X- ts.tv_nsec = 1000000*n; X- if (syscall(SYS_nanosleep, &ts, 0) < 0) { X- VM_CALL(jio_fprintf)(stderr, "%d\n", errno); X+ mach_port_deallocate(self, thr_list[i]); X } X+ X+ vm_deallocate(self, (vm_address_t) thr_list, sizeof(thread_t) * thr_count); X+} X+#else X+void X+np_multi(void) X+{ X+ sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); X+ pthread_resume_all_np(); X } X+#endif X X /* X+ * BSDNOTE: Looking to linux implementation -- the only important register X+ * to set up is tid->sp (stack pointer) now. But it may change when X+ * FreeBSD and JVM will switch to KSEs. In this case we'll also need to X+ * care about ucontext I think. X+ * X+ * --phantom X+ * X+ * XXXBSD: There's a problem with this implemenation. Currently it sets X+ * the tid->sp to the bottom of the thread stack and not the current stack X+ * pointer of the suspended thread. Both solaris and linux use the current X+ * thread stack pointer. -- kurt X+ * X * Assumes stacks grow down from high to low memory. True on sparc and Intel. X */ X-#define VALID_SP(sp, bottom, top) \ X- (((uintptr_t)(sp)) < ((uintptr_t)(bottom)) && ((uintptr_t)(sp)) > ((uintptr_t)(top))) X- X-static void X-record_lwp_regs(prstatus_t lwpstatus) X-{ X- sys_thread_t *tid; X- int i; X-#if defined(sparc) X- register uintptr_t sp = lwpstatus.pr_reg[R_SP]; X-#elif defined(amd64) X- register uintptr_t sp = lwpstatus.pr_reg[REG_RSP]; X-#elif defined(i386) X- register uintptr_t sp = lwpstatus.pr_reg[UESP]; X-#endif X- X- tid = ThreadQueue; X- for (i = 0; i < ActiveThreadCount && tid != 0; i++) { X- if (VALID_SP(sp, tid->stack_bottom, tid->stack_top)) { X- long *regs = tid->regs; X- tid->sp = sp; X- /* X- * The code below relies on N_TRACED_REGS being set X- * correctly for each platform. If you change the X- * number of registers being watched, you should update X- * the define for N_TRACED_REGS X- */ X-#if defined(sparc) X- regs[0] = lwpstatus.pr_reg[R_G1]; X- regs[1] = lwpstatus.pr_reg[R_G2]; X- regs[2] = lwpstatus.pr_reg[R_G3]; X- regs[3] = lwpstatus.pr_reg[R_G4]; X- X- regs[4] = lwpstatus.pr_reg[R_O0]; X- regs[5] = lwpstatus.pr_reg[R_O1]; X- regs[6] = lwpstatus.pr_reg[R_O2]; X- regs[7] = lwpstatus.pr_reg[R_O3]; X- regs[8] = lwpstatus.pr_reg[R_O4]; X- regs[9] = lwpstatus.pr_reg[R_O5]; X- regs[10] = lwpstatus.pr_reg[R_O6]; X- regs[11] = lwpstatus.pr_reg[R_O7]; X-#elif defined(amd64) X- regs[0] = lwpstatus.pr_reg[REG_RAX]; X- regs[1] = lwpstatus.pr_reg[REG_RCX]; X- regs[2] = lwpstatus.pr_reg[REG_RDX]; X- regs[3] = lwpstatus.pr_reg[REG_RBX]; X- regs[4] = lwpstatus.pr_reg[REG_RBP]; X- regs[5] = lwpstatus.pr_reg[REG_RSI]; X- regs[6] = lwpstatus.pr_reg[REG_RDI]; X- regs[7] = lwpstatus.pr_reg[REG_R8]; X- regs[8] = lwpstatus.pr_reg[REG_R9]; X- regs[9] = lwpstatus.pr_reg[REG_R10]; X- regs[10]= lwpstatus.pr_reg[REG_R11]; X- regs[11]= lwpstatus.pr_reg[REG_R12]; X- regs[12]= lwpstatus.pr_reg[REG_R13]; X- regs[13]= lwpstatus.pr_reg[REG_R14]; X- regs[14]= lwpstatus.pr_reg[REG_R15]; X-#elif defined(i386) X- regs[0] = lwpstatus.pr_reg[EAX]; X- regs[1] = lwpstatus.pr_reg[ECX]; X- regs[2] = lwpstatus.pr_reg[EDX]; X- regs[3] = lwpstatus.pr_reg[EBX]; X- regs[4] = lwpstatus.pr_reg[EBP]; X- regs[5] = lwpstatus.pr_reg[ESI]; X- regs[6] = lwpstatus.pr_reg[EDI]; X-#endif X- X- if (tid->onproc != TRUE) { X- tid->onproc = TRUE; X- onproct_list[onproct_ix++] = tid; X- } X- break; X- } X- tid = tid->next; X- } X-} X X static void X record_thread_regs() X { X+ void *addr; X+ long sz; X+ X sys_thread_t *tid; X int i; X+ int sp; X+ X+#ifndef __OpenBSD__ X+ pthread_attr_t attr; X+ int attr_inited; X+ attr_inited = pthread_attr_init(&attr) == 0; X+#endif X X tid = ThreadQueue; X for (i = 0; i < ActiveThreadCount && tid != 0; i++) { X@@ -466,7 +377,14 @@ record_thread_regs() X X if (tid->sys_thread != 0) { X /* if thread has already been initialized */ X- tid->sp = __gettsp(tid->sys_thread); X+#if defined(__OpenBSD__) || defined(__APPLE__) X+ if (get_stackinfo(tid->sys_thread, &addr, &sz) == SYS_OK) X+#else X+ if (get_stackinfo(tid->sys_thread, attr, &addr, &sz) == SYS_OK) X+#endif X+ tid->sp = addr; X+ else X+ tid->sp = 0; X } else { X /* X * thread is still in the process of being initalized. X@@ -475,192 +393,11 @@ record_thread_regs() X */ X tid->sp = 0; X } X- X- /* X- * Clear out the registers since they are no longer live X- * and we don't want to garbage collector to think they are. X- */ X- X- for (i = 0; i < N_TRACED_REGS; i++) X- tid->regs[i] = 0; X } X tid = tid->next; X } X-} X- X-static void X-wait_stopped_lwps(void) X-{ X- int i, lwpfd; X- prstatus_t lwpstatus; X- X- for (i = 0; i < (int) Mystatus.pr_nlwp; i++) { X- /* if its not me */ X- if (lwpid_list[i] != _lwp_self()) { X- X- /* open the lwp and check the status */ X- if ((lwpfd = syscall(SYS_ioctl, procfd, PIOCOPENLWP, X- &lwpid_list[i])) < 0) { X-#ifdef MY_DEBUG X- VM_CALL(jio_fprintf)(stderr, "lwpid %d was not found in process\n", X- lwpid_list[i]); X+#ifndef __OpenBSD__ X+ if (attr_inited) X+ pthread_attr_destroy(&attr); X #endif X- continue; X- } X- memset(&lwpstatus, 0, sizeof(lwpstatus)); X- while (1) { X- if (syscall(SYS_ioctl,lwpfd, PIOCSTATUS, &lwpstatus)<0) { X- sysAssert(0); X-#ifdef MY_DEBUG X- VM_CALL(jio_fprintf)(stderr, "PIOCSTATUS failed for lwp %d", X- lwpid_list[i]); X-#endif X- break; X- } X- if (lwpstatus.pr_flags & PR_STOPPED) { X- record_lwp_regs(lwpstatus); X- break; X- } X- GC_msec_sleep(1); X- } X- X- close (lwpfd); X- } /* end of if-me */ X- } /* end of for */ X-} X- X-static void X-suspend_lwps() X-{ X- int i; X- /* pioopen all the lwps and stop them - except the one I am running on */ X- for (i = 0; i < (int) Mystatus.pr_nlwp; i++) { X- X- /* open and stop the lwp if its not me */ X- if (lwpid_list[i] != _lwp_self()) { X- X- /* PIOCSTOP doesn't work without a writable */ X- /* descriptor. And that makes the process */ X- /* undebuggable. */ X- if (_lwp_suspend(lwpid_list[i]) < 0) { X- /* Could happen if the lwp exited */ X- lwpid_list[i] = _lwp_self(); X- continue; X- } X- } X- } X-} X- X-static void X-print_lwps() X-{ X-#ifdef MY_DEBUG X- /* print all the lwps in the process */ X- VM_CALL(jio_fprintf)(stdout, "lwpids "); X- for (i = 0; i < (int) Mystatus.pr_nlwp; i++) { X- if (i == 0) { X- VM_CALL(jio_fprintf)(stdout, "%d", lwpid_list[0]); X- } else if (i != Mystatus.pr_nlwp - 1) { X- VM_CALL(jio_fprintf)(stdout, ", %d", lwpid_list[i]); X- } else { X- VM_CALL(jio_fprintf)(stdout, " and %d", lwpid_list[i]); X- } X- } X-#endif X-} X- X-/* routine to iteratively stop all lwps */ X-static void X-stop_lwps() X-{ X- int i; X- sigset_t set; X- boolean_t changed; X- X- /* mask all signals */ X- (void) sigfillset(&set); X- syscall(SYS_sigprocmask, SIG_SETMASK, &set, &gcmask); X- X- /* run at highest prio so I cannot be preempted */ X- thr_getprio(thr_self(), &gcprio); X- thr_setprio(thr_self(), 2147483647); /* #define INT_MAX 2147483647 */ X- X- oldlwpid_list_len = 0; X- X- while(1) { X- changed = B_FALSE; X- X- /* Get the # of lwps in the process */ X- memset(&Mystatus, 0, sizeof(Mystatus)); X- syscall(SYS_ioctl, procfd, PIOCSTATUS, &Mystatus); X- X-#ifdef MY_DEBUG X- VM_CALL(jio_fprintf)(stdout, "Number of lwps in the process is %d\n", X- Mystatus.pr_nlwp); X- VM_CALL(jio_fprintf)(stdout, "My lwp id is %d\n", _lwp_self()); X-#endif X- lwpid_list_len = Mystatus.pr_nlwp; X- if (syscall(SYS_ioctl, procfd, PIOCLWPIDS, lwpid_list) == -1) { X-#ifdef MY_DEBUG X- VM_CALL(jio_fprintf)(stderr, "Can't read proc's lwpid list"); X-#endif X- return; X- } X- X- print_lwps(); X- X- /* suspend all the lwps */ X- suspend_lwps(); X- X- /* make sure all the lwps have actually stopped */ X- wait_stopped_lwps(); X- X- /* make sure the list has not changed while you were not looking X- else start all over again */ X- if (lwpid_list_len != oldlwpid_list_len) changed = B_TRUE; X- else { X- for (i=0; i<lwpid_list_len; ++i) { X- if (lwpid_list[i] != oldlwpid_list[i]) { X- changed = B_TRUE; break; X- } X- } X- } X- if (!changed) break; X- X- { X- id_t *tmplwpid_list = oldlwpid_list; X- oldlwpid_list = lwpid_list; oldlwpid_list_len = lwpid_list_len; X- lwpid_list = 0; lwpid_list_len = 0; X- lwpid_list = tmplwpid_list; X- } X- } X- X- /* record regs for threads that were not on LWPs */ X- record_thread_regs(); X- X- return; X-} X- X- X-/* Restart all lwps in process. */ X-static void X-restart_lwps() X-{ X- int i; X- X- for (i = 0; i < Mystatus.pr_nlwp; i++) { X- if (lwpid_list[i] == _lwp_self()) continue; X- if (_lwp_continue(lwpid_list[i]) < 0) { X-#ifdef MY_DEBUG X- VM_CALL(jio_fprintf)(stderr, "Failed to restart lwp %d\n",lwpid_list[i]); X-#endif X- } X- } X- X- /* restore the old priority of the thread */ X- thr_setprio(thr_self(), gcprio); X- /* restore the oldmask */ X- syscall(SYS_sigprocmask, SIG_SETMASK, &gcmask, NULL); X- X- print_lwps(); X } Xdiff -uNpr ../orig/jdk/src/solaris/hpi/native_threads/src/threads_md.c ./jdk/src/solaris/hpi/native_threads/src/threads_md.c X--- ../orig/jdk/src/solaris/hpi/native_threads/src/threads_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/native_threads/src/threads_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -54,6 +54,10 @@ extern int InitializeIO(rlim_t limit); X #error That can NOT possibly be right. X #endif X X+#if defined(_ALLBSD_SOURCE) && !defined(SA_SIGINFO) X+#error That can NOT possibly be right. X+#endif X+ X #ifdef SA_SIGINFO X static void sigusr1Handler(int sig, siginfo_t *info, void *uc); X #else X@@ -97,9 +101,14 @@ static thread_key_t tid_key = (thread_ke X #ifdef __linux__ X thread_key_t intrJmpbufkey; X static sigset_t squm = {{sigmask(SIGUSR1), 0, 0, 0}}; X+#elif defined(__OpenBSD__) X+thread_key_t sigusr1Jmpbufkey; X+sigset_t sigusr1Mask = sigmask(SIGUSR1); X+static sigset_t squm = sigmask(SIGUSR1); X #else X thread_key_t sigusr1Jmpbufkey; X sigset_t sigusr1Mask = {{sigmask(SIGUSR1), 0, 0, 0}}; X+static sigset_t squm = {{sigmask(SIGUSR1), 0, 0, 0}}; X #endif X X /* X@@ -170,9 +179,6 @@ sysThreadCheckStack() X } X } X X-#ifndef __linux__ X-static sigset_t squm = {{sigmask(SIGUSR1), 0, 0, 0}}; X-#endif X X X /* X@@ -187,7 +193,7 @@ sysThreadAlloc(sys_thread_t **tidP) X if (tid == NULL) { X return SYS_NOMEM; X } X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X memset((char *)tid, 0, sizeof(sys_thread_t)); X #endif X X@@ -474,7 +480,7 @@ sysThreadCreate(sys_thread_t **tidP, lon X } X *tidP = tid; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X memset((char *)tid, 0, sizeof(sys_thread_t)); X #endif X /* Install the backpointer to the Thread object */ X@@ -517,6 +523,7 @@ sysThreadCreate(sys_thread_t **tidP, lon X } X /* Create the thread. The thread will block waiting to be suspended */ X err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid); X+ pthread_attr_destroy(&attr); X sysAssert(err == 0); X if (err == 0) { X err = sem_wait(&tid->sem_suspended); X@@ -1049,7 +1056,18 @@ sysGetSysInfo() X * we want the number of processors configured not the number online X * since processors may be turned on and off dynamically. X */ X+#if defined(_SC_NPROCESSORS_CONF) X int cpus = (int) sysconf(_SC_NPROCESSORS_CONF); X+#elif defined(CTL_HW) && defined(HW_NCPU) X+ int cpus; X+ int name[2] = { CTL_HW, HW_NCPU }; X+ size_t cpus_len = sizeof(cpus); X+ X+ if (sysctl(name, 2, &cpus, &cpus_len, NULL, 0) == -1) X+ cpus = 1; X+#else X+ int cpus = 1; X+#endif X X info.isMP = (cpus < 0) ? 1 : (cpus > 1); X info.name = "native threads"; Xdiff -uNpr ../orig/jdk/src/solaris/hpi/src/linker_md.c ./jdk/src/solaris/hpi/src/linker_md.c X--- ../orig/jdk/src/solaris/hpi/src/linker_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/src/linker_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -44,11 +44,19 @@ X #include "threads_md.h" X #endif X X+#ifdef __APPLE__ X+#define LIB_SUFFIX "dylib" X+#else X+#define LIB_SUFFIX "so" X+#endif X+ X+#ifndef _ALLBSD_SOURCE X /* X * This lock protects the dl wrappers, assuring that two threads aren't X * in libdl at the same time. X */ X sys_mon_t _dl_lock; X+#endif X X /* X * glibc-2.0 libdl is not MT safe. If you are building with any glibc, X@@ -66,6 +74,14 @@ sys_mon_t _dl_lock; X #define NEED_DL_LOCK X #endif X X+#ifdef NEED_DL_LOCK X+/* X+ * This lock protects the dl wrappers, assuring that two threads aren't X+ * in libdl at the same time. X+ */ X+sys_mon_t _dl_lock; X+#endif X+ X /* X * create a string for the JNI native function name by adding the X * appropriate decorations. X@@ -95,14 +111,14 @@ sysBuildLibName(char *holder, int holder X } X X if (pnamelen == 0) { X- sprintf(holder, "lib%s.so", fname); X+ sprintf(holder, "lib%s." LIB_SUFFIX, fname); X } else { X- sprintf(holder, "%s/lib%s.so", pname, fname); X+ sprintf(holder, "%s/lib%s." LIB_SUFFIX, pname, fname); X } X } X X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X static int thr_main(void) X { X return -1; X@@ -120,10 +136,10 @@ sysLoadLibrary(const char *name, char *e X X #ifdef NEED_DL_LOCK X sysMonitorEnter(sysThreadSelf(), &_dl_lock); X- result = dlopen(name, RTLD_NOW); X+ result = dlopen(name, RTLD_NOW|RTLD_GLOBAL); X sysMonitorExit(sysThreadSelf(), &_dl_lock); X #else X- result = dlopen(name, RTLD_LAZY); X+ result = dlopen(name, RTLD_LAZY|RTLD_GLOBAL); X #endif X /* X * This is a bit of bulletproofing to catch the commonly occurring Xdiff -uNpr ../orig/jdk/src/solaris/hpi/src/memory_md.c ./jdk/src/solaris/hpi/src/memory_md.c X--- ../orig/jdk/src/solaris/hpi/src/memory_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/src/memory_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -50,12 +50,24 @@ X #include <stdlib.h> X #include <stdio.h> /* For perror() */ X #include <string.h> X+#if defined(_ALLBSD_SOURCE) X+#include <sys/param.h> X+#else X #include <malloc.h> X+#endif X X #include "hpi_impl.h" X X+#if defined(USE_MALLOC) && defined(_ALLBSD_SOURCE) X+#error "USE_MALLOC cannot be used for BSD" X+#endif X+ X #ifndef USE_MALLOC X X+#if defined(_ALLBSD_SOURCE) X+#define MAP_ANNONYMOUS MAP_ANON X+#endif X+ X #include <sys/mman.h> X #include <fcntl.h> X #ifdef __linux__ X@@ -73,6 +85,18 @@ static int devZeroFD; X #define MAP_FAILED ((caddr_t)-1) X #endif X static size_t memGrainSize; /* A page for Linux */ X+#elif defined(_ALLBSD_SOURCE) X+static size_t memGrainSize; /* A page for FreeBSD */ X+#if defined(__FreeBSD__) && (__FreeBSD_version >= 700013) X+static inline void * X+memalign(size_t alignment, size_t size) X+{ X+ void *ret; X+ return posix_memalign(&ret, alignment, size) ? NULL : ret; X+} X+#else /* ! __FreeBSD_version >= 700013 */ X+#define memalign(a, b) valloc(b) X+#endif X #else X static unsigned int memGrainSize; /* A page for Solaris */ X #endif X@@ -154,7 +178,7 @@ mapChunk(long length) X { X char *ret; X X-#if defined(__linux__) && defined(MAP_ANONYMOUS) X+#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(MAP_ANONYMOUS) X ret = (char *) mmap(0, length, PROT_ALL, X MAP_NORESERVE | MAP_PRIVATE | MAP_ANONYMOUS, X -1, (off_t) 0); X@@ -176,7 +200,7 @@ static char * X mapChunkReserve(char *addr, long length) X { X char *ret; X-#if defined(__linux__) && defined(MAP_ANONYMOUS) X+#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(MAP_ANONYMOUS) X ret = (char *) mmap(addr, length, PROT_ALL, X MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, X -1, (off_t) 0); X@@ -199,7 +223,7 @@ mapChunkNoreserve(char *addr, long lengt X { X char *ret; X X-#if defined(__linux__) && defined(MAP_ANONYMOUS) X+#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(MAP_ANONYMOUS) X ret = (char *) mmap(addr, length, PROT_ALL, X MAP_FIXED | MAP_PRIVATE | X MAP_NORESERVE | MAP_ANONYMOUS, X@@ -242,7 +266,7 @@ sysMapMem(size_t requestedSize, size_t * X *mappedSize = roundUpToGrain(requestedSize); X #ifdef USE_MALLOC X mappedAddr = (void *) sysMalloc(*mappedSize); /* Returns 0 on failure */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X if (mappedAddr) { X memset(mappedAddr, 0, *mappedSize); X mappedAddr = (void *) roundUpToGrain(mappedAddr); X@@ -331,7 +355,7 @@ sysCommitMem(void *requestedAddr, size_t X *committedSize = roundUpToGrain(requestedSize); X committedAddr = (void *) roundDownToGrain((long) requestedAddr); X #ifdef USE_MALLOC X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X ret = committedAddr; X #else X ret = requestedAddr; Xdiff -uNpr ../orig/jdk/src/solaris/hpi/src/system_md.c ./jdk/src/solaris/hpi/src/system_md.c X--- ../orig/jdk/src/solaris/hpi/src/system_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/hpi/src/system_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -41,6 +41,7 @@ X #include <dlfcn.h> X X #include "jni_md.h" X+#include "jvm_md.h" X #include "mutex_md.h" X X #include "hpi_init.h" X@@ -50,9 +51,6 @@ X #include "monitor_md.h" X #include "largefile.h" X X- X-#define O_DELETE 0x10000 X- X int sysThreadBootstrap(sys_thread_t **tidP, sys_mon_t **lockP, int nb) X { X threadBootstrapMD(tidP, lockP, nb); X@@ -85,7 +83,7 @@ sysGetMilliTicks() X { X struct timeval tv; X X- (void) gettimeofday(&tv, (void *) 0); X+ (void) gettimeofday(&tv, NULL); X return((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); X } X X@@ -93,7 +91,7 @@ jlong X sysTimeMillis() X { X struct timeval t; X- gettimeofday(&t, 0); X+ gettimeofday(&t, NULL); X return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000); X } X X@@ -122,13 +120,13 @@ sysGetLastErrorString(char *buf, int len X X /* X * Open a file. Unlink the file immediately after open returns X- * if the specified oflag has the O_DELETE flag set. X+ * if the specified oflag has the JVM_O_DELETE flag set. X */ X int sysOpen(const char *path, int oflag, int mode) X { X int fd; X- int delete = (oflag & O_DELETE); X- oflag = oflag & ~O_DELETE; X+ int delete = (oflag & JVM_O_DELETE); X+ oflag = oflag & ~JVM_O_DELETE; X fd = open64_w(path, oflag, mode); X if (delete != 0) { X unlink(path); Xdiff -uNpr ../orig/jdk/src/solaris/instrument/EncodingSupport_md.c ./jdk/src/solaris/instrument/EncodingSupport_md.c X--- ../orig/jdk/src/solaris/instrument/EncodingSupport_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/instrument/EncodingSupport_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -28,7 +28,10 @@ X #include <string.h> X #include <ctype.h> X #include <locale.h> X+#ifndef __OpenBSD__ X+#define HAVE_NL_LANGINFO X #include <langinfo.h> X+#endif X #include <iconv.h> X X /* Routines to convert back and forth between Platform Encoding and UTF-8 */ X@@ -63,6 +66,7 @@ utfInitialize(void) X /* Set the locale from the environment */ X (void)setlocale(LC_ALL, ""); X X+#ifdef HAVE_NL_LANGINFO X /* Get the codeset name */ X codeset = (char*)nl_langinfo(CODESET); X if ( codeset == NULL || codeset[0] == 0 ) { X@@ -77,6 +81,9 @@ utfInitialize(void) X UTF_DEBUG(("NO iconv() being used because it is not needed\n")); X return; X } X+#else X+ codeset = "ISO-8859-1"; X+#endif X X /* Open conversion descriptors */ X iconvToPlatform = iconv_open(codeset, "UTF-8"); Xdiff -uNpr ../orig/jdk/src/solaris/javavm/export/jvm_md.h ./jdk/src/solaris/javavm/export/jvm_md.h X--- ../orig/jdk/src/solaris/javavm/export/jvm_md.h 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/javavm/export/jvm_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -39,7 +39,14 @@ X #define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} X X #define JNI_LIB_PREFIX "lib" X+#ifdef __APPLE__ X+#define JNI_LIB_SUFFIX ".dylib" X+#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX X+#else X #define JNI_LIB_SUFFIX ".so" X+#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX "." VERSION X+#endif X+#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX X X #define JVM_MAXPATHLEN MAXPATHLEN X X@@ -66,7 +73,7 @@ X #define JVM_O_O_APPEND O_APPEND X #define JVM_O_EXCL O_EXCL X #define JVM_O_CREAT O_CREAT X-#define JVM_O_DELETE 0x10000 X+#define JVM_O_DELETE 0x10000000 X X /* Signals */ X Xdiff -uNpr ../orig/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c ./jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c X--- ../orig/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,10 +32,16 @@ X X #include <sys/types.h> X #include <sys/stat.h> X+#if defined(_ALLBSD_SOURCE) X+#include <sys/sysctl.h> X+#else X #include <sys/swap.h> X+#endif X #include <sys/resource.h> X #include <sys/times.h> X+#ifndef _ALLBSD_SOURCE X #include <sys/sysinfo.h> X+#endif X #include <ctype.h> X #include <dirent.h> X #include <errno.h> X@@ -46,16 +52,22 @@ X X static jlong page_size = 0; X X+#if defined(_ALLBSD_SOURCE) X+#define MB (1024UL * 1024UL) X+#else X+ X /* This gets us the new structured proc interfaces of 5.6 & later */ X /* - see comment in <sys/procfs.h> */ X #define _STRUCTURED_PROC 1 X #include <sys/procfs.h> X X+#endif /* _ALLBSD_SOURCE */ X+ X static struct dirent* read_dir(DIR* dirp, struct dirent* entry) { X #ifdef __solaris__ X struct dirent* dbuf = readdir(dirp); X return dbuf; X-#else /* __linux__ */ X+#else /* __linux__ || _ALLBSD_SOURCE */ X struct dirent* p; X if (readdir_r(dirp, entry, &p) == 0) { X return p; X@@ -124,7 +136,7 @@ static jlong get_total_or_available_swap X free(strtab); X return available ? ((jlong)avail * page_size) : X ((jlong)total * page_size); X-#else /* __linux__ */ X+#elif defined(__linux__) X int ret; X FILE *fp; X jlong total = 0, avail = 0; X@@ -138,6 +150,13 @@ static jlong get_total_or_available_swap X avail = (jlong)si.freeswap * si.mem_unit; X X return available ? avail : total; X+#else /* _ALLBSD_SOURCE */ X+ /* X+ * XXXBSD: there's no way available to get swap info in X+ * FreeBSD. Usage of libkvm is not an option here X+ */ X+ // throw_internal_error(env, "Unimplemented in FreeBSD"); X+ return (0); X #endif X } X X@@ -179,7 +198,7 @@ Java_com_sun_management_UnixOperatingSys X X JVM_Close(fd); X return (jlong) psinfo.pr_size * 1024; X-#else /* __linux__ */ X+#elif defined(__linux__) X FILE *fp; X unsigned long vsize = 0; X X@@ -197,6 +216,12 @@ Java_com_sun_management_UnixOperatingSys X X fclose(fp); X return (jlong)vsize; X+#else /* _ALLBSD_SOURCE */ X+ /* X+ * XXXBSD: there's no way available to do it in FreeBSD, AFAIK. X+ */ X+ // throw_internal_error(env, "Unimplemented in FreeBSD"); X+ return (64 * MB); X #endif X } X X@@ -222,9 +247,13 @@ Java_com_sun_management_UnixOperatingSys X jlong cpu_time_ns; X struct tms time; X X-#ifdef __solaris__ X+ /* X+ * BSDNOTE: FreeBSD implements _SC_CLK_TCK since FreeBSD 5, so X+ * add a magic to handle it X+ */ X+#if defined(__solaris__) || defined(_SC_CLK_TCK) X clk_tck = (jlong) sysconf(_SC_CLK_TCK); X-#else /* __linux__ */ X+#elif defined(__linux__) || defined(_ALLBSD_SOURCE) X clk_tck = 100; X #endif X if (clk_tck == -1) { X@@ -244,22 +273,51 @@ JNIEXPORT jlong JNICALL X Java_com_sun_management_UnixOperatingSystem_getFreePhysicalMemorySize X (JNIEnv *env, jobject mbean) X { X+#ifdef _ALLBSD_SOURCE X+ /* X+ * XXXBSD: there's no way available to do it in FreeBSD, AFAIK. X+ */ X+ // throw_internal_error(env, "Unimplemented in FreeBSD"); X+ return (128 * MB); X+#else X jlong num_avail_physical_pages = sysconf(_SC_AVPHYS_PAGES); X return (num_avail_physical_pages * page_size); X+#endif X } X X JNIEXPORT jlong JNICALL X Java_com_sun_management_UnixOperatingSystem_getTotalPhysicalMemorySize X (JNIEnv *env, jobject mbean) X { X+#ifdef _ALLBSD_SOURCE X+ jlong result; X+ int mib[2]; X+ int rlen; X+ X+ mib[0] = CTL_HW; X+ mib[1] = HW_PHYSMEM; X+ rlen = sizeof(result); X+ if (sysctl(mib, 2, &result, &rlen, NULL, 0) == -1) X+ result = 256 * MB; X+ X+ return (result); X+#else X jlong num_physical_pages = sysconf(_SC_PHYS_PAGES); X return (num_physical_pages * page_size); X+#endif X } X X JNIEXPORT jlong JNICALL X Java_com_sun_management_UnixOperatingSystem_getOpenFileDescriptorCount X (JNIEnv *env, jobject mbean) X { X+#ifdef _ALLBSD_SOURCE X+ /* X+ * XXXBSD: there's no way available to do it in FreeBSD, AFAIK. X+ */ X+ // throw_internal_error(env, "Unimplemented in FreeBSD"); X+ return (100); X+#else /* solaris/linux */ X DIR *dirp; X struct dirent dbuf; X struct dirent* dentp; X@@ -282,6 +340,7 @@ Java_com_sun_management_UnixOperatingSys X closedir(dirp); X // subtract by 1 which was the fd open for this implementation X return (fds - 1); X+#endif X } X X JNIEXPORT jlong JNICALL Xdiff -uNpr ../orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c ./jdk/src/solaris/native/java/io/UnixFileSystem_md.c X--- ../orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -41,6 +41,11 @@ X #include "java_io_FileSystem.h" X #include "java_io_UnixFileSystem.h" X X+#if defined(_ALLBSD_SOURCE) X+#define dirent64 dirent X+#define readdir64_r readdir_r X+#define stat64 stat X+#endif X X /* -- Field IDs -- */ X X@@ -58,7 +63,7 @@ Java_java_io_UnixFileSystem_initIDs(JNIE X "path", "Ljava/lang/String;"); X } X X- X+#ifndef _ALLBSD_SOURCE X /* -- Large-file support -- */ X X /* LINUX_FIXME: ifdef __solaris__ here is wrong. We need to move the X@@ -98,6 +103,7 @@ struct stat64 { X }; X X #endif /* !_LFS_LARGEFILE */ X+#endif /* !_ALLBSD_SOURCE */ X X typedef int (*STAT64)(const char *, struct stat64 *); X X@@ -107,6 +113,7 @@ static STAT64 stat64_ptr = &stat64; X static STAT64 stat64_ptr = NULL; X #endif X X+#ifndef _ALLBSD_SOURCE X #ifndef __linux__ X #ifdef __GNUC__ X static void init64IO(void) __attribute__((constructor)); X@@ -120,7 +127,7 @@ static void init64IO(void) { X stat64_ptr = (STAT64) dlsym(handle, "_stat64"); X dlclose(handle); X } X- X+#endif /* !_ALLBSD_SOURCE */ X X /* -- Path operations -- */ X X@@ -483,7 +490,7 @@ Java_java_io_UnixFileSystem_setLastModif X #endif X X /* Preserve access time */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X struct stat sb; X X if (stat(path, &sb) == 0) { Xdiff -uNpr ../orig/jdk/src/solaris/native/java/io/canonicalize_md.c ./jdk/src/solaris/native/java/io/canonicalize_md.c X--- ../orig/jdk/src/solaris/native/java/io/canonicalize_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/io/canonicalize_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -33,7 +33,9 @@ X #include <sys/stat.h> X #include <errno.h> X #include <limits.h> X+#if !defined(_ALLBSD_SOURCE) X #include <alloca.h> X+#endif X X X /* Note: The comments in this file use the terminology Xdiff -uNpr ../orig/jdk/src/solaris/native/java/io/io_util_md.c ./jdk/src/solaris/native/java/io/io_util_md.c X--- ../orig/jdk/src/solaris/native/java/io/io_util_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/io/io_util_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -36,7 +36,7 @@ fileOpen(JNIEnv *env, jobject this, jstr X WITH_PLATFORM_STRING(env, path, ps) { X FD fd; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /* Remove trailing slashes, since the kernel won't */ X char *p = (char *)ps + strlen(ps) - 1; X while ((p > ps) && (*p == '/')) Xdiff -uNpr ../orig/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c ./jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c X--- ../orig/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -28,6 +28,11 @@ X #include "jni.h" X #include "jni_util.h" X X+#ifdef __APPLE__ X+#include <crt_externs.h> X+#define environ (*_NSGetEnviron()) X+#endif X+ X JNIEXPORT jobjectArray JNICALL X Java_java_lang_ProcessEnvironment_environ(JNIEnv *env, jclass ign) X { X@@ -37,7 +42,9 @@ Java_java_lang_ProcessEnvironment_enviro X * no standard (not even de-facto) header file where the X * declaration is to be found. See: X * http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html */ X+#ifndef __APPLE__ X extern char ** environ; /* environ[i] looks like: VAR=VALUE\0 */ X+#endif X X jsize count = 0; X jsize i, j; X@@ -46,7 +53,7 @@ Java_java_lang_ProcessEnvironment_enviro X X for (i = 0; environ[i]; i++) { X /* Ignore corrupted environment variables */ X- if (strchr(environ[i], '=') != NULL) X+ if (strchr(environ[i], '=') != NULL && *environ[i] != '=') X count++; X } X X@@ -56,7 +63,7 @@ Java_java_lang_ProcessEnvironment_enviro X for (i = 0, j = 0; environ[i]; i++) { X const char * varEnd = strchr(environ[i], '='); X /* Ignore corrupted environment variables */ X- if (varEnd != NULL) { X+ if (varEnd != NULL && varEnd != environ[i]) { X jbyteArray var, val; X const char * valBeg = varEnd + 1; X jsize varLength = varEnd - environ[i]; Xdiff -uNpr ../orig/jdk/src/solaris/native/java/lang/UNIXProcess_md.c ./jdk/src/solaris/native/java/lang/UNIXProcess_md.c X--- ../orig/jdk/src/solaris/native/java/lang/UNIXProcess_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/lang/UNIXProcess_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -40,7 +40,11 @@ X #include <stdlib.h> X #include <sys/types.h> X #include <ctype.h> X+#ifdef _ALLBSD_SOURCE X+#include <sys/wait.h> X+#else X #include <wait.h> X+#endif X #include <signal.h> X #include <string.h> X #include <errno.h> X@@ -49,6 +53,17 @@ X #include <fcntl.h> X #include <limits.h> X X+#ifdef __FreeBSD__ X+#include <dlfcn.h> X+#include <pthread.h> X+#include <pthread_np.h> X+#endif X+ X+#ifdef __APPLE__ X+#include <crt_externs.h> X+#define environ (*_NSGetEnviron()) X+#endif X+ X #ifndef STDIN_FILENO X #define STDIN_FILENO 0 X #endif X@@ -259,11 +274,89 @@ Java_java_lang_UNIXProcess_waitForProces X } X } X X+#if defined(__FreeBSD__) X+ X+extern pid_t __sys_fork(void); X+ X+static pid_t X+jdk_fork_wrapper() X+{ X+ pid_t resultPid; X+ typedef void (*void_func)(); X+ static void_func func_defer = NULL; X+ static void_func func_undefer = NULL; X+ static int is_libc_r = -1; X+ X+ if (is_libc_r == -1) { X+ X+ /* X+ * BSDNOTE: Check for loaded symbols. X+ * X+ * If "_thread_kern_sig_defer" symbol is found assume we are X+ * libc_r X+ * X+ * If libc_r is loaded, use fork system call drectly to avoid X+ * problems with using protected pages. X+ * X+ * --phantom X+ */ X+ func_defer = X+ (void_func)dlsym(RTLD_DEFAULT, "_thread_kern_sig_defer"); X+ func_undefer = X+ (void_func)dlsym(RTLD_DEFAULT, "_thread_kern_sig_undefer"); X+ if (func_defer != NULL) X+ is_libc_r = 1; X+ else { X+ is_libc_r = 0; X+ } X+ } X+ X+ if (is_libc_r == 0) { X+ /* Not a libc_r */ X+ resultPid = fork(); X+ } else { X+ (*func_defer)(); /* call _thread_kern_sig_defer() */ X+ resultPid = __sys_fork(); X+ if (resultPid != 0) X+ (*func_undefer)(); /* call _thread_kern_sig_undefer() */ X+ /* leave child with signals disabled, but reenable in parent */ X+ } X+ X+ return resultPid; X+} X+#endif /* __FreeBSD__ */ X+ X+#if defined(__OpenBSD__) X+/* X+ * Directly call _thread_sys_closefrom() so the child process X+ * doesn't reset the parrent's file descriptors to be blocking. X+ * This function is only called from the child process which X+ * is single threaded and about to call execvp() so it is X+ * safe to bypass the threaded closefrom(). X+ */ X+int _thread_sys_closefrom(int); X+ X+static int X+closeDescriptors(void) X+{ X+ return _thread_sys_closefrom(FAIL_FILENO + 1); X+} X+ X+#else X+ X+#ifdef _ALLBSD_SOURCE X+#define FD_DIR "/dev/fd" X+#else X+#define dirent dirent64 X+#define readdir readdir64 X+#define FD_DIR "/proc/self/fd" X+#endif X+ X static int X closeDescriptors(void) X { X DIR *dp; X- struct dirent64 *dirp; X+ struct dirent *dirp; X int from_fd = FAIL_FILENO + 1; X X /* We're trying to close all file descriptors, but opendir() might X@@ -276,13 +369,13 @@ closeDescriptors(void) X close(from_fd); /* for possible use by opendir() */ X close(from_fd + 1); /* another one for good luck */ X X- if ((dp = opendir("/proc/self/fd")) == NULL) X+ if ((dp = opendir(FD_DIR)) == NULL) X return 0; X X /* We use readdir64 instead of readdir to work around Solaris bug X * 6395699: /proc/self/fd fails to report file descriptors >= 1024 on Solaris 9 X */ X- while ((dirp = readdir64(dp)) != NULL) { X+ while ((dirp = readdir(dp)) != NULL) { X int fd; X if (isdigit(dirp->d_name[0]) && X (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2) X@@ -293,6 +386,7 @@ closeDescriptors(void) X X return 1; X } X+#endif /* !__OpenBSD__ */ X X static void X moveDescriptor(int fd_from, int fd_to) X@@ -438,7 +532,9 @@ execvpe(const char *file, const char *co X * "All identifiers in this volume of IEEE Std 1003.1-2001, except X * environ, are defined in at least one of the headers" (!) X */ X+#ifndef __APPLE__ X extern char **environ; X+#endif X X if (envp != NULL) X environ = (char **) envp; X@@ -502,10 +598,15 @@ readFully(int fd, void *buf, size_t nbyt X } X } X X+#if defined(__FreeBSD__) X+#undef fork1 X+#define fork1() jdk_fork_wrapper() X+#else X #ifndef __solaris__ X #undef fork1 X #define fork1() fork() X #endif X+#endif X X JNIEXPORT jint JNICALL X Java_java_lang_UNIXProcess_forkAndExec(JNIEnv *env, X@@ -567,6 +668,30 @@ Java_java_lang_UNIXProcess_forkAndExec(J X if (resultPid == 0) { X /* Child process */ X X+ X+#ifdef __OpenBSD__ X+// XXXBSD: Work-around userland pthread implementation issue. X+// Closing file descriptors will reset them to be blocking. X+// This is problematic for the parent when it attemts to use X+// the blocking fd and deadlocks. Setting them to non-blocking X+// in the child prevents the close/dup2 from resetting them. X+ { X+ int flags; X+ flags = fcntl(STDIN_FILENO, F_GETFL, NULL); X+ if (flags != -1) X+ fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK); X+ X+ flags = fcntl(STDOUT_FILENO, F_GETFL, NULL); X+ if (flags != -1) X+ fcntl(STDOUT_FILENO, F_SETFL, flags | O_NONBLOCK); X+ X+ flags = fcntl(STDERR_FILENO, F_GETFL, NULL); X+ if (flags != -1) X+ fcntl(STDOUT_FILENO, F_SETFL, flags | O_NONBLOCK); X+ } X+#endif X+ X+ X /* Close the parent sides of the pipe. X Give the child sides of the pipes the right fileno's. X Closing pipe fds here is redundant, since closeDescriptors() Xdiff -uNpr ../orig/jdk/src/solaris/native/java/lang/java_props_md.c ./jdk/src/solaris/native/java/lang/java_props_md.c X--- ../orig/jdk/src/solaris/native/java/lang/java_props_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/lang/java_props_md.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 <stdio.h> X #include <ctype.h> X #endif X@@ -42,9 +42,17 @@ X #include <time.h> X #include <errno.h> X X+#if defined(_ALLBSD_SOURCE) X+#if !defined(P_tmpdir) X+#include <paths.h> X+#define P_tmpdir _PATH_VARTMP X+#endif X+#endif X+ X #include "locale_str.h" X #include "java_props.h" X X+#if !defined(_ALLBSD_SOURCE) X #ifdef __linux__ X #define CODESET _NL_CTYPE_CODESET_NAME X #else X@@ -52,6 +60,7 @@ X #define CODESET ALT_CODESET_KEY X #endif X #endif X+#endif /* !_ALLBSD_SOURCE */ X X /* Take an array of string pairs (map of key->value) and a string (key). X * Examine each pair in the map to see if the first string (key) matches the X@@ -188,7 +197,12 @@ GetJavaProperties(JNIEnv *env) X { X char *lc; X lc = setlocale(LC_CTYPE, ""); X-#ifndef __linux__ X+#if defined(_ALLBSD_SOURCE) X+ if (lc == NULL) { X+ lc = "C"; X+ } X+ { X+#elif !defined(__linux__) X if (lc == NULL) { X /* X * 'lc == null' means system doesn't support user's environment X@@ -219,7 +233,7 @@ GetJavaProperties(JNIEnv *env) X char *p, encoding_variant[64]; X int i, found; X X-#ifndef __linux__ X+#if !defined(__linux__) && !defined(_ALLBSD_SOURCE) X /* X * Workaround for Solaris bug 4201684: Xlib doesn't like @euro X * locales. Since we don't depend on the libc @euro behavior, X@@ -236,6 +250,13 @@ GetJavaProperties(JNIEnv *env) X *p = '\0'; X setlocale(LC_ALL, temp); X #endif X+ if (lc == NULL) { X+ strncpy(temp, "C", sizeof(temp)-1); X+ temp[sizeof(temp)-1] = '\0'; X+ } else { X+ strncpy(temp, lc, sizeof(temp)-1); X+ temp[sizeof(temp)-1] = '\0'; X+ } X X strcpy(temp, lc); X X@@ -316,6 +337,9 @@ GetJavaProperties(JNIEnv *env) X else X p = nl_langinfo(CODESET); X X+ if (p == NULL || !strcmp(p, "C") || !strcmp(p, "US-ASCII")) X+ p = ""; // use default X+ X /* Convert the bare "646" used on Solaris to a proper IANA name */ X if (strcmp(p, "646") == 0) X p = "ISO646-US"; X@@ -325,6 +349,7 @@ GetJavaProperties(JNIEnv *env) X std_encoding = (*p != '\0') ? p : "ISO8859-1"; X X X+#if !defined(_ALLBSD_SOURCE) X #ifdef __linux__ X /* X * Remap the encoding string to a different value for japanese X@@ -355,11 +380,19 @@ GetJavaProperties(JNIEnv *env) X std_encoding = "Big5_Solaris"; X } X #endif X+#endif /* !_ALLBSD_SOURCE */ X sprops.encoding = std_encoding; X sprops.sun_jnu_encoding = sprops.encoding; X } X } X X+#ifdef _ALLBSD_SOURCE X+#if BYTE_ORDER == _LITTLE_ENDIAN X+ sprops.unicode_encoding = "UnicodeLittle"; X+ #else X+ sprops.unicode_encoding = "UnicodeBig"; X+ #endif X+#else /* !_ALLBSD_SOURCE */ X #ifdef __linux__ X #if __BYTE_ORDER == __LITTLE_ENDIAN X sprops.unicode_encoding = "UnicodeLittle"; X@@ -369,6 +402,7 @@ GetJavaProperties(JNIEnv *env) X #else X sprops.unicode_encoding = "UnicodeBig"; X #endif X+#endif /* _ALLBSD_SOURCE */ X X /* user properties */ X { X@@ -405,12 +439,14 @@ GetJavaProperties(JNIEnv *env) X sprops.path_separator = ":"; X sprops.line_separator = "\n"; X X+#if !defined(_ALLBSD_SOURCE) X /* Append CDE message and resource search path to NLSPATH and X * XFILESEARCHPATH, in order to pick localized message for X * FileSelectionDialog window (Bug 4173641). X */ X setPathEnvironment("NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat"); X setPathEnvironment("XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt"); X+#endif X X return &sprops; X } Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c ./jdk/src/solaris/native/java/net/Inet4AddressImpl.c X--- ../orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -35,17 +35,293 @@ X #include <stdlib.h> X #include <ctype.h> X X+#ifdef _ALLBSD_SOURCE X+#include <unistd.h> X+#include <sys/param.h> X+#endif X+ X #include "jvm.h" X #include "jni_util.h" X #include "net_util.h" X X #include "java_net_Inet4AddressImpl.h" X X+#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104)) X+#define HAS_GLIBC_GETHOSTBY_R 1 X+#endif X+ X+#if defined(_ALLBSD_SOURCE) && !defined(HAS_GLIBC_GETHOSTBY_R) X+/* Use getaddrinfo(3), which is thread safe */ X+/************************************************************************ X+ * Inet4AddressImpl X+ */ X+ X+/* X+ * Class: java_net_Inet4AddressImpl X+ * Method: getLocalHostName X+ * Signature: ()Ljava/lang/String; X+ */ X+JNIEXPORT jstring JNICALL X+Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) { X+ char hostname[NI_MAXHOST+1]; X+ X+ hostname[0] = '\0'; X+ if (JVM_GetHostName(hostname, NI_MAXHOST)) { X+ /* Something went wrong, maybe networking is not setup? */ X+ strcpy(hostname, "localhost"); X+ } else { X+ struct addrinfo hints, *res; X+ int error; X+ X+ memset(&hints, 0, sizeof(hints)); X+ hints.ai_flags = AI_CANONNAME; X+ hints.ai_family = AF_UNSPEC; X+ X+ error = getaddrinfo(hostname, NULL, &hints, &res); X+ X+ if (error == 0) { X+ /* host is known to name service */ X+ error = getnameinfo(res->ai_addr, X+ res->ai_addrlen, X+ hostname, X+ NI_MAXHOST, X+ NULL, X+ 0, X+ NI_NAMEREQD); X+ X+ /* if getnameinfo fails hostname is still the value X+ from gethostname */ X+ X+ freeaddrinfo(res); X+ } X+ } X+ return (*env)->NewStringUTF(env, hostname); X+} X+ X+static jclass ni_iacls; X+static jclass ni_ia4cls; X+static jmethodID ni_ia4ctrID; X+static jfieldID ni_iaaddressID; X+static jfieldID ni_iahostID; X+static jfieldID ni_iafamilyID; X+static int initialized = 0; X+ X+/* X+ * Find an internet address for a given hostname. Note that this X+ * code only works for addresses of type INET. The translation X+ * of %d.%d.%d.%d to an address (int) occurs in java now, so the X+ * String "host" shouldn't *ever* be a %d.%d.%d.%d string X+ * X+ * Class: java_net_Inet4AddressImpl X+ * Method: lookupAllHostAddr X+ * Signature: (Ljava/lang/String;)[[B X+ */ X+ X+JNIEXPORT jobjectArray JNICALL X+Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, X+ jstring host) { X+ const char *hostname; X+ jobject name; X+ jobjectArray ret = 0; X+ int retLen = 0; X+ X+ int error=0; X+ struct addrinfo hints, *res, *resNew = NULL; X+ X+ if (!initialized) { X+ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress"); X+ ni_iacls = (*env)->NewGlobalRef(env, ni_iacls); X+ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address"); X+ ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls); X+ ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); X+ ni_iaaddressID = (*env)->GetFieldID(env, ni_iacls, "address", "I"); X+ ni_iafamilyID = (*env)->GetFieldID(env, ni_iacls, "family", "I"); X+ ni_iahostID = (*env)->GetFieldID(env, ni_iacls, "hostName", "Ljava/lang/String;"); X+ initialized = 1; X+ } X+ X+ if (IS_NULL(host)) { X+ JNU_ThrowNullPointerException(env, "host is null"); X+ return 0; X+ } X+ hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); X+ CHECK_NULL_RETURN(hostname, NULL); X+ X+ memset(&hints, 0, sizeof(hints)); X+ hints.ai_flags = AI_CANONNAME; X+ hints.ai_family = AF_INET; X+ X+ /* X+ * Workaround for Solaris bug 4160367 - if a hostname contains a X+ * white space then 0.0.0.0 is returned X+ */ X+ if (isspace(hostname[0])) { X+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", X+ (char *)hostname); X+ JNU_ReleaseStringPlatformChars(env, host, hostname); X+ return NULL; X+ } X+ X+ error = getaddrinfo(hostname, NULL, &hints, &res); X+ X+ if (error) { X+ /* report error */ X+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", X+ (char *)hostname); X+ JNU_ReleaseStringPlatformChars(env, host, hostname); X+ return NULL; X+ } else { X+ int i = 0; X+ struct addrinfo *itr, *last, *iterator = res; X+ while (iterator != NULL) { X+ int skip = 0; X+ itr = resNew; X+ X+ while (itr != NULL) { X+ struct sockaddr_in *addr1, *addr2; X+ X+ addr1 = (struct sockaddr_in *)iterator->ai_addr; X+ addr2 = (struct sockaddr_in *)itr->ai_addr; X+ if (addr1->sin_addr.s_addr == X+ addr2->sin_addr.s_addr) { X+ skip = 1; X+ break; X+ } X+ X+ itr = itr->ai_next; X+ } X+ X+ if (!skip) { X+ struct addrinfo *next X+ = (struct addrinfo*) malloc(sizeof(struct addrinfo)); X+ if (!next) { X+ JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); X+ ret = NULL; X+ goto cleanupAndReturn; X+ } X+ memcpy(next, iterator, sizeof(struct addrinfo)); X+ next->ai_next = NULL; X+ if (resNew == NULL) { X+ resNew = next; X+ } else { X+ last->ai_next = next; X+ } X+ last = next; X+ i++; X+ } X+ iterator = iterator->ai_next; X+ } X+ X+ retLen = i; X+ iterator = resNew; X+ i = 0; X+ X+ name = (*env)->NewStringUTF(env, hostname); X+ if (IS_NULL(name)) { X+ goto cleanupAndReturn; X+ } X+ X+ ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL); X+ if (IS_NULL(ret)) { X+ /* we may have memory to free at the end of this */ X+ goto cleanupAndReturn; X+ } X+ X+ while (iterator != NULL) { X+ /* We need 4 bytes to store ipv4 address; */ X+ int len = 4; X+ X+ jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); X+ if (IS_NULL(iaObj)) { X+ /* we may have memory to free at the end of this */ X+ ret = NULL; X+ goto cleanupAndReturn; X+ } X+ (*env)->SetIntField(env, iaObj, ni_iaaddressID, X+ ntohl(((struct sockaddr_in*)(iterator->ai_addr))->sin_addr.s_addr)); X+ (*env)->SetObjectField(env, iaObj, ni_iahostID, name); X+ (*env)->SetObjectArrayElement(env, ret, retLen - i -1, iaObj); X+ i++; X+ iterator = iterator->ai_next; X+ } X+ } X+ X+cleanupAndReturn: X+ { X+ struct addrinfo *iterator, *tmp; X+ iterator = resNew; X+ while (iterator != NULL) { X+ tmp = iterator; X+ iterator = iterator->ai_next; X+ free(tmp); X+ } X+ JNU_ReleaseStringPlatformChars(env, host, hostname); X+ } X+ X+ freeaddrinfo(res); X+ X+ return ret; X+ X+} X+ X+/* X+ * Class: java_net_Inet4AddressImpl X+ * Method: getHostByAddr X+ * Signature: (I)Ljava/lang/String; X+ */ X+JNIEXPORT jstring JNICALL X+Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, X+ jbyteArray addrArray) { X+ jstring ret = NULL; X+ X+ char host[NI_MAXHOST+1]; X+ jfieldID fid; X+ int error = 0; X+ jint family; X+ struct sockaddr *him ; X+ int len = 0; X+ jbyte caddr[4]; X+ jint addr; X+ X+ struct sockaddr_in him4; X+ struct sockaddr *sa; X+ X+ /* X+ * For IPv4 addresses construct a sockaddr_in structure. X+ */ X+ (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); X+ addr = ((caddr[0]<<24) & 0xff000000); X+ addr |= ((caddr[1] <<16) & 0xff0000); X+ addr |= ((caddr[2] <<8) & 0xff00); X+ addr |= (caddr[3] & 0xff); X+ memset((char *) &him4, 0, sizeof(him4)); X+ him4.sin_addr.s_addr = (uint32_t) htonl(addr); X+ him4.sin_family = AF_INET; X+ sa = (struct sockaddr *) &him4; X+ len = sizeof(him4); X+ X+ error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, X+ NI_NAMEREQD); X+ X+ if (!error) { X+ ret = (*env)->NewStringUTF(env, host); X+ } X+ X+ if (ret == NULL) { X+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL); X+ } X+ X+ return ret; X+ X+} X+ X+#else /* defined(_ALLBSD_SOURCE) && !defined(HAS_GLIBC_GETHOSTBY_R) */ X+ X /* the initial size of our hostent buffers */ X #define HENT_BUF_SIZE 1024 X #define BIG_HENT_BUF_SIZE 10240 /* a jumbo-sized one */ X X-#ifndef __GLIBC__ X+#if !defined(__GLIBC__) && !defined(_ALLBSD_SOURCE) X /* gethostname() is in libc.so but I can't find a header file for it */ X extern int gethostname(char *buf, int buf_len); X #endif X@@ -85,13 +361,13 @@ Java_java_net_Inet4AddressImpl_getLocalH X char buf2[HENT_BUF_SIZE]; X int h_error=0; X X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error); X #else X hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error); X #endif X if (hp) { X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET, X &res2, buf2, sizeof(buf2), &hp, &h_error); X #else X@@ -178,7 +454,7 @@ Java_java_net_Inet4AddressImpl_lookupAll X } X X /* Try once, with our static buffer. */ X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error); X #else X hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error); X@@ -191,7 +467,7 @@ Java_java_net_Inet4AddressImpl_lookupAll X */ X if (hp == NULL && errno == ERANGE) { X if ((tmp = (char*)malloc(BIG_HENT_BUF_SIZE))) { X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyname_r(hostname, &res, tmp, BIG_HENT_BUF_SIZE, X &hp, &h_error); X #else X@@ -281,7 +557,7 @@ Java_java_net_Inet4AddressImpl_getHostBy X addr |= ((caddr[2] <<8) & 0xff00); X addr |= (caddr[3] & 0xff); X addr = htonl(addr); X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent, X buf, sizeof(buf), &hp, &h_error); X #else X@@ -295,7 +571,7 @@ Java_java_net_Inet4AddressImpl_getHostBy X */ X if (hp == NULL && errno == ERANGE) { X if ((tmp = (char*)malloc(BIG_HENT_BUF_SIZE))) { X-#ifdef __GLIBC__ X+#ifdef HAS_GLIBC_GETHOSTBY_R X gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, X &hent, tmp, BIG_HENT_BUF_SIZE, &hp, &h_error); X #else X@@ -317,6 +593,8 @@ Java_java_net_Inet4AddressImpl_getHostBy X return ret; X } X X+#endif /* _ALLBSD_SOURCE */ X+ X #define SET_NONBLOCKING(fd) { \ X int flags = fcntl(fd, F_GETFL); \ X flags |= O_NONBLOCK; \ Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c ./jdk/src/solaris/native/java/net/Inet6AddressImpl.c X--- ../orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/Inet6AddressImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,6 +32,9 @@ X #include <strings.h> X #include <stdlib.h> X #include <ctype.h> X+#ifdef _ALLBSD_SOURCE X+#include <unistd.h> /* gethostname */ X+#endif X X #include "jvm.h" X #include "jni_util.h" X@@ -48,7 +51,7 @@ X #define NI_MAXHOST 1025 X #endif X X-#ifndef __GLIBC__ X+#if !defined(__GLIBC__) && !defined(_ALLBSD_SOURCE) X /* gethostname() is in libc.so but I can't find a header file for it */ X extern int gethostname(char *buf, int buf_len); X #endif X@@ -71,10 +74,18 @@ Java_java_net_Inet6AddressImpl_getLocalH X /* Something went wrong, maybe networking is not setup? */ X strcpy(hostname, "localhost"); X } else { X-#ifdef __linux__ X- /* On Linux gethostname() says "host.domain.sun.com". On X+#if defined(__linux__) && defined(_ALLBSD_SOURCE) X+ /* On Linux/FreeBSD gethostname() says "host.domain.sun.com". On X * Solaris gethostname() says "host", so extra work is needed. X */ X+ /* X+ * XXXBSD: Though on FreeBSD it's possible case then hostname does X+ * not contain '.' (depends on previous sethostname() call). Maybe X+ * we need to proceed with Solaris way, but using getnameinfo() X+ * in conjunction with gethostby*() breaks thread-safeness, so X+ * we need to protect all calls to gethostby*() and getnameinfo() X+ * using same mutex. X+ */ X #else X /* Solaris doesn't want to give us a fully qualified domain name. X * We do a reverse lookup to try and get one. This works X@@ -110,7 +121,7 @@ Java_java_net_Inet6AddressImpl_getLocalH X } X } X #endif /* AF_INET6 */ X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X } X return (*env)->NewStringUTF(env, hostname); X } Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/NetworkInterface.c ./jdk/src/solaris/native/java/net/NetworkInterface.c X--- ../orig/jdk/src/solaris/native/java/net/NetworkInterface.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/NetworkInterface.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,13 +23,13 @@ X * have any questions. X */ X X+#include <sys/types.h> X+#include <sys/socket.h> X #include <errno.h> X #include <strings.h> X #include <netinet/in.h> X #include <stdlib.h> X #include <string.h> X-#include <sys/types.h> X-#include <sys/socket.h> X #include <arpa/inet.h> X #include <net/if.h> X #include <net/if_arp.h> X@@ -47,6 +47,19 @@ X #else X #include <sys/sockio.h> X #endif X+#if defined(_ALLBSD_SOURCE) X+#include <sys/param.h> X+#include <sys/ioctl.h> X+#if defined(__FreeBSD__) || defined(__APPLE__) X+#include <net/ethernet.h> X+#include <net/if_var.h> X+#elif defined(__OpenBSD__) X+#include <netinet/if_ether.h> X+#endif X+#include <net/if_dl.h> X+#include <netinet/in_var.h> X+#include <ifaddrs.h> X+#endif X X #ifdef __linux__ X #define ifr_index ifr_ifindex X@@ -584,6 +597,7 @@ static netif *enumInterfaces(JNIEnv *env X } X X X+#if !defined(_ALLBSD_SOURCE) X /* X * Enumerates and returns all IPv4 interfaces X */ X@@ -694,6 +708,176 @@ static netif *enumIPv4Interfaces(JNIEnv X return ifs; X } X X+#else /* _ALLBSD_SOURCE */ X+ X+/* X+ * Enumerates and returns all IPv4 interfaces X+ * X+ * WARNING! Make sure that it's correctly synchronized on future JDK X+ * versions imports! X+ */ X+static netif *enumIPv4Interfaces(JNIEnv *env, netif *ifs) X+{ X+ int sock; X+ struct ifaddrs *ifa, *origifa; X+ X+ sock = JVM_Socket(AF_INET, SOCK_DGRAM, 0); X+ if (sock < 0) { X+ /* X+ * If EPROTONOSUPPORT is returned it means we don't have X+ * IPv4 support so don't throw an exception. X+ */ X+ if (errno != EPROTONOSUPPORT) { X+ NET_ThrowByNameWithLastError(env , JNU_JAVANETPKG "SocketException", X+ "Socket creation failed"); X+ } X+ return ifs; X+ } X+ X+ if (getifaddrs(&origifa) != 0) { X+ NET_ThrowByNameWithLastError(env , JNU_JAVANETPKG "SocketException", X+ "getifaddrs() function failed"); X+ close(sock); X+ return ifs; X+ } X+ X+ for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) { X+ X+ /* X+ * Skip non-AF_INET entries. X+ */ X+ if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET) X+ continue; X+ X+ /* X+ * Add to the list. X+ * X+ * BSDNOTE: in order to optimize code, interface index detection X+ * logic was added directly to addif(). X+ */ X+ ifs = addif(env, ifs, ifa->ifa_name, (-1), AF_INET, X+ ifa->ifa_addr, sizeof(struct sockaddr_in), 0); X+ X+ /* X+ * If an exception occurred then free the list. X+ */ X+ if ((*env)->ExceptionOccurred(env)) { X+ close(sock); X+ freeifaddrs(origifa); X+ freeif(ifs); X+ return NULL; X+ } X+ } X+ X+ /* X+ * Free socket and buffer X+ */ X+ close(sock); X+ freeifaddrs(origifa); X+ return ifs; X+} X+ X+#if defined(AF_INET6) X+/* X+ * Determines the prefix on BSD for IPv6 interfaces. X+ */ X+static X+int prefix(void *val, int size) { X+ u_char *name = (u_char *)val; X+ int byte, bit, plen = 0; X+ X+ for (byte = 0; byte < size; byte++, plen += 8) X+ if (name[byte] != 0xff) X+ break; X+ if (byte == size) X+ return (plen); X+ for (bit = 7; bit != 0; bit--, plen++) X+ if (!(name[byte] & (1 << bit))) X+ break; X+ for (; bit != 0; bit--) X+ if (name[byte] & (1 << bit)) X+ return (0); X+ byte++; X+ for (; byte < size; byte++) X+ if (name[byte]) X+ return (0); X+ return (plen); X+} X+ X+/* X+ * Enumerates and returns all IPv6 interfaces on FreeBSD X+ * X+ * BSDNOTE: it's done in same as IPv4 enumeration and should be carefully X+ * reviewed with each JDK update (according to Solaris/Linux version) X+ */ X+static netif *enumIPv6Interfaces(JNIEnv *env, netif *ifs) { X+ X+ int sock; X+ struct ifaddrs *ifa, *origifa; X+ struct sockaddr_in6 *sin6; X+ struct in6_ifreq ifr6; X+ X+ // Open IPv6 UDP socket. X+ sock = JVM_Socket(AF_INET6, SOCK_DGRAM, 0); X+ if (sock < 0) { X+ NET_ThrowByNameWithLastError(env , JNU_JAVANETPKG "SocketException", X+ "Failed to create IPv6 socket"); X+ return ifs; X+ } X+ X+ if (getifaddrs(&origifa) != 0) { X+ NET_ThrowByNameWithLastError(env , JNU_JAVANETPKG "SocketException", X+ "getifaddrs() function failed"); X+ close(sock); X+ return ifs; X+ } X+ X+ for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) { X+ X+ /* X+ * Skip non-AF_INET6 entries. X+ */ X+ if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET6) X+ continue; X+ X+ memset(&ifr6, 0, sizeof(ifr6)); X+ strlcpy(ifr6.ifr_name, ifa->ifa_name, sizeof(ifr6.ifr_name)); X+ memcpy(&ifr6.ifr_addr, ifa->ifa_addr, MIN(sizeof(ifr6.ifr_addr), ifa->ifa_addr->sa_len)); X+ X+ if (ioctl(sock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0) { X+ NET_ThrowByNameWithLastError(env , JNU_JAVANETPKG "SocketException", X+ "ioctl SIOCGIFNETMASK_IN6 failed"); X+ close(sock); X+ freeifaddrs(origifa); X+ freeif(ifs); X+ return NULL; X+ } X+ X+ /* Add to the list. */ X+ sin6 = (struct sockaddr_in6 *)&ifr6.ifr_addr; X+ ifs = addif(env, ifs, ifa->ifa_name, (-1), AF_INET6, X+ ifa->ifa_addr, sizeof(struct sockaddr_in6), X+ prefix(&sin6->sin6_addr, sizeof(struct in6_addr))); X+ X+ /* If an exception occurred then free the list. */ X+ if ((*env)->ExceptionOccurred(env)) { X+ close(sock); X+ freeifaddrs(origifa); X+ freeif(ifs); X+ return NULL; X+ } X+ } X+ X+ /* X+ * Free socket and ifaddrs buffer X+ */ X+ close(sock); X+ freeifaddrs(origifa); X+ return ifs; X+} X+#endif /* AF_INET6 */ X+ X+#endif /* !_ALLBSD_SOURCE */ X X #if defined(__solaris__) && defined(AF_INET6) X /* X@@ -1014,7 +1198,13 @@ netif *addif(JNIEnv *env, netif *ifs, ch X JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); X return ifs; X } X+#if defined(_ALLBSD_SOURCE) X+ currif->index = if_nametoindex(name); X+ if (currif->index == 0) X+ currif->index = -1; X+#else X currif->index = index; X+#endif X currif->addr = NULL; X currif->childs = NULL; X currif->virtual = isVirtual; X@@ -1302,6 +1492,31 @@ int getMacAddress(JNIEnv *env, const str X * All bytes to 0 means no hardware address. X */ X return -1; X+#elif defined(_ALLBSD_SOURCE) X+ struct ifaddrs *ifa0, *ifa; X+ struct sockaddr *saddr; X+ int i; X+ X+ /* Grab the interface list */ X+ if (!getifaddrs(&ifa0)) { X+ /* Cycle through the interfaces */ X+ for (i = 0, ifa = ifa0; ifa != NULL; ifa = ifa->ifa_next, i++) { X+ saddr = ifa->ifa_addr; X+ /* Link layer contains the MAC address */ X+ if (saddr->sa_family == AF_LINK && !strcmp(ifname, ifa->ifa_name)) { X+ struct sockaddr_dl *sadl = (struct sockaddr_dl *) saddr; X+ /* Check the address is the correct length */ X+ if (sadl->sdl_alen == ETHER_ADDR_LEN) { X+ memcpy(buf, (sadl->sdl_data + sadl->sdl_nlen), ETHER_ADDR_LEN); X+ freeifaddrs(ifa0); X+ return ETHER_ADDR_LEN; X+ } X+ } X+ } X+ freeifaddrs(ifa0); X+ } X+ X+ return -1; X #else X struct arpreq arpreq; X struct sockaddr_in* sin; X@@ -1467,7 +1682,7 @@ JNIEXPORT jint JNICALL Java_java_net_Net X "Socket creation failed"); X } else { X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X memset((char *) &if2, 0, sizeof(if2)); X strcpy(if2.ifr_name, name_utf); X Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c ./jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c X--- ../orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -23,12 +23,12 @@ X * have any questions. X */ X X+#include <sys/types.h> X+#include <sys/socket.h> X #include <errno.h> X #include <netinet/in.h> X #include <stdlib.h> X #include <string.h> X-#include <sys/types.h> X-#include <sys/socket.h> X X #ifdef __solaris__ X #include <fcntl.h> X@@ -335,7 +335,7 @@ Java_java_net_PlainDatagramSocketImpl_di X /* The fdObj'fd */ X jint fd; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X SOCKADDR addr; X int len; X #endif X@@ -345,26 +345,39 @@ Java_java_net_PlainDatagramSocketImpl_di X } X fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID); X X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #ifdef __linux__ X if (isOldKernel) { X int t = 1; X setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, (char*) &t, sizeof(int)); X } else { X+#endif /* __linux__ */ X memset(&addr, 0, sizeof(addr)); X #ifdef AF_INET6 X if (ipv6_available()) { X struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&addr; X+#ifdef __FreeBSD__ 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*)&addr; X+#ifdef __FreeBSD__ X+ him4->sin_family = AF_INET; X+#else X him4->sin_family = AF_UNSPEC; X+#endif X len = sizeof(struct sockaddr_in); X } X JVM_Connect(fd, (struct sockaddr *)&addr, len); X+ /* XXXBSD: here we can get EADDRNOTAVAIL which need to be ignored X+ but since return value is not checked, ignore it */ X X+#ifdef __linux__ X // After disconnecting a UDP socket, Linux kernel will set X // local port to zero if the port number comes from implicit X // bind. Successive send/recv on the same socket will fail. X@@ -387,6 +400,7 @@ Java_java_net_PlainDatagramSocketImpl_di X NET_Bind(fd, (struct sockaddr *)&addr, len); X } X } X+#endif X #else X JVM_Connect(fd, 0, 0); X #endif X@@ -2374,18 +2388,30 @@ static void mcast_join_leave(JNIEnv *env X mname6.ipv6mr_interface = idx; X } X X+#if defined(_ALLBSD_SOURCE) X+#define ADD_MEMBERSHIP IPV6_JOIN_GROUP X+#define DRP_MEMBERSHIP IPV6_LEAVE_GROUP X+#define S_ADD_MEMBERSHIP "IPV6_JOIN_GROUP" X+#define S_DRP_MEMBERSHIP "IPV6_LEAVE_GROUP" X+#else X+#define ADD_MEMBERSHIP IPV6_ADD_MEMBERSHIP X+#define DRP_MEMBERSHIP IPV6_DROP_MEMBERSHIP X+#define S_ADD_MEMBERSHIP "IPV6_ADD_MEMBERSHIP" X+#define S_DRP_MEMBERSHIP "IPV6_DROP_MEMBERSHIP" X+#endif X+ X /* Join the multicast group */ X- if (JVM_SetSockOpt(fd, IPPROTO_IPV6, (join ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP), X+ if (JVM_SetSockOpt(fd, IPPROTO_IPV6, (join ? ADD_MEMBERSHIP : DRP_MEMBERSHIP), X (char *) &mname6, sizeof (mname6)) < 0) { X X if (join) { X- NET_ThrowCurrent(env, "setsockopt IPV6_ADD_MEMBERSHIP failed"); X+ NET_ThrowCurrent(env, "setsockopt " S_ADD_MEMBERSHIP " failed"); X } else { X if (errno == ENOENT) { X JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", X "Not a member of the multicast group"); X } else { X- NET_ThrowCurrent(env, "setsockopt IPV6_DROP_MEMBERSHIP failed"); X+ NET_ThrowCurrent(env, "setsockopt " S_DRP_MEMBERSHIP " failed"); X } X } X } Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c ./jdk/src/solaris/native/java/net/PlainSocketImpl.c X--- ../orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/PlainSocketImpl.c 2009-05-14 23:41:34.000000000 -0400 X@@ -528,9 +528,11 @@ Java_java_net_PlainSocketImpl_socketConn X if (connect_rv == JVM_IO_INTR) { X JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException", X "operation interrupted"); X+#if defined(EPROTO) X } else if (errno == EPROTO) { X NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ProtocolException", X "Protocol error"); X+#endif X } else if (errno == ECONNREFUSED) { X NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException", X "Connection refused"); Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/bsd_close.c ./jdk/src/solaris/native/java/net/bsd_close.c X--- ../orig/jdk/src/solaris/native/java/net/bsd_close.c 2009-05-14 23:40:17.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/bsd_close.c 2009-05-14 23:41:34.000000000 -0400 X@@ -57,7 +57,7 @@ typedef struct { X /* X * Signal to unblock thread X */ X-static int sigWakeup = (__SIGRTMAX - 2); X+static int sigWakeup = SIGIO; X X /* X * The fd table and the number of file descriptors Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/net_util_md.c ./jdk/src/solaris/native/java/net/net_util_md.c X--- ../orig/jdk/src/solaris/native/java/net/net_util_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/net_util_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -34,6 +34,15 @@ X #include <stdlib.h> X #include <dlfcn.h> X X+#ifdef _ALLBSD_SOURCE X+#include <sys/param.h> X+#include <sys/sysctl.h> X+#endif X+ X+#ifdef __OpenBSD__ X+#include <sys/socketvar.h> X+#endif X+ X #ifdef __solaris__ X #include <sys/sockio.h> X #include <stropts.h> X@@ -219,6 +228,14 @@ NET_GetFileDescriptorID(JNIEnv *env) X return (*env)->GetFieldID(env, cls, "fd", "I"); X } X X+#if defined(DONT_ENABLE_IPV6) X+jint IPv6_supported() X+{ X+ return JNI_FALSE; X+} X+ X+#else /* !DONT_ENABLE_IPV6 */ X+ X jint IPv6_supported() X { X #ifndef AF_INET6 X@@ -355,6 +372,7 @@ jint IPv6_supported() X close(fd); X return JNI_TRUE; X } X+#endif /* DONT_ENABLE_IPV6 */ X X void X NET_AllocSockaddr(struct sockaddr **him, int *len) { X@@ -689,6 +707,10 @@ NET_InetAddressToSockaddr(JNIEnv *env, j X him6->sin6_family = AF_INET6; X *len = sizeof(struct sockaddr_in6) ; X X+#if defined(_ALLBSD_SOURCE) && defined(_AF_INET6) X+// XXXBSD: should we do something with scope id here ? see below linux comment X+#endif X+ X /* X * On Linux if we are connecting to a link-local address X * we need to specify the interface in the scope_id (2.4 kernel only) X@@ -1133,6 +1155,24 @@ NET_SetSockOpt(int fd, int level, int o X #define IPTOS_PREC_MASK 0xe0 X #endif X X+#if defined(_ALLBSD_SOURCE) X+#if defined(KIPC_MAXSOCKBUF) X+ int mib[3]; X+ size_t rlen; X+#endif X+ X+ int *bufsize; X+ X+#ifdef __APPLE__ X+ static int maxsockbuf = -1; X+#else X+ static long maxsockbuf = -1; X+#endif X+ X+ int addopt; X+ struct linger *ling; X+#endif X+ X /* X * IPPROTO/IP_TOS :- X * 1. IPv6 on Solaris: no-op and will be set in flowinfo X@@ -1165,6 +1205,10 @@ NET_SetSockOpt(int fd, int level, int o X *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK); X } X X+#if defined(AF_INET6) && defined(_ALLBSD_SOURCE) X+// XXXBSD: to be implemented ? X+#endif X+ X /* X * SOL_SOCKET/{SO_SNDBUF,SO_RCVBUF} - On Solaris need to X * ensure that value is <= max_buf as otherwise we get X@@ -1212,6 +1256,83 @@ NET_SetSockOpt(int fd, int level, int o X } X #endif X X+#if defined(_ALLBSD_SOURCE) X+ /* X+ * SOL_SOCKET/{SO_SNDBUF,SO_RCVBUF} - On FreeBSD need to X+ * ensure that value is <= kern.ipc.maxsockbuf as otherwise we get X+ * an ENOBUFS error. X+ */ X+ if (level == SOL_SOCKET) { X+ if (opt == SO_SNDBUF || opt == SO_RCVBUF) { X+#ifdef KIPC_MAXSOCKBUF X+ if (maxsockbuf == -1) { X+ mib[0] = CTL_KERN; X+ mib[1] = KERN_IPC; X+ mib[2] = KIPC_MAXSOCKBUF; X+ rlen = sizeof(maxsockbuf); X+ if (sysctl(mib, 3, &maxsockbuf, &rlen, NULL, 0) == -1) X+ maxsockbuf = 1024; X+ X+#if 1 X+ /* XXXBSD: This is a hack to workaround mb_max/mb_max_adj X+ problem. It should be removed when kern.ipc.maxsockbuf X+ will be real value. */ X+ maxsockbuf = (maxsockbuf/5)*4; X+#endif X+ } X+#elif defined(__OpenBSD__) X+ maxsockbuf = SB_MAX; X+#else X+ maxsockbuf = 64 * 1024; /* XXX: NetBSD */ X+#endif X+ X+ bufsize = (int *)arg; X+ if (*bufsize > maxsockbuf) { X+ *bufsize = maxsockbuf; X+ } X+ X+ if (opt == SO_RCVBUF && *bufsize < 1024) { X+ *bufsize = 1024; X+ } X+ X+ } X+ } X+ X+ /* X+ * On Solaris, SO_REUSEADDR will allow multiple datagram X+ * sockets to bind to the same port. The network jck tests X+ * for this "feature", so we need to emulate it by turning on X+ * SO_REUSEPORT as well for that combination. X+ */ X+ if (level == SOL_SOCKET && opt == SO_REUSEADDR) { X+ int sotype, arglen; X+ X+ arglen = sizeof(sotype); X+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) < 0) { X+ return -1; X+ } X+ X+ if (sotype == SOCK_DGRAM) { X+ addopt = SO_REUSEPORT; X+ setsockopt(fd, level, addopt, arg, len); X+ } X+ } X+ X+ /* X+ * Don't allow SO_LINGER value to be too big. X+ * Current max value (240) is empiric value based on tcp_timer.h's X+ * constant TCP_LINGERTIME, which was doubled. X+ * X+ * XXXBSD: maybe we should step it down to 120 ? X+ */ X+ if (level == SOL_SOCKET && opt == SO_LINGER) { X+ ling = (struct linger *)arg; X+ if (ling->l_linger > 240 || ling->l_linger < 0) { X+ ling->l_linger = 240; X+ } X+ } X+#endif X+ X return setsockopt(fd, level, opt, arg, len); X } X Xdiff -uNpr ../orig/jdk/src/solaris/native/java/net/net_util_md.h ./jdk/src/solaris/native/java/net/net_util_md.h X--- ../orig/jdk/src/solaris/native/java/net/net_util_md.h 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/net/net_util_md.h 2009-05-14 23:41:34.000000000 -0400 X@@ -37,7 +37,7 @@ X #endif X X X-#ifdef __linux__ X+#if defined(__linux__) || defined(__FreeBSD__) X extern int NET_Timeout(int s, long timeout); X extern int NET_Read(int s, void* buf, size_t len); X extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, Xdiff -uNpr ../orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c ./jdk/src/solaris/native/java/nio/MappedByteBuffer.c X--- ../orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/nio/MappedByteBuffer.c 2009-05-14 23:41:34.000000000 -0400 X@@ -38,7 +38,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0 X jlong address, jlong len) X { X jboolean loaded = JNI_TRUE; X+#if defined(_ALLBSD_SOURCE) X+ jint pageSize = getpagesize(); X+#else X jint pageSize = sysconf(_SC_PAGESIZE); X+#endif X jint numPages = (len + pageSize - 1) / pageSize; X int result = 0; X int i = 0; X@@ -92,7 +96,11 @@ JNIEXPORT void JNICALL X Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jlong address, X jlong len) X { X+#if defined(_ALLBSD_SOURCE) X+ jlong pageSize = getpagesize(); X+#else X jlong pageSize = sysconf(_SC_PAGESIZE); X+#endif X unsigned long lAddress = address; X X jlong offset = lAddress % pageSize; Xdiff -uNpr ../orig/jdk/src/solaris/native/java/util/FileSystemPreferences.c ./jdk/src/solaris/native/java/util/FileSystemPreferences.c X--- ../orig/jdk/src/solaris/native/java/util/FileSystemPreferences.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/util/FileSystemPreferences.c 2009-05-14 23:41:34.000000000 -0400 X@@ -47,8 +47,11 @@ Java_java_util_prefs_FileSystemPreferenc X return (jint) result; X } X X- X+#if defined(_ALLBSD_SOURCE) X+typedef struct flock FLOCK; X+#else X typedef struct flock64 FLOCK; X+#endif X X /** X * Try to open a named lock file. X@@ -86,7 +89,11 @@ Java_java_util_prefs_FileSystemPreferenc X if (fd < 0) { X result[0] = 0; X } else { X+#if defined(_ALLBSD_SOURCE) X+ rc = fcntl(fd, F_SETLK, &fl); X+#else X rc = fcntl(fd, F_SETLK64, &fl); X+#endif X result[1] = errno; X if (rc < 0) { X result[0]= 0; X@@ -116,7 +123,11 @@ Java_java_util_prefs_FileSystemPreferenc X fl.l_start = 0; X fl.l_type = F_UNLCK; X X+#if defined(_ALLBSD_SOURCE) X+ rc = fcntl(fd, F_SETLK, &fl); X+#else X rc = fcntl(fd, F_SETLK64, &fl); X+#endif X X if (rc < 0) { X close(fd); Xdiff -uNpr ../orig/jdk/src/solaris/native/java/util/TimeZone_md.c ./jdk/src/solaris/native/java/util/TimeZone_md.c X--- ../orig/jdk/src/solaris/native/java/util/TimeZone_md.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/java/util/TimeZone_md.c 2009-05-14 23:41:34.000000000 -0400 X@@ -31,7 +31,7 @@ X #include <errno.h> X #include <stddef.h> X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <string.h> X #include <dirent.h> X #include <sys/stat.h> X@@ -49,11 +49,14 @@ X #define fileclose fclose X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X X+#ifdef __linux__ X static const char *sysconfig_clock_file = "/etc/sysconfig/clock"; X+#endif X+ X static const char *zoneinfo_dir = "/usr/share/zoneinfo"; X-static const char *defailt_zoneinfo_file = "/etc/localtime"; X+static const char *default_zoneinfo_file = "/etc/localtime"; X X /* X * Returns a point to the zone ID portion of the given zoneinfo file X@@ -199,7 +202,9 @@ getPlatformTimeZoneID() X int fd; X char *buf; X size_t size; X+ char zoneinfo_file[PATH_MAX+1]; X X+#ifdef __linux__ X /* X * First, try the ZONE entry in /etc/sysconfig/clock. However, the X * ZONE entry is not set up after initial Red Hat Linux X@@ -254,14 +259,18 @@ getPlatformTimeZoneID() X return tz; X } X } X+#endif /* __linux__ */ X X /* X * Next, try /etc/localtime to find the zone ID. X */ X- if (lstat(defailt_zoneinfo_file, &statbuf) == -1) { X+ if (lstat(default_zoneinfo_file, &statbuf) == -1) { X return NULL; X } X X+ strlcpy(zoneinfo_file, default_zoneinfo_file, PATH_MAX+1); X+ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /* X * If it's a symlink, get the link name and its zone ID part. (The X * older versions of timeconfig created a symlink as described in X@@ -270,21 +279,25 @@ getPlatformTimeZoneID() X * from /etc/localtime.) X */ X if (S_ISLNK(statbuf.st_mode)) { X- char linkbuf[PATH_MAX+1]; X int len; X X- if ((len = readlink(defailt_zoneinfo_file, linkbuf, sizeof(linkbuf)-1)) == -1) { X+ if ((len = readlink(default_zoneinfo_file, zoneinfo_file, sizeof(zoneinfo_file)-1)) == -1) { X jio_fprintf(stderr, (const char *) "can't get a symlink of %s\n", X- defailt_zoneinfo_file); X+ default_zoneinfo_file); X return NULL; X } X- linkbuf[len] = '\0'; X- tz = getZoneName(linkbuf); X+ zoneinfo_file[len] = '\0'; X+ tz = getZoneName(zoneinfo_file); X if (tz != NULL) { X tz = strdup(tz); X+ return tz; X+ } else { X+ if (lstat(zoneinfo_file, &statbuf) == -1) { X+ return NULL; X+ } X } X- return tz; X } X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X /* X * If it's a regular file, we need to find out the same zoneinfo file X@@ -295,7 +308,7 @@ getPlatformTimeZoneID() X if (buf == NULL) { X return NULL; X } X- if ((fd = open(defailt_zoneinfo_file, O_RDONLY)) == -1) { X+ if ((fd = open(zoneinfo_file, O_RDONLY)) == -1) { X free((void *) buf); X return NULL; X } X@@ -524,7 +537,7 @@ findJavaTZ_md(const char *java_home_dir, X X tz = getenv("TZ"); X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X if (tz == NULL) { X #else X #ifdef __solaris__ X@@ -563,19 +576,32 @@ getGMTOffsetID() X { X time_t offset; X char sign, buf[16]; X+#if defined(_ALLBSD_SOURCE) X+ struct tm *local_tm; X+ time_t clock; X+ X+ clock = time(NULL); X+ tzset(); X+ local_tm = localtime(&clock); X+ if (local_tm->tm_gmtoff >= 0) { X+ offset = (time_t) local_tm->tm_gmtoff; X+ sign = '+'; X+ } else { X+ offset = (time_t) -local_tm->tm_gmtoff; X+ sign = '-'; X+ } X+#else X X if (timezone == 0) { X return strdup("GMT"); X- } X- X- /* Note that the time offset direction is opposite. */ X- if (timezone > 0) { X+ } else if (timezone > 0) { X offset = timezone; X sign = '-'; X } else { X offset = -timezone; X sign = '+'; X } X+#endif X sprintf(buf, (const char *)"GMT%c%02d:%02d", X sign, (int)(offset/3600), (int)((offset%3600)/60)); X return strdup(buf); Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/CUPSfuncs.c ./jdk/src/solaris/native/sun/awt/CUPSfuncs.c X--- ../orig/jdk/src/solaris/native/sun/awt/CUPSfuncs.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/CUPSfuncs.c 2009-05-14 23:41:34.000000000 -0400 X@@ -25,6 +25,7 @@ X X #include <jni.h> X #include <jni_util.h> X+#include <jvm_md.h> X #include <dlfcn.h> X #include <cups/cups.h> X #include <cups/ppd.h> X@@ -65,10 +66,11 @@ fn_ppdPageSize j2d_ppdPageSize; X JNIEXPORT jboolean JNICALL X Java_sun_print_CUPSPrinter_initIDs(JNIEnv *env, X jobject printObj) { X- void *handle = dlopen("libcups.so.2", RTLD_LAZY | RTLD_GLOBAL); X+ void *handle = dlopen(VERSIONED_JNI_LIB_NAME("cups", "2"), X+ RTLD_LAZY | RTLD_GLOBAL); X X if (handle == NULL) { X- handle = dlopen("libcups.so", RTLD_LAZY | RTLD_GLOBAL); X+ handle = dlopen(JNI_LIB_NAME("cups"), RTLD_LAZY | RTLD_GLOBAL); X if (handle == NULL) { X return JNI_FALSE; X } Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/VDrawingArea.c ./jdk/src/solaris/native/sun/awt/VDrawingArea.c X--- ../orig/jdk/src/solaris/native/sun/awt/VDrawingArea.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/VDrawingArea.c 2009-05-14 23:41:34.000000000 -0400 X@@ -31,7 +31,11 @@ X #endif /* !HEADLESS */ X X #include <stdio.h> X+#if defined(_ALLBSD_SOURCE) X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X X #ifdef __linux__ X /* XXX: Shouldn't be necessary. */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/X11Color.c ./jdk/src/solaris/native/sun/awt/X11Color.c X--- ../orig/jdk/src/solaris/native/sun/awt/X11Color.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/X11Color.c 2009-05-14 23:41:34.000000000 -0400 X@@ -33,7 +33,9 @@ X #include <math.h> X #include <sys/time.h> X #include <sys/resource.h> X+#if !defined(_ALLBSD_SOURCE) X #include <alloca.h> X+#endif X #ifndef HEADLESS X #include <X11/Xlib.h> X #include <X11/Xatom.h> Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/XDrawingArea.c ./jdk/src/solaris/native/sun/awt/XDrawingArea.c X--- ../orig/jdk/src/solaris/native/sun/awt/XDrawingArea.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/XDrawingArea.c 2009-05-14 23:41:34.000000000 -0400 X@@ -30,7 +30,11 @@ X #include <Xm/XmP.h> X X #include <stdio.h> X+#if defined(_ALLBSD_SOURCE) X+#include <stdlib.h> X+#else X #include <malloc.h> X+#endif X X #ifdef DEBUG X #include <jvm.h> /* To get jio_fprintf() */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_Font.c ./jdk/src/solaris/native/sun/awt/awt_Font.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_Font.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_Font.c 2009-05-14 23:41:34.000000000 -0400 X@@ -334,7 +334,7 @@ loadFont(Display * display, char *name, X if (strcmp(style, "regular") == 0) { X altstyle = "roman"; X } X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X if (!strcmp(family, "lucidasans")) { X family = "lucida"; X } Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c ./jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2009-05-14 23:41:34.000000000 -0400 X@@ -40,6 +40,7 @@ X #include <jni.h> X #include <jni_util.h> X #include <jvm.h> X+#include <jvm_md.h> X #include <jlong.h> X X #include <stdlib.h> X@@ -51,6 +52,8 @@ X #include <dlfcn.h> X #include "Trace.h" X X+#include "jvm_md.h" X+ X #ifdef NETSCAPE X #include <signal.h> X extern int awt_init_xt; X@@ -122,7 +125,7 @@ static char *x11GraphicsConfigClassName X */ X X #define MAXFRAMEBUFFERS 16 X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X typedef struct { X int screen_number; X short x_org; X@@ -631,19 +634,22 @@ void checkNewXineramaScreen(JNIEnv* env, X #endif /* HEADLESS */ X X #ifndef HEADLESS X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X static void xinerama_init_linux() X { X- void* libHandle = 0; X- char* XineramaLibName= "libXinerama.so.1"; X+ void* libHandle = NULL; X int32_t locNumScr = 0; X XineramaScreenInfo *xinInfo; X char* XineramaQueryScreensName = "XineramaQueryScreens"; X XineramaQueryScreensFunc* XineramaQueryScreens = NULL; X X /* load library */ X- libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL); X- if (libHandle != 0) { X+ libHandle = dlopen(VERSIONED_JNI_LIB_NAME("Xinerama", "1"), X+ RTLD_LAZY | RTLD_GLOBAL); X+ if (libHandle == NULL) { X+ libHandle = dlopen(JNI_LIB_NAME("Xinerama"), RTLD_LAZY | RTLD_GLOBAL); X+ } X+ if (libHandle != NULL) { X XineramaQueryScreens = (XineramaQueryScreensFunc*) X dlsym(libHandle, XineramaQueryScreensName); X X@@ -679,11 +685,10 @@ static void xinerama_init_linux() X } X } X #endif X-#ifndef __linux__ /* Solaris */ X+#if !defined(__linux__) && !defined(_ALLBSD_SOURCE) /* Solaris */ X static void xinerama_init_solaris() X { X- void* libHandle = 0; X- char* XineramaLibName= "libXext.so"; X+ void* libHandle = NULL; X unsigned char fbhints[MAXFRAMEBUFFERS]; X int32_t locNumScr = 0; X /* load and run XineramaGetInfo */ X@@ -692,8 +697,8 @@ static void xinerama_init_solaris() X XineramaGetInfoFunc* XineramaSolarisFunc = NULL; X X /* load library */ X- libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL); X- if (libHandle != 0) { X+ libHandle = dlopen(JNI_LIB_NAME("Xext"), RTLD_LAZY | RTLD_GLOBAL); X+ if (libHandle != NULL) { X XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName); X XineramaSolarisCenterFunc = X (XineramaGetCenterHintFunc*)dlsym(libHandle, XineramaGetCenterHintName); X@@ -740,11 +745,11 @@ static void xineramaInit(void) { X } X X DTRACE_PRINTLN("Xinerama extension is available"); X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X xinerama_init_linux(); X #else /* Solaris */ X xinerama_init_solaris(); X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X } X #endif /* HEADLESS */ X X@@ -1600,7 +1605,7 @@ Java_sun_awt_X11GraphicsEnvironment_getX X { X jobject point = NULL; X #ifndef HEADLESS /* return NULL in HEADLESS, Linux */ X-#ifndef __linux__ X+#if !defined(__linux__) && !defined(_ALLBSD_SOURCE) X int x,y; X X AWT_LOCK(); X@@ -1613,7 +1618,7 @@ Java_sun_awt_X11GraphicsEnvironment_getX X DTRACE_PRINTLN("unable to call XineramaSolarisCenterFunc: symbol is null"); X } X AWT_FLUSH_UNLOCK(); X-#endif /* __linux __ */ X+#endif /* __linux __ || _ALLBSD_SOURCE */ X #endif /* HEADLESS */ X return point; X } X@@ -1678,7 +1683,11 @@ X11GD_InitXrandrFuncs(JNIEnv *env) X { X int rr_maj_ver = 0, rr_min_ver = 0; X X- void *pLibRandR = dlopen("libXrandr.so.2", RTLD_LAZY | RTLD_LOCAL); X+ void *pLibRandR = dlopen(VERSIONED_JNI_LIB_NAME("Xrandr", "2"), X+ RTLD_LAZY | RTLD_LOCAL); X+ if (pLibRandR == NULL) { X+ pLibRandR = dlopen(JNI_LIB_NAME("Xrandr"), RTLD_LAZY | RTLD_LOCAL); X+ } X if (pLibRandR == NULL) { X J2dRlsTraceLn(J2D_TRACE_ERROR, X "X11GD_InitXrandrFuncs: Could not open libXrandr.so.2"); Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_InputMethod.c ./jdk/src/solaris/native/sun/awt/awt_InputMethod.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_InputMethod.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_InputMethod.c 2009-05-14 23:41:34.000000000 -0400 X@@ -69,7 +69,7 @@ static void PreeditDrawCallback(XIC, XPo X XIMPreeditDrawCallbackStruct *); X static void PreeditCaretCallback(XIC, XPointer, X XIMPreeditCaretCallbackStruct *); X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X static void StatusStartCallback(XIC, XPointer, XPointer); X static void StatusDoneCallback(XIC, XPointer, XPointer); X static void StatusDrawCallback(XIC, XPointer, X@@ -83,7 +83,7 @@ static void StatusDrawCallback(XIC, XPoi X #define PreeditDoneIndex 1 X #define PreeditDrawIndex 2 X #define PreeditCaretIndex 3 X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #define StatusStartIndex 4 X #define StatusDoneIndex 5 X #define StatusDrawIndex 6 X@@ -101,14 +101,14 @@ static XIMProc callback_funcs[NCALLBACKS X (XIMProc)PreeditDoneCallback, X (XIMProc)PreeditDrawCallback, X (XIMProc)PreeditCaretCallback, X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X (XIMProc)StatusStartCallback, X (XIMProc)StatusDoneCallback, X (XIMProc)StatusDrawCallback, X #endif X }; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #define MAX_STATUS_LEN 100 X typedef struct { X Window w; /*status window id */ X@@ -148,7 +148,7 @@ typedef struct _X11InputMethodData { X #endif /* XAWT */ X jobject x11inputmethod; /* global ref to X11InputMethod instance */ X /* associated with the XIC */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X StatusWindow *statusWindow; /* our own status window */ X #else X #ifndef XAWT X@@ -427,7 +427,7 @@ destroyX11InputMethodData(JNIEnv *env, X X static void X freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData) X { X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X if (pX11IMData->statusWindow != NULL){ X StatusWindow *sw = pX11IMData->statusWindow; X XFreeGC(awt_display, sw->lightGC); X@@ -533,7 +533,7 @@ awt_x11inputmethod_lookupString(XKeyPres X pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance); X X if (pX11IMData == NULL) { X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X return False; X #else X return result; X@@ -541,7 +541,7 @@ awt_x11inputmethod_lookupString(XKeyPres X } X X if ((ic = pX11IMData->current_ic) == (XIC)0){ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X return False; X #else X return result; X@@ -650,7 +650,7 @@ awt_x11inputmethod_lookupString(XKeyPres X return result; X } X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X static StatusWindow *createStatusWindow( X #ifdef XAWT X Window parent) { X@@ -994,7 +994,7 @@ void adjustStatusWindow(Widget shell){ X } X } X } X-#endif /*__linux__*/ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X /* X * Creates two XICs, one for active clients and the other for passive X * clients. All information on those XICs are stored in the X@@ -1051,7 +1051,7 @@ createXIC(Widget w, X11InputMethodData * X return FALSE ; X } X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X on_the_spot_styles |= XIMStatusNothing; X X /*kinput does not support XIMPreeditCallbacks and XIMStatusArea X@@ -1064,7 +1064,7 @@ createXIC(Widget w, X11InputMethodData * X break; X } X } X-#else /*! __linux__ */ X+#else /*! __linux__ && !_ALLBSD_SOURCE */ X #ifdef XAWT X on_the_spot_styles |= XIMStatusNothing; X #else /* !XAWT */ X@@ -1087,7 +1087,7 @@ createXIC(Widget w, X11InputMethodData * X on_the_spot_styles |= XIMStatusNothing; X X #endif /* XAWT */ X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X for (i = 0; i < im_styles->count_styles; i++) { X active_styles |= im_styles->supported_styles[i] & on_the_spot_styles; X@@ -1135,7 +1135,7 @@ createXIC(Widget w, X11InputMethodData * X NULL); X if (preedit == (XVaNestedList)NULL) X goto err; X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /*always try XIMStatusCallbacks for active client...*/ X { X status = (XVaNestedList)XVaCreateNestedList(0, X@@ -1157,7 +1157,7 @@ createXIC(Widget w, X11InputMethodData * X XFree((void *)status); X XFree((void *)preedit); X } X-#else /* !__linux__ */ X+#else /* !__linux__ && !_ALLBSD_SOURCE */ X #ifndef XAWT X if (on_the_spot_styles & XIMStatusArea) { X Widget parent; X@@ -1185,7 +1185,7 @@ createXIC(Widget w, X11InputMethodData * X } X #endif /* XAWT */ X XFree((void *)preedit); X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X pX11IMData->ic_passive = XCreateIC(X11im, X XNClientWindow, XtWindow(w), X XNFocusWindow, XtWindow(w), X@@ -1344,7 +1344,7 @@ PreeditCaretCallback(XIC ic, XPointer cl X X } X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X static void X StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data) X { X@@ -1412,7 +1412,7 @@ StatusDrawCallback(XIC ic, XPointer clie X finally: X AWT_UNLOCK(); X } X-#endif /*__linux__*/ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) { X JNIEnv *env = GetJNIEnv(); X@@ -1522,14 +1522,14 @@ Java_sun_awt_motif_MInputMethod_openXIMN X /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris X (4768335) X */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL, X NULL, (XIMProc)OpenXIMCallback, NULL); X if (!registered) { X /* directly call openXIM callback */ X #endif X OpenXIMCallback(dpy, NULL, NULL); X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X } X #endif X X@@ -1593,13 +1593,13 @@ Java_sun_awt_motif_MInputMethod_createXI X #endif /* XAWT */ X globalRef = (*env)->NewGlobalRef(env, this); X pX11IMData->x11inputmethod = globalRef; X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X pX11IMData->statusWindow = NULL; X-#else /* __linux__ */ X+#else /* !__linux__ && !_ALLBSD_SOURCE */ X #ifndef XAWT X pX11IMData->statusWidget = (Widget) NULL; X #endif /* XAWT */ X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X pX11IMData->lookup_buf = 0; X pX11IMData->lookup_buf_len = 0; X@@ -1746,14 +1746,14 @@ Java_sun_awt_X11_XInputMethod_setXICFocu X setXICFocus(pX11IMData->current_ic, req); X currentX11InputMethodInstance = pX11IMData->x11inputmethod; X currentFocusWindow = XtWindow(w); X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on) X onoffStatusWindow(pX11IMData, w, True); X #endif X } else { X currentX11InputMethodInstance = NULL; X currentFocusWindow = 0; X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X onoffStatusWindow(pX11IMData, 0, False); X if (pX11IMData->current_ic != NULL) X #endif X@@ -1770,7 +1770,7 @@ JNIEXPORT void JNICALL X Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env, X jobject this) X { X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X X11InputMethodData *pX11IMData; X StatusWindow *statusWindow; X X@@ -1867,7 +1867,7 @@ Java_sun_awt_motif_MInputMethod_configur X X11InputMethodData *pX11IMData; X XVaNestedList status; X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X /*do nothing for linux? */ X #else X AWT_LOCK(); X@@ -1973,7 +1973,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_ X JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow X (JNIEnv *env, jobject this, jlong window) X { X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X AWT_LOCK(); X adjustStatusWindow(window); X AWT_UNLOCK(); Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c ./jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c 2009-05-14 23:41:34.000000000 -0400 X@@ -260,7 +260,11 @@ AWT_OnLoad(JavaVM *vm, void *reserved) X } X } X X+#ifdef __APPLE__ X+ strcat(p, ".dylib"); X+#else X strcat(p, ".so"); X+#endif X X JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load", X "(Ljava/lang/String;)V", Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_MToolkit.c ./jdk/src/solaris/native/sun/awt/awt_MToolkit.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_MToolkit.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_MToolkit.c 2009-05-14 23:41:34.000000000 -0400 X@@ -63,8 +63,9 @@ X extern JavaVM *jvm; X X #ifndef HEADLESS X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X extern void statusWindowEventHandler(XEvent event); X+Boolean awt_dnd_process_event(XEvent* event); X #endif X #endif /* !HEADLESS */ X X@@ -1642,7 +1643,7 @@ processOneEvent(XtInputMask iMask) { X */ X Widget widget=XtWindowToWidget(awt_display, xev.xany.window); X eventNumber++; X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X statusWindowEventHandler(xev); X #endif X xembed_eventHandler(&xev); Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_Mlib.c ./jdk/src/solaris/native/sun/awt/awt_Mlib.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_Mlib.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_Mlib.c 2009-05-14 23:41:34.000000000 -0400 X@@ -32,6 +32,7 @@ X #include <dlfcn.h> X #include "jni.h" X #include <jni_util.h> X+#include "jvm_md.h" X #include "awt_Mlib.h" X #include "java_awt_image_BufferedImage.h" X X@@ -67,11 +68,11 @@ mlib_status awt_getImagingLib(JNIEnv *en X ((strncmp(name.machine, "sun4v" , 5) == 0) && X (getenv("USE_VIS_ON_SUN4V") != NULL))) X { X- handle = dlopen("libmlib_image_v.so", RTLD_LAZY); X+ handle = dlopen(JNI_LIB_NAME("mlib_image_v"), RTLD_LAZY); X } X X if (handle == NULL) { X- handle = dlopen("libmlib_image.so", RTLD_LAZY); X+ handle = dlopen(JNI_LIB_NAME("mlib_image"), RTLD_LAZY); X } X X if (handle == NULL) { Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_Robot.c ./jdk/src/solaris/native/sun/awt/awt_Robot.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_Robot.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_Robot.c 2009-05-14 23:41:34.000000000 -0400 X@@ -45,7 +45,7 @@ X #include "wsutils.h" X #include "list.h" X #include "multiVis.h" X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include <sys/socket.h> X #endif X Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_util.h ./jdk/src/solaris/native/sun/awt/awt_util.h X--- ../orig/jdk/src/solaris/native/sun/awt/awt_util.h 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_util.h 2009-05-14 23:41:34.000000000 -0400 X@@ -187,15 +187,20 @@ JNU_GetCharField(JNIEnv *env, jobject se X #ifdef __solaris__ X extern Widget awt_util_getXICStatusAreaWindow(Widget w); X #else X+#if defined(_ALLBSD_SOURCE) X+int32_t awt_util_getIMStatusHeight(Widget vw); X+Widget awt_util_getXICStatusAreaWindow(Widget w); X+#else X int32_t awt_util_getIMStatusHeight(Widget vw); X XVaNestedList awt_util_getXICStatusAreaList(Widget w); X Widget awt_util_getXICStatusAreaWindow(Widget w); X #endif X+#endif X X X X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X typedef struct _XmImRefRec { X Cardinal num_refs; /* Number of referencing widgets. */ X Cardinal max_refs; /* Maximum length of refs array. */ Xdiff -uNpr ../orig/jdk/src/solaris/native/sun/awt/awt_wm.c ./jdk/src/solaris/native/sun/awt/awt_wm.c X--- ../orig/jdk/src/solaris/native/sun/awt/awt_wm.c 2009-04-24 03:34:34.000000000 -0400 X+++ ./jdk/src/solaris/native/sun/awt/awt_wm.c 2009-05-14 23:41:34.000000000 -0400 X@@ -121,12 +121,19 @@ static Atom XA_KWM_WIN_ICONIFIED; X static Atom XA_KWM_WIN_MAXIMIZED; X X /* OpenLook */ X+static Atom _XA_OL_DECOR_ADD; X static Atom _XA_OL_DECOR_DEL; X static Atom _XA_OL_DECOR_HEADER; X static Atom _XA_OL_DECOR_RESIZE; X static Atom _XA_OL_DECOR_PIN; X static Atom _XA_OL_DECOR_CLOSE; X X+/* AfterStep */ X+static Atom _XA_AS_STYLE; X+ X+/* WindowMaker */ X+static Atom _XA_WINDOWMAKER_STATE; X+ X /* For _NET_WM_STATE ClientMessage requests */ X #define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ X #define _NET_WM_STATE_ADD 1 /* add/set property */ X@@ -193,7 +200,12 @@ awt_wm_initAtoms(void) X { &_XA_OL_DECOR_HEADER, "_OL_DECOR_HEADER" }, X { &_XA_OL_DECOR_RESIZE, "_OL_DECOR_RESIZE" }, X { &_XA_OL_DECOR_PIN, "_OL_DECOR_PIN" }, X- { &_XA_OL_DECOR_CLOSE, "_OL_DECOR_CLOSE" } X+ { &_XA_OL_DECOR_CLOSE, "_OL_DECOR_CLOSE" }, X+ { &_XA_OL_DECOR_ADD, "_OL_DECOR_ADD" }, X+ X+ { &_XA_AS_STYLE, "_XA_AS_STYLE" }, X+ X+ { &_XA_WINDOWMAKER_STATE, "_XA_WINDOWMAKER_STATE" } X }; X #define ATOM_LIST_LENGTH (sizeof(atom_list)/sizeof(atom_list[0])) X X@@ -942,6 +954,39 @@ awt_wm_isMotif(void) X return True; X } X X+/* X+ * Window Maker. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1Mhluh-000N20-4M>