# 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: # # icedtea6-plugin # icedtea6-plugin/files # icedtea6-plugin/files/patch-patches-hotspot-original-icedtea-6793825-includedb.patch # icedtea6-plugin/files/patch-patches-icedtea-headers.patch # icedtea6-plugin/files/patch-patches-ecj-icedtea-hotspot.patch # icedtea6-plugin/files/patch-patches-icedtea-libraries.patch # icedtea6-plugin/files/patch-patches-icedtea-nomotif-6706121.patch # icedtea6-plugin/files/patch-patches-icedtea-clean-crypto.patch # icedtea6-plugin/files/patch-patches-icedtea-linker-libs-order.patch # icedtea6-plugin/files/patch-patches-extensions-netx-umask.patch # icedtea6-plugin/files/patch-patches-xrender-icedtea-001.patch # icedtea6-plugin/files/patch-set-openjdk6 # icedtea6-plugin/files/patch-patches-xrender-icedtea-002.patch # icedtea6-plugin/files/patch-patches-zero-6890308.patch # icedtea6-plugin/Makefile # icedtea6-plugin/distinfo # icedtea6-plugin/pkg-descr # echo c - icedtea6-plugin mkdir -p icedtea6-plugin > /dev/null 2>&1 echo c - icedtea6-plugin/files mkdir -p icedtea6-plugin/files > /dev/null 2>&1 echo x - icedtea6-plugin/files/patch-patches-hotspot-original-icedtea-6793825-includedb.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-hotspot-original-icedtea-6793825-includedb.patch << '3ea0fc9053442fb6eb6e510a123d39fa' X--- patches/hotspot/original/icedtea-6793825-includedb.patch.orig 2010-07-09 13:42:43.000000000 +0000 X+++ patches/hotspot/original/icedtea-6793825-includedb.patch 2010-07-09 13:43:31.000000000 +0000 X@@ -43,17 +43,6 @@ X heapRegion.hpp spaceDecorator.hpp X heapRegion.hpp g1BlockOffsetTable.inline.hpp X heapRegion.hpp watermark.hpp X---- openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge.orig 2009-01-13 10:10:44.000000000 +0000 X-+++ openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge 2009-01-13 10:11:17.000000000 +0000 X-@@ -306,6 +306,8 @@ 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- X --- openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep.orig 2009-01-13 10:10:44.000000000 +0000 X +++ openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep 2009-01-13 10:11:17.000000000 +0000 X @@ -28,6 +28,7 @@ 3ea0fc9053442fb6eb6e510a123d39fa echo x - icedtea6-plugin/files/patch-patches-icedtea-headers.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-icedtea-headers.patch << '882e639497306047795cbf260b9e55f9' X--- patches/icedtea-headers.patch.orig 2010-07-08 19:41:50.000000000 +0000 X+++ patches/icedtea-headers.patch 2010-07-08 19:43:19.000000000 +0000 X@@ -1,14 +1,14 @@ X --- openjdkold/jdk/make/tools/freetypecheck/Makefile 2008-01-04 18:20:30.000000000 -0500 X +++ openjdk/jdk/make/tools/freetypecheck/Makefile 2008-02-26 11:21:34.000000000 -0500 X-@@ -61,7 +61,7 @@ X- ifeq ($(PLATFORM), solaris) X- FT_OPTIONS += -R $(FT_LIB) -lfreetype X- else #linux X-- FT_OPTIONS += -Wl,-rpath -Wl,$(FT_LIB) -lfreetype X-+ FT_OPTIONS += -Wl,-rpath -Wl,$(FT_LIB) $(FT2_LIB) X+@@ -64,7 +64,7 @@ X+ ifeq ($(PLATFORM), bsd) X+ FT_OPTIONS += -lfreetype -lz X+ else # linux X+- FT_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype X++ FT_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) $(FT2_LIB) X+ endif X endif X endif X- X --- openjdkold/jdk/make/common/Defs.gmk 2008-01-04 18:20:29.000000000 -0500 X +++ openjdk/jdk/make/common/Defs.gmk 2008-02-26 11:21:49.000000000 -0500 X @@ -237,7 +237,7 @@ 882e639497306047795cbf260b9e55f9 echo x - icedtea6-plugin/files/patch-patches-ecj-icedtea-hotspot.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-ecj-icedtea-hotspot.patch << '5ef66d3dda8714cd23998aad48bcfc71' X--- patches/ecj/icedtea-hotspot.patch.orig 2010-07-08 19:43:44.000000000 +0000 X+++ patches/ecj/icedtea-hotspot.patch 2010-07-08 19:45:41.000000000 +0000 X@@ -1,7 +1,7 @@ X diff -Nru openjdk-ecj.orig/hotspot/make/linux/Makefile openjdk-ecj/hotspot/make/linux/Makefile X --- openjdk-ecj.orig/hotspot/make/linux/Makefile 2008-10-24 10:16:06.000000000 +0100 X +++ openjdk-ecj/hotspot/make/linux/Makefile 2008-10-24 13:32:48.000000000 +0100 X-@@ -287,42 +287,36 @@ X+@@ -273,35 +273,30 @@ X X $(TARGETS_C2): $(SUBDIRS_C2) X cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) X@@ -37,13 +37,6 @@ X ifdef INSTALL X cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install X endif X- X- $(TARGETS_SHARK): $(SUBDIRS_SHARK) X- cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) X-- cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma X- ifdef INSTALL X- cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install X- endif X diff -Nru openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make openjdk-ecj/hotspot/make/linux/makefiles/sa.make X --- openjdk-ecj.orig/hotspot/make/linux/makefiles/sa.make 2008-10-24 10:16:06.000000000 +0100 X +++ openjdk-ecj/hotspot/make/linux/makefiles/sa.make 2008-10-24 13:32:48.000000000 +0100 5ef66d3dda8714cd23998aad48bcfc71 echo x - icedtea6-plugin/files/patch-patches-icedtea-libraries.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-icedtea-libraries.patch << '490be9364ddac7987b99af30224e3fbe' X--- patches/icedtea-libraries.patch.orig 2010-03-25 14:10:41.993588000 +0000 X+++ patches/icedtea-libraries.patch 2010-07-09 11:39:53.000000000 +0000 X@@ -64,72 +64,6 @@ X X #include "java_util_zip_CRC32.h" X X---- openjdk.old/jdk/make/common/Program.gmk 2007-10-12 03:54:05.000000000 -0400 X-+++ openjdk/jdk/make/common/Program.gmk 2007-10-22 13:26:06.000000000 -0400 X-@@ -85,7 +85,7 @@ X- endif X- endif X- ifeq ($(PLATFORM), linux) X-- LDFLAGS += -Wl,-z -Wl,origin X-+ LDFLAGS += -lz -Wl,-z -Wl,origin X- LDFLAGS += -Wl,--allow-shlib-undefined X- LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)/jli X- LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)/jli X-@@ -251,7 +251,6 @@ X- endif X- X- OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin X--OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X- X- # this may not be necessary... X- ifeq ($(PLATFORM), windows) X---- openjdk.old/jdk/make/java/zip/Makefile 2007-10-12 03:54:05.000000000 -0400 X-+++ openjdk/jdk/make/java/zip/Makefile 2007-10-22 13:27:01.000000000 -0400 X-@@ -30,8 +30,6 @@ X- PRODUCT = sun X- include $(BUILDDIR)/common/Defs.gmk X- X--ZLIB_VERSION = 1.1.3 X-- X- # X- # Files to compile. X- # X-@@ -72,16 +70,10 @@ 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- # X--# Add to ambient vpath so we pick up the library files X--# X--vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/zlib-$(ZLIB_VERSION) X-- X--# X- # Link to JVM library for JVM_Zip* functions X- # X--OTHER_LDLIBS = $(JVMLIB) X-+OTHER_LDLIBS = $(JVMLIB) -lz X---- openjdk.old/jdk/make/java/zip/FILES_c.gmk 2007-10-12 03:54:05.000000000 -0400 X-+++ openjdk/jdk/make/java/zip/FILES_c.gmk 2007-10-22 13:52:53.000000000 -0400 X-@@ -30,15 +30,4 @@ X- Inflater.c \ X- ZipFile.c \ X- ZipEntry.c \ X-- zadler32.c \ X-- zcrc32.c \ X-- deflate.c \ X-- trees.c \ X-- zutil.c \ X-- inflate.c \ X-- infblock.c \ X-- inftrees.c \ X-- infcodes.c \ X-- infutil.c \ X-- inffast.c \ X- zip_util.c X --- openjdk.old/jdk/src/share/native/java/util/zip/Inflater.c 2007-10-12 04:03:46.000000000 -0400 X +++ openjdk/jdk/src/share/native/java/util/zip/Inflater.c 2007-10-22 15:21:32.000000000 -0400 X @@ -35,7 +35,7 @@ X@@ -153,123 +87,6 @@ X X /* USE_MMAP means mmap the CEN & ENDHDR part of the zip file. */ X #ifdef USE_MMAP X---- openjdk.old/jdk/make/sun/splashscreen/FILES_c.gmk 2007-10-12 03:54:08.000000000 -0400 X-+++ openjdk/jdk/make/sun/splashscreen/FILES_c.gmk 2007-10-23 16:15:48.000000000 -0400 X-@@ -30,81 +30,5 @@ X- splashscreen_impl.c \ X- splashscreen_jpeg.c \ X- splashscreen_png.c \ X-- splashscreen_sys.c \ X-- png.c \ X-- pngerror.c \ X-- pngget.c \ X-- pngmem.c \ X-- pngpread.c \ X-- pngread.c \ X-- pngrio.c \ X-- pngrtran.c \ X-- pngrutil.c \ X-- pngset.c \ X-- pngtrans.c \ X-- pngwio.c \ X-- pngwrite.c \ X-- pngwtran.c \ X-- pngwutil.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-- jdcoefct.c \ X-- jdcolor.c \ X-- jddctmgr.c \ X-- jdhuff.c \ X-- jdinput.c \ X-- jdmainct.c \ X-- jdmarker.c \ X-- jdmaster.c \ X-- jdmerge.c \ X-- jdphuff.c \ X-- jdpostct.c \ X-- jdsample.c \ X-- jerror.c \ X-- jidctflt.c \ X-- jidctfst.c \ X-- jidctint.c \ X-- jidctred.c \ X-- jmemmgr.c \ X-- jmemnobs.c \ X-- jquant1.c \ X-- jquant2.c \ X-- jutils.c \ X-- jcapimin.c \ X-- jcapistd.c \ X-- jccoefct.c \ X-- jccolor.c \ X-- jcdctmgr.c \ X-- jchuff.c \ X-- jcinit.c \ X-- jcmainct.c \ X-- jcmarker.c \ X-- jcmaster.c \ X-- jcparam.c \ X-- jcphuff.c \ X-- jcprepct.c \ X-- jcsample.c \ X-- jctrans.c \ X-- jdtrans.c \ X-- jfdctflt.c \ X-- jfdctfst.c \ X-- jfdctint.c X-+ splashscreen_sys.c X- X---- openjdk.old/jdk/make/sun/splashscreen/Makefile 2007-10-12 03:54:08.000000000 -0400 X-+++ openjdk/jdk/make/sun/splashscreen/Makefile 2007-10-23 16:20:24.000000000 -0400 X-@@ -59,12 +59,12 @@ X- # C Flags X- # X- X--CFLAGS += -DSPLASHSCREEN X-+CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE 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-+ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext $(LIBM) -lpng -ljpeg -lgif -lz -lpthread X- else # PLATFORM X- CFLAGS += -DWITH_WIN32 X- OTHER_LDLIBS += kernel32.lib user32.lib gdi32.lib X-@@ -76,14 +76,10 @@ X- # 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--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 diff -ruN openjdk.old/jdk/make/sun/jpeg/FILES_c.gmk openjdk/jdk/make/sun/jpeg/FILES_c.gmk X --- openjdk.old/jdk/make/sun/jpeg/FILES_c.gmk 2007-10-12 03:54:08.000000000 -0400 X +++ openjdk/jdk/make/sun/jpeg/FILES_c.gmk 2007-10-23 17:13:59.000000000 -0400 X@@ -24630,125 +24447,6 @@ X } X X src = (stream_src_ptr) cinfo->src; X---- ../opienjdkb23/openjdk/jdk/make/com/sun/java/pack/Makefile 2007-10-30 04:39:48.000000000 -0400 X-+++ openjdk/jdk/make/com/sun/java/pack/Makefile 2007-11-13 16:47:23.000000000 -0500 X-@@ -64,23 +64,21 @@ X- ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME) X- X- ZIPOBJS = $(ZIPOBJDIR)/zcrc32.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/deflate.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/trees.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/zadler32.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/zutil.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/inflate.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/infblock.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/infcodes.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/inftrees.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/infutil.$(OBJECT_SUFFIX) \ X-- $(ZIPOBJDIR)/inffast.$(OBJECT_SUFFIX) X-- X-- ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 X-- OTHER_CXXFLAGS += $(ZINCLUDE) X-- LDDFLAGS += $(ZIPOBJS) X-+ $(ZIPOBJDIR)/deflate.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/trees.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/zadler32.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/zutil.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/inflate.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/infblock.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/infcodes.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/inftrees.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/infutil.$(OBJECT_SUFFIX) \ X-+ $(ZIPOBJDIR)/inffast.$(OBJECT_SUFFIX) X-+ X-+ OTHER_LDLIBS += -lz X- else X- OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI X-- OTHER_LDLIBS += $(JVMLIB) X-+ OTHER_LDLIBS += -lz $(JVMLIB) X- endif X- X- CXXFLAGS_DBG += -DFULL X-@@ -102,12 +100,12 @@ X- COMPILER_WARNINGS_FATAL=false X- else X- LDOUTPUT = -o #Have a space X-- LDDFLAGS += -lc X-+ LDDFLAGS += -lz -lc X- OTHER_LDLIBS += $(LIBCXX) X- # setup the list of libraries to link in... X- ifeq ($(PLATFORM), linux) X- ifeq ("$(CC_VER_MAJOR)", "3") X-- OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X-+ OTHER_LDLIBS += -lz -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X- endif X- endif #LINUX X- endif #PLATFORM X---- penjdk6/jdk/make/java/jli/Makefile 2008-02-12 04:03:55.000000000 -0500 X-+++ openjdk/jdk/make/java/jli/Makefile 2008-02-14 16:40:45.000000000 -0500 X-@@ -44,8 +44,6 @@ X- X- include $(BUILDDIR)/common/Defs.gmk X- X--ZLIB_VERSION = 1.1.3 X--ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) X- LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin X- LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin X- X-@@ -56,22 +54,14 @@ X- parse_manifest.c \ X- version_comp.c \ X- wildcard.c \ X-- jli_util.c \ X-- inflate.c \ X-- infblock.c \ X-- inftrees.c \ X-- infcodes.c \ X-- inffast.c \ X-- infutil.c \ X-- zadler32.c \ X-- zutil.c X-+ jli_util.c X- X- OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS X- X- ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems X- LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli X- # Guarantee very limited dependencies X-- LDLIBS = -lc X-+ LDLIBS = -lz -lc X- endif X- X- ifeq ($(PLATFORM), windows) X-@@ -98,7 +88,6 @@ X- X- OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC) X- OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC) X--OTHER_INCLUDES += -I$(ZIP_SRC) X- X- # X- # Library to compile. X-@@ -139,5 +128,5 @@ 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- X---- openjdk6/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2008-02-12 04:08:07.000000000 -0500 X-+++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2008-02-14 16:57:24.000000000 -0500 X-@@ -87,11 +87,7 @@ X- // bytes and byte arrays X- X- typedef unsigned int uint; X--#ifdef _LP64 X--typedef unsigned int uLong; // Historical zlib, should be 32-bit. X--#else X- typedef unsigned long uLong; X--#endif X- #ifdef _MSC_VER X- typedef LONGLONG jlong; X- typedef DWORDLONG julong; X --- openjdkold/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2008-02-12 04:08:13.000000000 -0500 X +++ openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2008-02-26 11:02:52.000000000 -0500 X @@ -51,7 +51,9 @@ X@@ -25564,3 +25262,182 @@ X X /* After finish_decompress, we can close the input file. X * Here we postpone it until after no more JPEG errors are possible, X+--- openjdk/jdk/make/com/sun/java/pack/Makefile.orig 2010-07-09 11:12:30.000000000 +0000 X++++ openjdk/jdk/make/com/sun/java/pack/Makefile 2010-07-09 11:17:14.000000000 +0000 X+@@ -116,7 +116,7 @@ X+ # setup the list of libraries to link in... X+ ifeq ($(PLATFORM), linux) X+ ifeq ("$(CC_VER_MAJOR)", "3") X+- OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X++ OTHER_LDLIBS += -lz -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X+ endif X+ endif #LINUX X+ endif #PLATFORM X+--- openjdk/jdk/make/common/Program.gmk.orig 2010-07-09 11:12:44.000000000 +0000 X++++ openjdk/jdk/make/common/Program.gmk 2010-07-09 11:15:31.000000000 +0000 X+@@ -101,7 +101,7 @@ X+ endif X+ endif X+ ifeq ($(PLATFORM), linux) X+- LDFLAGS += -Wl,-z -Wl,origin X++ LDFLAGS += -lz -Wl,-z -Wl,origin X+ LDFLAGS += -Wl,--allow-shlib-undefined X+ LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)/jli X+ LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)/jli X+--- openjdk/jdk/make/java/jli/Makefile.orig 2010-07-09 11:12:30.000000000 +0000 X++++ openjdk/jdk/make/java/jli/Makefile 2010-07-09 11:18:55.000000000 +0000 X+@@ -77,7 +77,7 @@ X+ ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems X+ LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli X+ # Guarantee very limited dependencies X+- LDLIBS = -lc X++ LDLIBS = -lz -lc X+ endif X+ X+ ifeq ($(PLATFORM), windows) X+@@ -128,7 +128,7 @@ X+ # in Library.gmk. The additional rules which follow build the standard X+ # library. X+ # X+-ifeq ($(PLATFORM), windows) X++vpath %.c $(LAUNCHER_SHARE_SRC) X+ X+ STATIC_LIBRARY_DIR = $(OBJDIR)/static X+ STATIC_LIBRARY_NAME = $(LIBPREFIX)$(LIBRARY).lib X+--- openjdk/jdk/make/java/zip/Makefile.orig 2010-07-09 11:12:30.000000000 +0000 X++++ openjdk/jdk/make/java/zip/Makefile 2010-07-09 11:15:31.000000000 +0000 X+@@ -30,8 +30,6 @@ X+ PRODUCT = sun X+ include $(BUILDDIR)/common/Defs.gmk X+ X+-ZLIB_VERSION = 1.1.3 X+- X+ # X+ # Files to compile. X+ # X+--- openjdk/jdk/make/sun/splashscreen/Makefile.orig 2010-07-09 11:12:30.000000000 +0000 X++++ openjdk/jdk/make/sun/splashscreen/Makefile 2010-07-09 11:24:23.000000000 +0000 X+@@ -59,7 +59,7 @@ X+ # C Flags X+ # X+ X+-CFLAGS += -DSPLASHSCREEN X++CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE 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+@@ -76,10 +76,10 @@ 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++ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext -L$(ICONV_PATH)/lib -liconv $(LIBM) -lpng -ljpeg -lgif -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++ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext $(LIBM) -lpng -ljpeg -lgif -lz -lpthread X+ endif X+ else # PLATFORM X+ CFLAGS += -DWITH_WIN32 X+@@ -92,12 +92,9 @@ X+ # X+ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/splashscreen X+ vpath %.c $(SHARE_SRC)/native/$(PKGDIR) X+-vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/giflib 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+ ifeq ($(PLATFORM), linux) X+--- openjdk/jdk/make/sun/splashscreen/FILES_c.gmk.orig 2010-07-09 11:32:32.000000000 +0000 X++++ openjdk/jdk/make/sun/splashscreen/FILES_c.gmk 2010-07-09 11:34:58.000000000 +0000 X+@@ -30,69 +30,7 @@ X+ splashscreen_impl.c \ X+ splashscreen_jpeg.c \ X+ splashscreen_png.c \ X+- splashscreen_sys.c \ X+- png.c \ X+- pngerror.c \ X+- pngget.c \ X+- pngmem.c \ X+- pngpread.c \ X+- pngread.c \ X+- pngrio.c \ X+- pngrtran.c \ X+- pngrutil.c \ X+- pngset.c \ X+- pngtrans.c \ X+- pngwio.c \ X+- pngwrite.c \ X+- pngwtran.c \ X+- pngwutil.c \ X+- dgif_lib.c \ X+- gif_err.c \ X+- gifalloc.c \ X+- jcomapi.c \ X+- jdapimin.c \ X+- jdapistd.c \ X+- jdcoefct.c \ X+- jdcolor.c \ X+- jddctmgr.c \ X+- jdhuff.c \ X+- jdinput.c \ X+- jdmainct.c \ X+- jdmarker.c \ X+- jdmaster.c \ X+- jdmerge.c \ X+- jdphuff.c \ X+- jdpostct.c \ X+- jdsample.c \ X+- jerror.c \ X+- jidctflt.c \ X+- jidctfst.c \ X+- jidctint.c \ X+- jidctred.c \ X+- jmemmgr.c \ X+- jmemnobs.c \ X+- jquant1.c \ X+- jquant2.c \ X+- jutils.c \ X+- jcapimin.c \ X+- jcapistd.c \ X+- jccoefct.c \ X+- jccolor.c \ X+- jcdctmgr.c \ X+- jchuff.c \ X+- jcinit.c \ X+- jcmainct.c \ X+- jcmarker.c \ X+- jcmaster.c \ X+- jcparam.c \ X+- jcphuff.c \ X+- jcprepct.c \ X+- jcsample.c \ X+- jctrans.c \ X+- jdtrans.c \ X+- jfdctflt.c \ X+- jfdctfst.c \ X+- jfdctint.c X++ splashscreen_sys.c X+ X+ ifneq ($(SYSTEM_ZLIB),true) X+ FILES_c += \ X+--- openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h.orig 2010-07-09 11:32:32.000000000 +0000 X++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2010-07-09 11:36:07.000000000 +0000 X+@@ -93,13 +93,6 @@ 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; 490be9364ddac7987b99af30224e3fbe echo x - icedtea6-plugin/files/patch-patches-icedtea-nomotif-6706121.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-icedtea-nomotif-6706121.patch << 'cd5e1f82dd220f2ce44e8f21c2b560d4' X--- patches/icedtea-nomotif-6706121.patch.orig 2010-07-09 12:49:54.000000000 +0000 X+++ patches/icedtea-nomotif-6706121.patch 2010-07-09 12:53:12.000000000 +0000 X@@ -1245,171 +1245,6 @@ X awt_display; X awt_lock; X awt_Lock; X---- openjdk/jdk/make/sun/awt/mawt.gmk Wed Jun 18 19:27:59 2008 +0400 X-+++ openjdk/jdk/make/sun/awt/mawt.gmk Thu Jun 19 11:26:54 2008 +0400 X-@@ -27,14 +27,6 @@ X- # to create directory: X- # X- INIT += $(LIB_LOCATION) X-- X--ifndef HEADLESS X--ifeq ($(PLATFORM), linux) X--ifeq ($(STATIC_MOTIF),false) X--INIT += $(LIB_LOCATION)/libXm.so X--endif X--endif X--endif X- X- # X- # Files X-@@ -52,13 +44,9 @@ ifdef HEADLESS X- ifdef HEADLESS X- FILES_c = $(FILES_NO_MOTIF_c) X- else X-- FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) X-- X-- ifeq ($(MOTIF_VERSION), 2) X-- FILES_c += awt_motif21.c X-- FILES_c += awt_Choice21.c X-- endif X-- X-+# FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) X-+# XXX if in FILES_MOTIF_c there are unrelated to motif stuff, create a separate list! X-+ FILES_c = $(FILES_NO_MOTIF_c) X- endif X- X- ifeq ($(PLATFORM), solaris) X-@@ -92,15 +80,6 @@ include $(BUILDDIR)/common/Library.gmk X- X- $(LIB_LOCATION): X- $(MKDIR) -p $@ X-- X--ifeq ($(PLATFORM), linux) X--ifeq ($(STATIC_MOTIF),false) X--$(LIB_LOCATION)/libXm.so: X-- $(CP) $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so X--# Automounter problem makes the link fail on Redhat 6.1. X--# $(LN) -s $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so X--endif X--endif X- X- clean:: X- X-@@ -135,33 +114,49 @@ CPPFLAGS += -DHEADLESS=$(HEADLESS) X- CPPFLAGS += -DHEADLESS=$(HEADLESS) X- OTHER_LDLIBS = X- else X--CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) X-- X--ifeq ($(STATIC_MOTIF),true) X-- LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu X-- ifeq ($(PLATFORM), linux) X-- ifeq ($(ARCH_DATA_MODEL), 64) X-- LIBXT = -lXt X-- else X-- # Allows for builds on Debian GNU Linux, X11 is in a different place X-- LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X-- $(wildcard /usr/lib/libXt.a)) X-- LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X-- $(wildcard /usr/lib/libSM.a)) X-- LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X-- $(wildcard /usr/lib/libICE.a)) X-- endif X-- endif X--else X-- LIBXM = -L$(MOTIF_LIB) -lXm -lXp X-- ifeq ($(PLATFORM), linux) X-- LIBXT = -lXt X-- LIBSM = X-- LIBICE = X-- endif X--endif X-+#CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) X-+ X-+#ifeq ($(STATIC_MOTIF),true) X-+# LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu X-+# ifeq ($(PLATFORM), linux) X-+# ifeq ($(ARCH_DATA_MODEL), 64) X-+# LIBXT = -lXt X-+# else X-+# # Allows for builds on Debian GNU Linux, X11 is in a different place X-+# LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X-+# $(wildcard /usr/lib/libXt.a)) X-+# LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X-+# $(wildcard /usr/lib/libSM.a)) X-+# LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X-+# $(wildcard /usr/lib/libICE.a)) X-+# endif X-+# endif X-+#else X-+# LIBXM = -L$(MOTIF_LIB) -lXm -lXp X-+# ifeq ($(PLATFORM), linux) X-+# LIBXT = -lXt X-+# LIBSM = X-+# LIBICE = X-+# endif X-+#endif X- X- LIBXTST = -lXtst X-+ifeq ($(PLATFORM), linux) X-+ ifeq ($(ARCH_DATA_MODEL), 64) X-+ # XXX what about the rest of them? X-+ LIBXT = -lXt X-+ else X-+ # Allows for builds on Debian GNU Linux, X11 is in a different place X-+ LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X-+ $(wildcard /usr/lib/libXt.a)) X-+ LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X-+ $(wildcard /usr/lib/libSM.a)) X-+ LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X-+ $(wildcard /usr/lib/libICE.a)) X-+ LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \ X-+ $(wildcard /usr/lib/libXtst.a)) X-+ endif X-+endif X- X- # Use -lXmu for EditRes support X- LIBXMU_DBG = -lXmu X-@@ -169,14 +164,14 @@ LIBXMU = $(LIBXMU_$(VARIANT)) X- LIBXMU = $(LIBXMU_$(VARIANT)) X- X- ifeq ($(PLATFORM), solaris) X--OTHER_LDLIBS = $(LIBXM) -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi X-+OTHER_LDLIBS = -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi X- endif X- X- ifeq ($(PLATFORM), linux) X- OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH X--OTHER_CFLAGS += -DMOTIF_VERSION=2 X-+# XXX what is this define below? Isn't it motif-related? X- OTHER_CFLAGS += -DXMSTRINGDEFINES=1 X--OTHER_LDLIBS = $(LIBXM) $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi X-+OTHER_LDLIBS = $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi X- endif X- X- endif X-@@ -199,9 +194,8 @@ CPPFLAGS += -I$(CUPS_HEADERS_PATH) 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-+CPPFLAGS += -I$(OPENWIN_HOME)/include X-+LDFLAGS += -L$(OPENWIN_LIB) X- X- endif # !HEADLESS X- X---- openjdk/jdk/make/sun/jawt/Makefile Wed Jun 18 19:27:59 2008 +0400 X-+++ openjdk/jdk/make/sun/jawt/Makefile Thu Jun 19 11:26:54 2008 +0400 X-@@ -93,7 +93,6 @@ else # PLATFORM 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- -I$(SHARE_SRC)/native/$(PKGDIR)/image \ X- -I$(SHARE_SRC)/native/$(PKGDIR)/image/cvutils \ X --- openjdk/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java Wed Jun 18 19:27:59 2008 +0400 X +++ openjdk/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java Thu Jun 19 11:26:54 2008 +0400 X @@ -60,12 +60,12 @@ import java.awt.dnd.InvalidDnDOperationE X@@ -43513,3 +43348,167 @@ X - AWT_FLUSH_UNLOCK(); X -} X X+--- openjdk/jdk/make/sun/awt/mawt.gmk.orig 2010-07-09 11:40:33.000000000 +0000 X++++ openjdk/jdk/make/sun/awt/mawt.gmk 2010-07-09 12:50:57.000000000 +0000 X+@@ -28,14 +28,6 @@ X+ # X+ INIT += $(LIB_LOCATION) X+ X+-ifndef HEADLESS X+-ifeq ($(PLATFORM), linux) X+-ifeq ($(STATIC_MOTIF),false) X+-INIT += $(LIB_LOCATION)/libXm.so X+-endif X+-endif X+-endif X+- X+ # X+ # Files X+ # X+@@ -52,13 +44,9 @@ X+ ifdef HEADLESS X+ FILES_c = $(FILES_NO_MOTIF_c) X+ else X+- FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) X+- X+- ifeq ($(MOTIF_VERSION), 2) X+- FILES_c += awt_motif21.c X+- FILES_c += awt_Choice21.c X+- endif X+- X++# FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c) X++# XXX if in FILES_MOTIF_c there are unrelated to motif stuff, create a separate list! X++ FILES_c = $(FILES_NO_MOTIF_c) X+ endif X+ X+ ifeq ($(PLATFORM), solaris) X+@@ -93,15 +81,6 @@ X+ $(LIB_LOCATION): X+ $(MKDIR) -p $@ X+ X+-ifeq ($(PLATFORM), linux) X+-ifeq ($(STATIC_MOTIF),false) X+-$(LIB_LOCATION)/libXm.so: X+- $(CP) $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so X+-# Automounter problem makes the link fail on Redhat 6.1. X+-# $(LN) -s $(MOTIF_LIB)/libXm.so $(LIB_LOCATION)/libXm.so X+-endif X+-endif X+- X+ clean:: X+ X+ # X+@@ -137,33 +116,49 @@ X+ CPPFLAGS += -DHEADLESS=$(HEADLESS) X+ OTHER_LDLIBS = X+ else X+-CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) X++#CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION) X+ X+-ifeq ($(STATIC_MOTIF),true) X+- LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu X+- ifeq ($(PLATFORM), linux) X+- ifeq ($(ARCH_DATA_MODEL), 64) X+- LIBXT = -lXt X+- else X+- # Allows for builds on Debian GNU Linux, X11 is in a different place X+- LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X+- $(wildcard /usr/lib/libXt.a)) X+- LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X+- $(wildcard /usr/lib/libSM.a)) X+- LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X+- $(wildcard /usr/lib/libICE.a)) X+- endif X+- endif X+-else X+- LIBXM = -L$(MOTIF_LIB) -lXm -lXp X+- ifeq ($(PLATFORM), linux) X+- LIBXT = -lXt X+- LIBSM = X+- LIBICE = X+- endif X+-endif X++#ifeq ($(STATIC_MOTIF),true) X++# LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu X++# ifeq ($(PLATFORM), linux) X++# ifeq ($(ARCH_DATA_MODEL), 64) X++# LIBXT = -lXt X++# else X++# # Allows for builds on Debian GNU Linux, X11 is in a different place X++# LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X++# $(wildcard /usr/lib/libXt.a)) X++# LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X++# $(wildcard /usr/lib/libSM.a)) X++# LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X++# $(wildcard /usr/lib/libICE.a)) X++# endif X++# endif X++#else X++# LIBXM = -L$(MOTIF_LIB) -lXm -lXp X++# ifeq ($(PLATFORM), linux) X++# LIBXT = -lXt X++# LIBSM = X++# LIBICE = X++# endif X++#endif X+ X+ LIBXTST = -lXtst X++ifeq ($(PLATFORM), linux) X++ ifeq ($(ARCH_DATA_MODEL), 64) X++ # XXX what about the rest of them? X++ LIBXT = -lXt X++ else X++ # Allows for builds on Debian GNU Linux, X11 is in a different place X++ LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ X++ $(wildcard /usr/lib/libXt.a)) X++ LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ X++ $(wildcard /usr/lib/libSM.a)) X++ LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ X++ $(wildcard /usr/lib/libICE.a)) X++ LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \ X++ $(wildcard /usr/lib/libXtst.a)) X++ endif X++endif X+ X+ # Use -lXmu for EditRes support X+ LIBXMU_DBG = -lXmu X+@@ -171,14 +166,14 @@ X+ LIBXMU = $(LIBXMU_$(VARIANT)) X+ X+ ifeq ($(PLATFORM), solaris) X+-OTHER_LDLIBS = $(LIBXM) -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi X++OTHER_LDLIBS = -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi X+ endif X+ X+ ifneq (,$(findstring $(PLATFORM), linux bsd)) X+ OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH X+-OTHER_CFLAGS += -DMOTIF_VERSION=2 X++# XXX what is this define below? Isn't it motif-related? X+ OTHER_CFLAGS += -DXMSTRINGDEFINES=1 X+-OTHER_LDLIBS = $(LIBXM) $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi X++OTHER_LDLIBS = $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi X+ endif X+ X+ endif X+@@ -205,9 +200,8 @@ 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++CPPFLAGS += -I$(OPENWIN_HOME)/include X++LDFLAGS += -L$(OPENWIN_LIB) X+ X+ endif # !HEADLESS X+ X+--- openjdk/jdk/make/sun/jawt/Makefile.orig 2010-07-09 11:40:33.000000000 +0000 X++++ openjdk/jdk/make/sun/jawt/Makefile 2010-07-09 12:52:08.000000000 +0000 X+@@ -113,7 +113,6 @@ 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. cd5e1f82dd220f2ce44e8f21c2b560d4 echo x - icedtea6-plugin/files/patch-patches-icedtea-clean-crypto.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-icedtea-clean-crypto.patch << '0f3108483bc74b5c576a333c7f24631b' X--- patches/icedtea-clean-crypto.patch.orig 2010-07-09 12:58:20.000000000 +0000 X+++ patches/icedtea-clean-crypto.patch 2010-07-09 12:59:54.000000000 +0000 X@@ -1,12 +1,11 @@ X diff -r 4aebfff4f8a2 jdk/make/javax/crypto/Makefile X---- openjdk.orig/jdk/make/javax/crypto/Makefile Mon Sep 15 11:38:34 2008 +0200 X-+++ openjdk/jdk/make/javax/crypto/Makefile Thu Sep 25 17:45:37 2008 +0200 X-@@ -155,7 +155,8 @@ X+--- openjdk/jdk/make/javax/crypto/Makefile.orig 2010-07-09 12:55:02.000000000 +0000 X++++ openjdk/jdk/make/javax/crypto/Makefile 2010-07-09 12:59:04.000000000 +0000 X+@@ -155,7 +155,7 @@ X # X X ifdef OPENJDK X--all: build-jar install-jar build-policy install-limited X-+# We don't need any policy files. X+-all: build-jar install-jar build-policy install-unlimited X +all: build-jar install-jar X else # OPENJDK X ifeq ($(strip $(FILES_java)),) 0f3108483bc74b5c576a333c7f24631b echo x - icedtea6-plugin/files/patch-patches-icedtea-linker-libs-order.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-icedtea-linker-libs-order.patch << '50bbc6a544fb019eff19b916291990ff' X--- patches/icedtea-linker-libs-order.patch.orig 2010-07-09 13:01:22.000000000 +0000 X+++ patches/icedtea-linker-libs-order.patch 2010-07-09 13:19:39.000000000 +0000 X@@ -23,39 +23,9 @@ X CPPFLAGS += \ X -DUSE_DAUDIO=TRUE \ X diff -durN openjdk-orig/jdk/make/com/sun/java/pack/Makefile openjdk/jdk/make/com/sun/java/pack/Makefile X---- openjdk-orig/jdk/make/com/sun/java/pack/Makefile 2008-10-27 00:25:30.000000000 +0000 X-+++ openjdk/jdk/make/com/sun/java/pack/Makefile 2008-10-28 23:27:55.000000000 +0000 X-@@ -75,12 +75,12 @@ X- $(ZIPOBJDIR)/infutil.$(OBJECT_SUFFIX) \ X- $(ZIPOBJDIR)/inffast.$(OBJECT_SUFFIX) X- X-- OTHER_LDLIBS += -lz X- else X- OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI X-- OTHER_LDLIBS += -lz $(JVMLIB) X-+ OTHER_LDLIBS += $(JVMLIB) X- endif X- X-+OTHER_LDLIBS += -lz X- CXXFLAGS_DBG += -DFULL X- CXXFLAGS_OPT += -DPRODUCT X- CXXFLAGS_COMMON += -DFULL X-@@ -100,12 +100,11 @@ X- COMPILER_WARNINGS_FATAL=false X- else X- LDOUTPUT = -o #Have a space X-- LDDFLAGS += -lz -lc X-- OTHER_LDLIBS += $(LIBCXX) X-+ OTHER_LDLIBS += $(LIBCXX) -lc X- # setup the list of libraries to link in... X- ifeq ($(PLATFORM), linux) X- ifeq ("$(CC_VER_MAJOR)", "3") X-- OTHER_LDLIBS += -lz -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X-+ OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X- endif X- endif #LINUX X- endif #PLATFORM X-@@ -142,7 +141,7 @@ X+--- openjdk/jdk/make/com/sun/java/pack/Makefile.orig 2010-07-09 13:00:55.000000000 +0000 X++++ openjdk/jdk/make/com/sun/java/pack/Makefile 2010-07-09 13:01:27.000000000 +0000 X+@@ -153,7 +153,7 @@ X X $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) winres X $(prep-target) 50bbc6a544fb019eff19b916291990ff echo x - icedtea6-plugin/files/patch-patches-extensions-netx-umask.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-extensions-netx-umask.patch << 'a16c9f1c827a91cf2fee92db7b1a5185' X--- patches/extensions/netx-umask.patch.orig 2010-07-09 13:21:11.000000000 +0000 X+++ patches/extensions/netx-umask.patch 2010-07-09 13:23:23.000000000 +0000 X@@ -17,8 +17,8 @@ X # GUI tools X ifeq ($(GUI_TOOL),true) X ifneq ($(PLATFORM), windows) X---- openjdk/jdk/src/share/bin/java.c.orig 2008-07-09 12:48:35.000000000 -0400 X-+++ openjdk/jdk/src/share/bin/java.c 2008-07-09 12:36:11.000000000 -0400 X+--- openjdk/jdk/src/share/bin/java.c.orig 2010-07-09 13:20:40.000000000 +0000 X++++ openjdk/jdk/src/share/bin/java.c 2010-07-09 13:22:33.000000000 +0000 X @@ -56,6 +56,7 @@ X #include X #include X@@ -36,7 +36,7 @@ X /* X * The following environment variable is used to influence the behavior X * of the jre exec'd through the SelectVersion routine. The command line X-@@ -184,6 +187,10 @@ X+@@ -193,6 +196,10 @@ X X int JNICALL JavaMain(void * args); /* entry point */ X X@@ -44,10 +44,10 @@ X +static int FindUMask(int *, char ***, int *); X +static int VerifyMask(char *, int*); X + X- struct JavaMainArgs { X+ typedef struct { X int argc; X char ** argv; X-@@ -307,6 +314,26 @@ X+@@ -316,6 +323,26 @@ X SetClassPath(s); X #endif X X@@ -74,7 +74,7 @@ X /* X * Parse command line options; if the return value of X * ParseArguments is false, the program should exit. X-@@ -2011,3 +2038,87 @@ X+@@ -2083,3 +2110,87 @@ X } X DoSplashSetFileJarName(file_name, jar_name); X } a16c9f1c827a91cf2fee92db7b1a5185 echo x - icedtea6-plugin/files/patch-patches-xrender-icedtea-001.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-xrender-icedtea-001.patch << 'eb43cddc3842ef27f1d06fc57a6173ed' X--- patches/xrender/icedtea-001.patch.orig 2010-07-09 13:30:13.000000000 +0000 X+++ patches/xrender/icedtea-001.patch 2010-07-09 13:32:15.000000000 +0000 X@@ -66,14 +66,14 @@ X + XRRenderer.c \ X + XRPMBlitLoops.c X diff -r dc592ff5af5e jdk/make/sun/xawt/Makefile X---- openjdk/jdk/make/sun/xawt/Makefile Fri Nov 28 22:59:23 2008 +0100 X-+++ openjdk/jdk/make/sun/xawt/Makefile Sat Nov 29 19:56:09 2008 +0100 X-@@ -86,7 +86,7 @@ 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-+OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender -ldl \ X+--- openjdk/jdk/make/sun/xawt/Makefile.orig 2010-07-09 13:28:39.000000000 +0000 X++++ openjdk/jdk/make/sun/xawt/Makefile 2010-07-09 13:31:07.000000000 +0000 X+@@ -96,7 +96,7 @@ X+ else X+ LIBDL=-ldl X+ endif X+-OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 $(LIBDL) \ X++OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) \ X $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi X X ifeq ($(PLATFORM), solaris) eb43cddc3842ef27f1d06fc57a6173ed echo x - icedtea6-plugin/files/patch-set-openjdk6 sed 's/^X//' >icedtea6-plugin/files/patch-set-openjdk6 << 'e1f70f95ed7382a6cea41512ca6370dc' X--- openjdk/Makefile 2010-04-15 11:30:12.000000000 +0400 X+++ openjdk/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -159,6 +159,18 @@ X clobber:: deploy-clobber 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 # Generic debug build, fastdebug or debug. Needs special handling. X # Note that debug builds do NOT do INSTALL steps, but must be done X--- openjdk/corba/make/common/Defs-linux.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/Defs-linux.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -290,7 +290,7 @@ 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 X--- openjdk/corba/make/common/Defs.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/Defs.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -53,6 +53,24 @@ 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 @@ 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) X--- openjdk/corba/make/common/Mapfile-vers.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/Mapfile-vers.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -77,7 +77,7 @@ 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? X--- openjdk/corba/make/common/shared/Compiler-gcc.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/shared/Compiler-gcc.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -100,6 +100,24 @@ 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 X--- openjdk/corba/make/common/shared/Compiler.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/shared/Compiler.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -42,6 +42,11 @@ 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 X--- openjdk/corba/make/common/shared/Defs-bsd.gmk 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/corba/make/common/shared/Defs-bsd.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -54,7 +54,7 @@ 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 @@ 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--- openjdk/corba/make/common/shared/Defs-java.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/shared/Defs-java.gmk 2010-04-17 21:48:07.000000000 +0400 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 # X--- openjdk/corba/make/common/shared/Defs-utils.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/shared/Defs-utils.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -53,6 +53,13 @@ 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@@ -199,3 +206,32 @@ 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 X--- openjdk/corba/make/common/shared/Platform.gmk 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/common/shared/Platform.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -265,6 +265,76 @@ 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@@ -376,7 +446,14 @@ 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@@ -388,7 +465,7 @@ 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--- openjdk/corba/make/sun/corba/core/Makefile 2010-04-15 11:30:23.000000000 +0400 X+++ openjdk/corba/make/sun/corba/core/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -53,11 +53,19 @@ 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 X--- openjdk/hotspot/agent/make/Makefile 2010-04-15 11:31:15.000000000 +0400 X+++ openjdk/hotspot/agent/make/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -52,6 +52,9 @@ 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 @@ 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 @@ 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 @@ 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 \ X--- openjdk/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c 2010-04-17 21:48:07.000000000 +0400 X@@ -22,6 +22,7 @@ X * X */ X X+#include X #include X #include "libproc.h" X X@@ -73,7 +74,7 @@ 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@@ -275,7 +276,7 @@ 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@@ -283,11 +284,10 @@ 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@@ -317,21 +317,21 @@ 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@@ -345,31 +345,31 @@ 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 X--- openjdk/hotspot/agent/src/os/bsd/Makefile 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/Makefile 2010-04-17 21:48:07.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 @@ 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 @@ 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@@ -72,14 +72,15 @@ 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 X--- openjdk/hotspot/agent/src/os/bsd/elfmacros.h 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/elfmacros.h 2010-04-17 21:48:07.000000000 +0400 X@@ -25,16 +25,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@@ -42,11 +45,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 X--- openjdk/hotspot/agent/src/os/bsd/hsearch_r.c 1970-01-01 03:00:00.000000000 +0300 X+++ openjdk/hotspot/agent/src/os/bsd/hsearch_r.c 2010-03-14 20:12:55.000000000 +0300 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 , 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 X+#include X+#include X+ X+#include 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+} X--- openjdk/hotspot/agent/src/os/bsd/hsearch_r.h 1970-01-01 03:00:00.000000000 +0300 X+++ openjdk/hotspot/agent/src/os/bsd/hsearch_r.h 2010-03-14 20:12:55.000000000 +0300 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 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_ */ X--- openjdk/hotspot/agent/src/os/bsd/libproc.h 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/libproc.h 2010-04-17 21:48:07.000000000 +0400 X@@ -27,7 +27,8 @@ X X #include X #include X-#include "proc_service.h" X+#include X+#include X X #if defined(sparc) || defined(sparcv9) X /* X@@ -50,14 +51,11 @@ 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@@ -74,19 +72,6 @@ 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@@ -118,7 +103,7 @@ 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); X--- openjdk/hotspot/agent/src/os/bsd/libproc_impl.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/libproc_impl.c 2010-04-17 21:48:07.000000000 +0400 X@@ -177,8 +177,11 @@ X newlib->symtab = build_symtab(newlib->fd); X if (newlib->symtab == NULL) { X print_debug("symbol table build failed for %s\n", newlib->name); X+ } else { X+ print_debug("built symbol table for %s\n", newlib->name); X } 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 // address read functionality. lookup_symbol checks for NULL symtab. X@@ -272,7 +275,7 @@ 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@@ -324,7 +327,7 @@ 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@@ -376,9 +379,9 @@ X // proc service functions X X // get process id X-pid_t ps_getpid(struct ps_prochandle *ph) { X- return ph->pid; X-} 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@@ -403,6 +406,24 @@ 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+ X // ------------------------------------------------------------------------ X // Functions below this point are not yet implemented. They are here only X // to make the linker happy. X@@ -428,7 +449,18 @@ 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_get_thread_area() { X+// print_debug("ps_get_thread_area not implemented\n"); X+// return PS_OK; X+//} X+ 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 } X+ X--- openjdk/hotspot/agent/src/os/bsd/libproc_impl.h 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/libproc_impl.h 2010-04-17 21:48:07.000000000 +0400 X@@ -47,7 +47,7 @@ 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@@ -71,7 +71,9 @@ 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 X--- openjdk/hotspot/agent/src/os/bsd/mapfile 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/mapfile 2010-04-17 21:48:07.000000000 +0400 X@@ -41,15 +41,21 @@ 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; X--- openjdk/hotspot/agent/src/os/bsd/proc_service.h 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/proc_service.h 2010-04-17 21:48:07.000000000 +0400 X@@ -22,6 +22,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@@ -55,11 +57,11 @@ 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); X--- openjdk/hotspot/agent/src/os/bsd/ps_proc.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/ps_proc.c 2010-04-17 21:48:07.000000000 +0400 X@@ -22,20 +22,22 @@ X * X */ X X+#include X #include X #include X #include X #include X+#include X+#include X #include X+#include X+#include X+#include X+#include X+#include X+#include 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@@ -54,46 +56,46 @@ 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+ 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- *(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@@ -108,45 +110,28 @@ 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@@ -155,10 +140,6 @@ 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@@ -191,85 +172,222 @@ 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.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@@ -277,17 +395,8 @@ 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@@ -321,21 +430,14 @@ 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 } X--- openjdk/hotspot/agent/src/os/bsd/salibelf.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/salibelf.c 2010-04-17 21:48:07.000000000 +0400 X@@ -25,6 +25,7 @@ X #include "salibelf.h" X #include X #include X+#include X X extern void print_debug(const char*,...); X X--- openjdk/hotspot/agent/src/os/bsd/symtab.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/symtab.c 2010-04-17 21:48:07.000000000 +0400 X@@ -23,13 +23,14 @@ X */ X X #include X-#include X #include X #include X #include 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@@ -56,7 +57,6 @@ 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@@ -65,18 +65,22 @@ 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@@ -85,23 +89,35 @@ 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@@ -113,6 +129,7 @@ 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 X--- openjdk/hotspot/agent/src/os/bsd/test.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/agent/src/os/bsd/test.c 2010-04-17 21:48:07.000000000 +0400 X@@ -44,7 +44,7 @@ X } X X default: { X- printf("usage %s or %s \n"); X+ fprintf(stderr, "usage %s or %s \n"); X return 1; X } X } X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java 2010-04-17 21:48:07.000000000 +0400 X@@ -30,10 +30,8 @@ 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 @@ 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 } X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java 2010-04-17 21:48:07.000000000 +0400 X@@ -26,9 +26,7 @@ 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 @@ 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 } X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2010-04-15 11:31:18.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2010-04-17 21:48:07.000000000 +0400 X@@ -37,6 +37,8 @@ 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 @@ 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) { X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd/BsdSignals.java 2010-04-17 21:48:07.000000000 +0400 X@@ -28,37 +28,36 @@ 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) { X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_x86/BsdSignals.java 2010-04-17 21:48:07.000000000 +0400 X@@ -32,33 +32,32 @@ 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) { X--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2010-04-15 11:31:19.000000000 +0400 X+++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2010-04-17 21:48:07.000000000 +0400 X@@ -37,6 +37,14 @@ 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 { X--- openjdk/hotspot/make/bsd/Makefile 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -220,7 +220,10 @@ 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 = 6.% 7.% 8.% X+# Decided to allow all versions here, and limit using FreeBSD java/openjdk6 X+# Makefile X+SUPPORTED_OS_VERSION = % X OS_VERSION := $(shell uname -r) X EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) X X--- openjdk/hotspot/make/bsd/makefiles/buildtree.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/buildtree.make 2010-04-17 21:48:07.000000000 +0400 X@@ -287,10 +287,11 @@ 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 X--- openjdk/hotspot/make/bsd/makefiles/cscope.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/cscope.make 2010-04-17 21:48:07.000000000 +0400 X@@ -71,7 +71,7 @@ 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 X--- openjdk/hotspot/make/bsd/makefiles/jsig.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/jsig.make 2010-04-17 21:48:07.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@@ -54,7 +59,7 @@ X $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) X @echo Making signal interposition lib... X $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ X- $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl X+ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< X X install_jsig: $(LIBJSIG) X @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" X--- openjdk/hotspot/make/bsd/makefiles/launcher.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/launcher.make 2010-04-17 21:48:07.000000000 +0400 X@@ -44,7 +44,7 @@ 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 X--- openjdk/hotspot/make/bsd/makefiles/sa.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/sa.make 2010-04-17 21:48:07.000000000 +0400 X@@ -42,8 +42,8 @@ X X # gnumake 3.78.1 does not accept the *s that X # are in AGENT_FILES1 and AGENT_FILES2, so use the shell to expand them X-AGENT_FILES1 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1)) X-AGENT_FILES2 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES2)) X+AGENT_FILES1 := $(shell /bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1)) X+AGENT_FILES2 := $(shell /bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES2)) X X SA_CLASSDIR = $(GENERATED)/saclasses X X--- openjdk/hotspot/make/bsd/makefiles/saproc.make 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/makefiles/saproc.make 2010-04-17 21:48:07.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 @@ 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@@ -58,6 +64,25 @@ X X SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) 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@@ -66,14 +91,15 @@ 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 $(SA_DEBUG_CFLAGS) \ X -o $@ \ X+ $(LIBUTIL) X -lthread_db X X install_saproc: checkAndBuildSA X--- openjdk/hotspot/make/bsd/platform_amd64 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/platform_amd64 2010-04-17 21:48:07.000000000 +0400 X@@ -12,4 +12,6 @@ X X compiler = gcc X X-sysdefs = -DLINUX -D_GNU_SOURCE -DAMD64 X+gnu_dis_arch = amd64 X+ X+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64 X--- openjdk/hotspot/make/bsd/platform_i486 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/hotspot/make/bsd/platform_i486 2010-04-17 21:48:07.000000000 +0400 X@@ -12,4 +12,6 @@ X X compiler = gcc X X-sysdefs = -DLINUX -D_GNU_SOURCE -DIA32 X+gnu_dis_arch = i386 X+ X+sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA32 X--- openjdk/hotspot/make/defs.make 2010-04-15 11:31:19.000000000 +0400 X+++ openjdk/hotspot/make/defs.make 2010-04-17 21:48:07.000000000 +0400 X@@ -119,13 +119,23 @@ 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 X--- openjdk/hotspot/make/sa.files 2010-04-15 11:31:19.000000000 +0400 X+++ openjdk/hotspot/make/sa.files 2010-04-17 21:48:07.000000000 +0400 X@@ -59,6 +59,9 @@ 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/ia64/*.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/linux/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \ X $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ia64/*.java \ X@@ -95,6 +98,9 @@ X AGENT_FILES2 = \ 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 \ X--- openjdk/hotspot/src/cpu/x86/vm/jni_x86.h 2010-04-15 11:31:20.000000000 +0400 X+++ openjdk/hotspot/src/cpu/x86/vm/jni_x86.h 2010-04-17 21:48:07.000000000 +0400 X@@ -26,7 +26,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 X--- openjdk/hotspot/src/os/bsd/launcher/java_md.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/launcher/java_md.c 2010-04-17 21:48:07.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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ X #endif X } X X-#endif /* __bsd__ && i586 */ X+#endif /* _ALLBSD_SOURCE && i586 */ X X #ifdef i586 X /* X@@ -1465,7 +1472,7 @@ 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 @@ 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 @@ 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) { X--- openjdk/hotspot/src/os/bsd/vm/attachListener_bsd.cpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/attachListener_bsd.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -179,32 +179,20 @@ 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@@ -330,6 +318,15 @@ 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@@ -337,10 +334,13 @@ 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@@ -460,15 +460,12 @@ 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 X--- openjdk/hotspot/src/os/bsd/vm/hpi_bsd.cpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/hpi_bsd.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -28,6 +28,14 @@ X # include X # include 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@@ -45,11 +53,11 @@ 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 */ X--- openjdk/hotspot/src/os/bsd/vm/hpi_bsd.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/hpi_bsd.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -36,7 +36,7 @@ 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@@ -55,7 +55,7 @@ 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@@ -120,9 +120,9 @@ X // fetch it's value, this cast is safe for now. The java.net group X // may need and want to change this interface someday if socklen_t goes X // to 64 bits on some platform that we support. X- // Bsd doc says this can't return EINTR, unlike accept() on Solaris X+ // At least OpenBSD and FreeBSD can return EINTR from accept. X X- return ::accept(fd, him, (socklen_t *)len); X+ RESTARTABLE_RETURN_INT(::accept(fd, him, (socklen_t *)len)); X } X X inline int hpi::recvfrom(int fd, char *buf, int nBytes, int flags, X@@ -136,12 +136,16 @@ 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--- openjdk/hotspot/src/os/bsd/vm/jsig.c 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/jsig.c 2010-04-17 21:48:07.000000000 +0400 X@@ -143,7 +143,8 @@ 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, X--- openjdk/hotspot/src/os/bsd/vm/jvm_bsd.cpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/jvm_bsd.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -138,44 +138,37 @@ 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)) X--- openjdk/hotspot/src/os/bsd/vm/jvm_bsd.h 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/jvm_bsd.h 2010-04-17 21:48:07.000000000 +0400 X@@ -51,7 +51,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@@ -90,6 +94,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 X--- openjdk/hotspot/src/os/bsd/vm/osThread_bsd.cpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/osThread_bsd.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -28,8 +28,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; X--- openjdk/hotspot/src/os/bsd/vm/osThread_bsd.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/osThread_bsd.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -36,6 +36,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@@ -44,6 +50,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@@ -53,12 +60,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@@ -67,9 +80,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@@ -120,6 +139,9 @@ 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@@ -127,6 +149,11 @@ 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 // *************************************************************** X--- openjdk/hotspot/src/os/bsd/vm/os_bsd.inline.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os/bsd/vm/os_bsd.inline.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -61,7 +61,15 @@ 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@@ -109,6 +117,107 @@ 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 { \ X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2010-04-17 21:48:07.000000000 +0400 X@@ -21,6 +21,22 @@ 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+#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+ X X # NOTE WELL! The _Copy functions are called directly X # from server-compiler-generated code via CallLeafNoFP, X@@ -28,41 +44,62 @@ 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+ 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@@ -72,8 +109,8 @@ 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@@ -180,8 +217,8 @@ 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@@ -268,8 +305,8 @@ 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@@ -354,8 +391,8 @@ 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@@ -431,10 +468,10 @@ 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@@ -494,7 +531,7 @@ X # X # count treated as signed X # X- # if (from > to) { X+ # // if (from > to) { X # while (--count >= 0) { X # *to++ = *from++; X # } X@@ -504,8 +541,8 @@ 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@@ -533,8 +570,8 @@ 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@@ -632,8 +669,8 @@ 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 X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s 2010-04-17 21:48:07.000000000 +0400 X@@ -22,48 +22,70 @@ X # 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+ 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@@ -77,8 +99,8 @@ 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@@ -179,10 +201,10 @@ 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@@ -269,10 +291,10 @@ 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@@ -348,10 +370,10 @@ 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 X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -22,7 +22,29 @@ X * X */ X X+#ifndef _ALLBSD_SOURCE X #include X+#endif X+ X+#ifdef __APPLE__ X+#include 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. X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -44,23 +44,158 @@ X # include X # include X # include X+#ifndef __OpenBSD__ X # include X-# include X+#endif X+ X+#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) X+# include 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 #ifdef SPARC_WORKS X register void *esp; X@@ -85,15 +220,15 @@ 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@@ -245,18 +380,18 @@ 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@@ -278,6 +413,7 @@ 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@@ -293,6 +429,7 @@ X } else { X fatal("recursive segv. expanding stack."); X } X+#endif X } X } X } X@@ -301,9 +438,16 @@ 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@@ -324,6 +468,28 @@ 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@@ -351,7 +517,7 @@ 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@@ -375,7 +541,7 @@ 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@@ -396,7 +562,7 @@ 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@@ -466,7 +632,7 @@ 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@@ -496,13 +662,24 @@ 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@@ -518,11 +695,12 @@ 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@@ -576,6 +754,9 @@ X #define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;}) X #endif 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 floating stack mode and NPTL support variable stack size. X@@ -612,6 +793,7 @@ X #endif X } X } X+#endif X #endif // AMD64 X X // return default stack size for thr_type X@@ -665,6 +847,41 @@ 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@@ -691,6 +908,7 @@ 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@@ -719,46 +937,44 @@ 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(); X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -27,8 +27,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 X--- openjdk/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp 2010-04-17 21:43:53.000000000 +0400 X+++ openjdk/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -31,7 +31,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() X--- openjdk/hotspot/src/share/vm/adlc/adlc.hpp 2010-04-15 11:31:23.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/adlc/adlc.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -69,9 +69,9 @@ X #endif X #endif // _WIN32 X X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X #include X-#endif // LINUX X+#endif // LINUX || _ALLBSD_SOURCE X X // Macros X #define uint32 unsigned int X--- openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew 2010-04-15 11:31:24.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew 2010-04-17 21:48:07.000000000 +0400 X@@ -32,6 +32,8 @@ X asParNewGeneration.cpp markOop.inline.hpp X asParNewGeneration.cpp markSweep.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 asParNewGeneration.cpp spaceDecorator.hpp X--- openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge 2010-04-15 11:31:25.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge 2010-04-17 21:48:07.000000000 +0400 X@@ -308,6 +308,8 @@ 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 X--- openjdk/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp 2010-04-15 11:31:25.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -77,7 +77,7 @@ 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 @@ 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)); X--- openjdk/hotspot/src/share/vm/prims/forte.cpp 2010-04-15 11:31:26.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/prims/forte.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -626,6 +626,11 @@ 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@@ -636,6 +641,7 @@ 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" X--- openjdk/hotspot/src/share/vm/runtime/globals.hpp 2010-04-15 11:31:27.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -323,7 +323,7 @@ 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 diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \ X--- openjdk/hotspot/src/share/vm/runtime/vm_version.cpp 2010-04-15 11:31:27.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -144,7 +144,8 @@ 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 #ifdef ZERO X #define CPU ZERO_LIBARCH X--- openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2010-04-15 11:31:28.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -71,12 +71,25 @@ X # include X # endif X X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X #include X #include X+#ifndef __OpenBSD__ X #include X+#endif X+#ifdef __APPLE__ X+ #include 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 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@@ -112,7 +125,7 @@ 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@@ -124,7 +137,7 @@ X #define NULL_WORD NULL X #endif X X-#ifndef LINUX X+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) X // Compiler-specific primitive types X typedef unsigned short uint16_t; X #ifndef _UINT32_T X@@ -144,7 +157,7 @@ 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@@ -228,7 +241,9 @@ 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 X--- openjdk/hotspot/src/share/vm/utilities/macros.hpp 2010-04-15 11:31:28.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/utilities/macros.hpp 2010-04-17 21:48:07.000000000 +0400 X@@ -156,6 +156,16 @@ X #define X86_ONLY(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) X--- openjdk/hotspot/src/share/vm/utilities/ostream.cpp 2010-04-15 11:31:28.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/utilities/ostream.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -827,7 +827,7 @@ X X #ifndef PRODUCT X X-#if defined(SOLARIS) || defined(LINUX) X+#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) X #include X #include X #include X--- openjdk/hotspot/src/share/vm/utilities/vmError.cpp 2010-04-15 11:31:28.000000000 +0400 X+++ openjdk/hotspot/src/share/vm/utilities/vmError.cpp 2010-04-17 21:48:07.000000000 +0400 X@@ -31,13 +31,18 @@ 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@@ -834,7 +840,7 @@ 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 "); X--- openjdk/jdk/make/com/sun/java/pack/Makefile 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/java/pack/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -61,6 +61,7 @@ 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 @@ 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 @@ 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) X--- openjdk/jdk/make/com/sun/security/auth/module/Makefile 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/security/auth/module/Makefile 2010-04-17 21:48:07.000000000 +0400 X@@ -70,7 +70,7 @@ 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 X--- openjdk/jdk/make/com/sun/tools/attach/Exportedfiles.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/tools/attach/Exportedfiles.gmk 2010-04-17 21:48:07.000000000 +0400 X@@ -43,5 +43,7 @@ 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 X--- openjdk/jdk/make/com/sun/tools/attach/FILES_c.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/tools/attach/FILES_c.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -39,4 +39,7 @@ X LinuxVirtualMachine.c X endif X X- X+ifeq ($(PLATFORM),bsd) X+FILES_c = \ X+ BsdVirtualMachine.c X+endif X--- openjdk/jdk/make/com/sun/tools/attach/FILES_java.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/tools/attach/FILES_java.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -43,6 +43,11 @@ 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 # X--- openjdk/jdk/make/com/sun/tools/attach/Makefile 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/com/sun/tools/attach/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -36,6 +36,9 @@ 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 # X--- openjdk/jdk/make/com/sun/tools/attach/mapfile-bsd 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/jdk/make/com/sun/tools/attach/mapfile-bsd 2010-04-17 21:48:08.000000000 +0400 X@@ -30,14 +30,12 @@ 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 }; X--- openjdk/jdk/make/common/Defs-linux.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/common/Defs-linux.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -309,7 +309,7 @@ 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 X--- openjdk/jdk/make/common/Defs.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/common/Defs.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -188,6 +188,24 @@ 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 @@ 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 @@ 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) X--- openjdk/jdk/make/common/Program.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/common/Program.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -67,11 +67,27 @@ 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 @@ 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 @@ 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 OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"' X VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"' X--- openjdk/jdk/make/common/Release.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/common/Release.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -145,14 +145,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@@ -191,6 +190,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@@ -323,6 +327,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@@ -637,6 +647,8 @@ X $(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) \ X $(TOTAL_JAR_FILELIST) \ X -o $(RT_JAR_FILELIST) $(RES_JAR_FILELIST) X+ $(EGREP) -v hotspot.log $(RES_JAR_FILELIST) > $(RES_JAR_FILELIST).temp X+ $(MV) $(RES_JAR_FILELIST).temp $(RES_JAR_FILELIST) X @$(java-vm-cleanup) X X # Create the manifest file. X@@ -980,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@@ -993,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 X--- openjdk/jdk/make/common/internal/BinaryPlugs.gmk 2010-04-15 11:35:10.000000000 +0400 X+++ openjdk/jdk/make/common/internal/BinaryPlugs.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -49,8 +49,6 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/common/shared/Compiler-gcc.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -99,6 +99,24 @@ 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 X--- openjdk/jdk/make/common/shared/Compiler.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Compiler.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -37,8 +37,8 @@ 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 X--- openjdk/jdk/make/common/shared/Defs-bsd.gmk 2010-04-17 21:43:54.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Defs-bsd.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -70,7 +70,7 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/common/shared/Defs-java.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Defs-java.gmk 2010-04-17 21:48:08.000000000 +0400 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 # X--- openjdk/jdk/make/common/shared/Defs-utils.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Defs-utils.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -80,6 +80,13 @@ X endif 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 # Utilities X ADB = $(UTILS_COMMAND_PATH)adb X AR = $(UTILS_CCS_BIN_PATH)ar X@@ -201,3 +208,32 @@ 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 X--- openjdk/jdk/make/common/shared/Defs.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Defs.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -143,7 +143,7 @@ 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; \ X--- openjdk/jdk/make/common/shared/Platform.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Platform.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -279,6 +279,76 @@ 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@@ -395,6 +465,13 @@ 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@@ -406,7 +483,7 @@ 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@@ -458,6 +535,15 @@ 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)) X--- openjdk/jdk/make/common/shared/Sanity-Settings.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Sanity-Settings.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -255,6 +255,7 @@ 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) X--- openjdk/jdk/make/common/shared/Sanity.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/common/shared/Sanity.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -96,6 +96,11 @@ 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') X--- openjdk/jdk/make/docs/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/docs/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -233,7 +233,7 @@ 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 \ X--- openjdk/jdk/make/java/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -49,7 +49,7 @@ X endif X endif # PLATFORM X X-ifeq ($(PLATFORM), linux) X+ifneq (,$(findstring $(PLATFORM), linux bsd)) X SUBDIRS += jexec X endif # PLATFORM X X--- openjdk/jdk/make/java/hpi/hpi_common.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/hpi/hpi_common.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -86,5 +86,9 @@ 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 X--- openjdk/jdk/make/java/hpi/native/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/hpi/native/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -72,11 +72,18 @@ 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 X--- openjdk/jdk/make/java/instrument/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/instrument/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -102,6 +102,21 @@ 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 @@ X LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/jli X endif X endif X+endif X X # X # Library to compile. X--- openjdk/jdk/make/java/java/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/java/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -167,8 +167,10 @@ 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 @@ 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. X--- openjdk/jdk/make/java/java/genlocales.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/java/genlocales.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -1,5 +1,5 @@ X # X-# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. X+# Copyright 2005-2008 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@@ -76,11 +76,16 @@ X $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH) X @$(RM) $@.tmp.euro $@.tmp.noneuro; X @$(prep-target) X- @$(ECHO) $(subst .properties,'\n',$(Euro_Resources_properties)) > $@.tmp.euro; X- @$(ECHO) $(subst .java,'\n',$(Euro_Resources_java)) >> $@.tmp.euro; X- @$(ECHO) $(subst .properties,'\n',$(NonEuro_Resources_properties)) > $@.tmp.noneuro; X- @$(ECHO) $(subst .java,'\n',$(NonEuro_Resources_java)) >> $@.tmp.noneuro; X- NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.euro \ X+ @$(ECHO) $(Euro_Resources_properties) | $(SED) -e s@.properties@'\ X+'@g > $@.tmp.euro; X+ @$(ECHO) $(Euro_Resources_java) | $(SED) -e s@.java@'\ X+'@g >> $@.tmp.euro; X+ @$(ECHO) $(NonEuro_Resources_properties) | $(SED) -e s@.properties@'\ X+'@g > $@.tmp.noneuro; X+ @$(ECHO) $(NonEuro_Resources_java) | $(SED) -e s@.java@'\ X+'@g >> $@.tmp.noneuro; X+ NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \ X+ $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.euro \ X $@.tmp.noneuro $< $@ X @$(RM) $@.tmp.euro $@.tmp.noneuro; X X--- openjdk/jdk/make/java/java/localegen.sh 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/java/localegen.sh 2010-04-17 21:48:08.000000000 +0400 X@@ -1,7 +1,7 @@ X #!/bin/sh X X # X-# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. X+# Copyright 2005-2008 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@@ -29,7 +29,7 @@ X # This script is to generate the supported locale list string and replace the X # LocaleDataMetaInfo-XLocales.java in /src/share/classes/sun/util X # X-# NAWK & SED is passed in as environment variables. X+# SORT, NAWK & SED is passed in as environment variables. X # X X # A list of resource base name list; X@@ -47,7 +47,7 @@ X localelist= X getlocalelist() { X localelist="" X- localelist=`$NAWK -F$1_ '{print $2}' $2 | sort` X+ localelist=`$NAWK -F$1_ '{print $2}' $2 | $SORT` X } X X sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" " X@@ -55,9 +55,9 @@ 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" X--- openjdk/jdk/make/java/java_hprof_demo/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/java_hprof_demo/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -83,8 +83,10 @@ 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 X--- openjdk/jdk/make/java/jli/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/jli/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -44,8 +44,10 @@ 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 @@ 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 @@ X infutil.c \ X zadler32.c \ X zutil.c X+endif X X OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS X X@@ -98,7 +104,11 @@ 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 @@ 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 X--- openjdk/jdk/make/java/management/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/management/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -85,6 +85,11 @@ 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 X--- openjdk/jdk/make/java/net/FILES_c.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/net/FILES_c.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -43,6 +43,10 @@ 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 X--- openjdk/jdk/make/java/net/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/net/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -92,6 +92,12 @@ 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 @@ 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 X--- openjdk/jdk/make/java/nio/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/nio/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -82,7 +82,7 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/java/npt/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/npt/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -70,6 +70,18 @@ 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 # X--- openjdk/jdk/make/java/redist/FILES.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/redist/FILES.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -38,6 +38,14 @@ 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 X--- openjdk/jdk/make/java/redist/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/redist/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -317,7 +317,7 @@ 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@@ -331,7 +331,7 @@ 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) X--- openjdk/jdk/make/java/security/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/security/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -51,7 +51,15 @@ 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 X--- openjdk/jdk/make/java/zip/FILES_c.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/zip/FILES_c.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -30,6 +30,10 @@ 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 @@ X inftrees.c \ X infcodes.c \ X infutil.c \ X- inffast.c \ X- zip_util.c X+ inffast.c X+endif X--- openjdk/jdk/make/java/zip/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/java/zip/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -72,16 +72,24 @@ 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+ X--- openjdk/jdk/make/javax/crypto/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/javax/crypto/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -155,7 +155,7 @@ X # X X ifdef OPENJDK X-all: build-jar install-jar build-policy install-limited X+all: build-jar install-jar build-policy install-unlimited X else # OPENJDK X ifeq ($(strip $(FILES_java)),) X all: X--- openjdk/jdk/make/javax/sound/FILES_c.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/javax/sound/FILES_c.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -34,6 +34,8 @@ X X FILES_linux = X X+FILES_bsd = X+ X FILES_windows = \ X PLATFORM_API_WinOS_MidiIn.c \ X PLATFORM_API_WinOS_MidiOut.c \ X--- openjdk/jdk/make/javax/sound/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/javax/sound/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -107,6 +107,19 @@ 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 X--- openjdk/jdk/make/javax/sound/SoundDefs.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/javax/sound/SoundDefs.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -40,6 +40,10 @@ 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 X--- openjdk/jdk/make/jpda/back/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/jpda/back/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -49,8 +49,10 @@ 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 X--- openjdk/jdk/make/sun/awt/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/sun/awt/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -129,6 +129,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/sun/awt/mawt.gmk 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/sun/awt/mawt.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -174,7 +174,7 @@ 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@@ -185,7 +185,11 @@ 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@@ -229,16 +233,33 @@ 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) X--- openjdk/jdk/make/sun/font/Makefile 2010-04-15 11:35:11.000000000 +0400 X+++ openjdk/jdk/make/sun/font/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -177,6 +177,15 @@ 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 @@ X OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic X endif X endif X+endif X X endif # PLATFORM X X--- openjdk/jdk/make/sun/image/generic/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/image/generic/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -69,5 +69,9 @@ 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 X--- openjdk/jdk/make/sun/jawt/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/jawt/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -98,9 +98,7 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/sun/security/jgss/wrapper/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/security/jgss/wrapper/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -71,6 +71,10 @@ 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 X--- openjdk/jdk/make/sun/security/pkcs11/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/security/pkcs11/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -155,7 +155,7 @@ 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) X--- openjdk/jdk/make/sun/security/smartcardio/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/security/smartcardio/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -75,6 +75,10 @@ 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 X--- openjdk/jdk/make/sun/splashscreen/FILES_c.gmk 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/splashscreen/FILES_c.gmk 2010-04-17 21:48:08.000000000 +0400 X@@ -49,20 +49,6 @@ 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 @@ 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 X--- openjdk/jdk/make/sun/splashscreen/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/splashscreen/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -61,10 +61,26 @@ 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 @@ 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. X--- openjdk/jdk/make/sun/xawt/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/sun/xawt/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -53,6 +53,11 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/make/tools/freetypecheck/Makefile 2010-04-15 11:35:12.000000000 +0400 X+++ openjdk/jdk/make/tools/freetypecheck/Makefile 2010-04-17 21:48:08.000000000 +0400 X@@ -45,7 +45,7 @@ X FT_OPTIONS = $(CFLAGS) X endif X X-FT_OPTIONS += -I$(FT_HEADERS) -I$(FT_HEADERS)/freetype2 X+FT_OPTIONS += -I$(FT_HEADERS) -I$(FT_HEADERS)/freetype2 -I/usr/local/include -I/usr/local/include/freetype2/ X FT_OPTIONS += $(XARCH) X X #add runtime library search path X@@ -60,8 +60,12 @@ 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 X--- openjdk/jdk/src/share/back/commonRef.c 2010-04-15 11:35:13.000000000 +0400 X+++ openjdk/jdk/src/share/back/commonRef.c 2010-04-17 21:48:08.000000000 +0400 X@@ -23,6 +23,10 @@ X * have any questions. X */ X X+#if defined(_ALLBSD_SOURCE) X+#include /* for uintptr_t */ X+#endif X+ X #include "util.h" X #include "commonRef.h" X X--- openjdk/jdk/src/share/bin/java.c 2010-04-15 11:35:13.000000000 +0400 X+++ openjdk/jdk/src/share/bin/java.c 2010-04-17 21:48:08.000000000 +0400 X@@ -104,6 +104,11 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 { X--- openjdk/jdk/src/share/bin/java.h 2010-04-15 11:35:13.000000000 +0400 X+++ openjdk/jdk/src/share/bin/java.h 2010-04-17 21:48:08.000000000 +0400 X@@ -91,11 +91,17 @@ 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); X--- openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java 2010-04-15 11:35:14.000000000 +0400 X+++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java 2010-04-17 21:48:08.000000000 +0400 X@@ -477,6 +477,10 @@ 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 X--- openjdk/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java 2010-04-15 11:35:16.000000000 +0400 X+++ openjdk/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java 2010-04-17 21:48:08.000000000 +0400 X@@ -78,6 +78,9 @@ X */ X public long timeStamp ; X X+ // TODO: IcedTea: I am a stub. X+ static public int trapAuthenticationFailure = 0; X+ X X X /** X--- openjdk/jdk/src/share/classes/java/awt/Font.java 2010-04-15 11:35:20.000000000 +0400 X+++ openjdk/jdk/src/share/classes/java/awt/Font.java 2010-04-17 21:48:08.000000000 +0400 X@@ -445,18 +445,19 @@ X */ X private AttributeValues getAttributeValues() { X if (values == null) { X- values = new AttributeValues(); X- values.setFamily(name); X- values.setSize(pointSize); // expects the float value. X+ AttributeValues valuesTmp = new AttributeValues(); X+ valuesTmp.setFamily(name); X+ valuesTmp.setSize(pointSize); // expects the float value. X X if ((style & BOLD) != 0) { X- values.setWeight(2); // WEIGHT_BOLD X+ valuesTmp.setWeight(2); // WEIGHT_BOLD X } X X if ((style & ITALIC) != 0) { X- values.setPosture(.2f); // POSTURE_OBLIQUE X+ valuesTmp.setPosture(.2f); // POSTURE_OBLIQUE X } X- values.defineAll(PRIMARY_MASK); // for streaming compatibility X+ valuesTmp.defineAll(PRIMARY_MASK); // for streaming compatibility X+ values = valuesTmp; X } X X return values; X--- openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java 2010-04-15 11:35:20.000000000 +0400 X+++ openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java 2010-04-17 21:48:08.000000000 +0400 X@@ -148,7 +148,12 @@ 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")) { X--- openjdk/jdk/src/share/classes/java/util/TimeZone.java 2010-04-15 11:35:24.000000000 +0400 X+++ openjdk/jdk/src/share/classes/java/util/TimeZone.java 2010-04-17 21:48:08.000000000 +0400 X@@ -776,15 +776,13 @@ 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 } X--- openjdk/jdk/src/share/classes/sun/awt/FontConfiguration.java 2010-04-15 11:35:31.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/awt/FontConfiguration.java 2010-04-17 21:48:08.000000000 +0400 X@@ -1073,7 +1073,7 @@ X */ X HashMap 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(); X@@ -1309,7 +1309,7 @@ X + " entry is missing!!!"); X- if (!osName.contains("Linux")) { X+ if (!osName.contains("Linux") && !osName.contains("BSD") && !osName.contains("Darwin")) { X errors++; X } X } X--- openjdk/jdk/src/share/classes/sun/font/TrueTypeFont.java 2010-04-15 11:35:32.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/font/TrueTypeFont.java 2010-04-17 21:48:08.000000000 +0400 X@@ -159,6 +159,13 @@ X private boolean supportsJA; X private boolean supportsCJK; X X+ /* These are for faster access to the name of the font as X+ * typically exposed via API to applications. X+ */ X+ private Locale nameLocale; X+ private String localeFamilyName; X+ private String localeFullName; X+ X /** X * - does basic verification of the file X * - reads the header table for this font (within a collection) X@@ -1058,6 +1065,10 @@ X * greater than 32767, so read and store those as ints X */ X int stringPtr = sbuffer.get() & 0xffff; X+ X+ nameLocale = sun.awt.SunToolkit.getStartupLocale(); X+ short nameLocaleID = FontManager.getLCIDFromLocale(nameLocale); X+ X for (int i=0; i x0) bboxX0 = x0; X- if (bboxX1 < x1) bboxX1 = x1; X+ if (bboxX1 < x1 + 1) bboxX1 = x1 + 1; X while (bboxY1++ < y) { X reallocRowInfo(alphaRows+1); X minTouched[alphaRows] = 0; X--- openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java 2010-04-15 11:35:37.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java 2010-04-17 21:48:08.000000000 +0400 X@@ -1531,7 +1531,9 @@ 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) { X--- openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java 2010-04-15 11:35:38.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java 2010-04-17 21:48:08.000000000 +0400 X@@ -49,8 +49,12 @@ X AccessController.doPrivileged(new PrivilegedAction() { X public Boolean run() { X String osname = System.getProperty("os.name"); X- if (osname.startsWith("SunOS") || X- osname.startsWith("Linux")) { X+ if (osname.startsWith("SunOS") X+ || osname.startsWith("Linux") X+ || osname.startsWith("FreeBSD") X+ || osname.startsWith("NetBSD") X+ || osname.startsWith("OpenBSD") X+ || osname.startsWith("Darwin")) { X return new Boolean(System.getProperty X (USE_NATIVE_PROP)); X } X--- openjdk/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2010-04-15 11:35:38.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2010-04-17 21:48:08.000000000 +0400 X@@ -82,7 +82,11 @@ X String osname = System.getProperty("os.name"); X if (osname.startsWith("SunOS")) { X gssLib = "libgss.so"; X- } else if (osname.startsWith("Linux")) { X+ } else if (osname.startsWith("Linux") X+ || osname.startsWith("FreeBSD") X+ || osname.startsWith("NetBSD") X+ || osname.startsWith("OpenBSD") X+ || osname.startsWith("Darwin")) { X gssLib = "libgssapi.so"; X } X } X--- openjdk/jdk/src/share/classes/sun/security/krb5/Config.java 2010-04-15 11:35:38.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/security/krb5/Config.java 2010-04-17 21:48:08.000000000 +0400 X@@ -711,7 +711,11 @@ X } X } else if (osname.startsWith("SunOS")) { X name = "/etc/krb5/krb5.conf"; X- } else if (osname.startsWith("Linux")) { X+ } else if (osname.startsWith("Linux") X+ || osname.startsWith("FreeBSD") X+ || osname.startsWith("NetBSD") X+ || osname.startsWith("OpenBSD") X+ || osname.startsWith("Darwin")) { X name = "/etc/krb5.conf"; X } X } X--- openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java 2010-04-15 11:35:39.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java 2010-04-17 21:48:08.000000000 +0400 X@@ -383,8 +383,12 @@ X String uidStr = null; X long uid = 0; X X- if (osname.startsWith("SunOS") || X- (osname.startsWith("Linux"))) { X+ if (osname.startsWith("SunOS") X+ || osname.startsWith("Linux") X+ || osname.startsWith("FreeBSD") X+ || osname.startsWith("NetBSD") X+ || osname.startsWith("OpenBSD") X+ || osname.startsWith("Darwin")) { X try { X Class c = Class.forName X ("com.sun.security.auth.module.UnixSystem"); X--- openjdk/jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider 2010-04-15 11:35:41.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/tools/attach/META-INF/services/com.sun.tools.attach.spi.AttachProvider 2010-04-17 21:48:08.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 X--- openjdk/jdk/src/share/classes/sun/tools/jar/Main.java 2010-04-15 11:35:41.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/tools/jar/Main.java 2010-04-17 21:48:08.000000000 +0400 X@@ -48,6 +48,7 @@ X String zname = ""; X String[] files; X String rootjar = null; X+ String cwd; X X // An entryName(path)->File map generated during "expand", it helps to X // decide whether or not an existing entry in a jar file needs to be X@@ -249,6 +250,16 @@ X } X } X } else if (xflag) { X+ // Current working directory 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+ // Extract the files X replaceFSC(files); X if (fname != null && files != null) { X extract(fname, files); X@@ -921,6 +932,10 @@ 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@@ -942,6 +957,10 @@ 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())); X--- openjdk/jdk/src/share/classes/sun/tools/jar/resources/jar.properties 2010-04-15 11:35:41.000000000 +0400 X+++ openjdk/jdk/src/share/classes/sun/tools/jar/resources/jar.properties 2010-04-17 21:48:08.000000000 +0400 X@@ -44,6 +44,8 @@ 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=\ X--- openjdk/jdk/src/share/hpi/include/hpi_impl.h 2010-04-15 11:35:44.000000000 +0400 X+++ openjdk/jdk/src/share/hpi/include/hpi_impl.h 2010-04-17 21:48:08.000000000 +0400 X@@ -138,7 +138,11 @@ 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, X--- openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h 2010-04-17 21:48:08.000000000 +0400 X@@ -32,6 +32,10 @@ X #include X #endif X X+#ifndef NO_ZLIB X+# include 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 @@ 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; X--- openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp 2010-04-17 21:48:08.000000000 +0400 X@@ -33,9 +33,14 @@ X #include X #include X X+/* !PRODUCT needs intptr_t */ X+#if defined(_ALLBSD_SOURCE) && !defined(PRODUCT) X+#include 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 @@ 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 @@ 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 X--- openjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c 2010-04-17 21:48:08.000000000 +0400 X@@ -33,7 +33,11 @@ X X #include X // for malloc X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X #include "SoundDefs.h" X #include "DirectAudio.h" X #include "Utilities.h" X--- openjdk/jdk/src/share/native/com/sun/media/sound/Platform.c 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/com/sun/media/sound/Platform.c 2010-04-17 21:48:08.000000000 +0400 X@@ -99,5 +99,17 @@ 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 } X--- openjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h 2010-04-17 21:48:08.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@@ -50,7 +51,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 X #endif X X@@ -130,4 +131,9 @@ X #endif X X X+#if X_PLATFORM == X_BSD X+#define INLINE inline X+#endif X+ X+ X #endif // __SOUNDDEFS_INCLUDED__ X--- openjdk/jdk/src/share/native/common/check_code.c 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/common/check_code.c 2010-04-17 21:48:08.000000000 +0400 X@@ -1069,7 +1069,7 @@ 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 @@ 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 @@ 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 @@ 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 */ X--- openjdk/jdk/src/share/native/java/io/io_util.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/java/io/io_util.h 2010-04-17 21:48:08.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 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 X--- openjdk/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2010-04-17 21:48:08.000000000 +0400 X@@ -25,6 +25,10 @@ X * have any questions. X */ X X+#ifdef __OpenBSD__ X+#include X+#endif X+#include 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 X--- openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h 2010-04-17 21:48:08.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 X--- openjdk/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/java/util/zip/zlib-1.1.3/zconf.h 2010-04-17 21:48:08.000000000 +0400 X@@ -42,44 +42,49 @@ X /* for _LP64 */ X #include 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) X--- openjdk/jdk/src/share/native/sun/awt/debug/debug_util.h 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/debug/debug_util.h 2010-04-17 21:48:09.000000000 +0400 X@@ -50,7 +50,9 @@ X #include X #include X #include X+#if !defined(_ALLBSD_SOURCE) X #include X+#endif X #include X X /* keep these after the other headers */ X--- openjdk/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c 2010-04-17 21:48:09.000000000 +0400 X@@ -24,7 +24,11 @@ X */ X X #include "BufImgSurfaceData.h" X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include "malloc.h" X+#endif X X #include "sun_awt_image_BufImgSurfaceData.h" X X--- openjdk/jdk/src/share/native/sun/awt/image/DataBufferNative.c 2010-04-15 11:35:45.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/image/DataBufferNative.c 2010-04-17 21:48:09.000000000 +0400 X@@ -23,7 +23,11 @@ X * have any questions. X */ X X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include "malloc.h" X+#endif X X #include "SurfaceData.h" X #include "sun_awt_image_DataBufferNative.h" X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv2x2_f.c 2010-04-17 21:48:09.000000000 +0400 X@@ -86,7 +86,7 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c 2010-04-17 21:48:09.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 /***************************************************************/ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c 2010-04-17 21:48:09.000000000 +0400 X@@ -95,7 +95,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 */ X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c 2010-04-17 21:48:09.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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageLookUp_Bit.c 2010-04-17 21:48:09.000000000 +0400 X@@ -88,7 +88,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageUtils.c 2010-04-17 21:48:09.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; X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageCopy.c 2010-04-17 21:48:09.000000000 +0400 X@@ -275,11 +275,11 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_c_ImageLookUp_f.c 2010-04-17 21:48:09.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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h 2010-04-17 21:48:09.000000000 +0400 X@@ -27,6 +27,11 @@ X #ifndef MLIB_IMAGE_H X #define MLIB_IMAGE_H X X+#ifdef __OpenBSD__ X+#include X+#endif X+#include X+ X #include X #include X #include X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c 2010-04-17 21:48:09.000000000 +0400 X@@ -26,9 +26,15 @@ X X #include X #include X+#ifdef _ALLBSD_SOURCE X+#include X+#endif X #include X #include X #include "mlib_SysMath.h" X+#if defined(_ALLBSD_SOURCE) X+#include X+#endif X X /***************************************************************/ X X@@ -86,7 +92,12 @@ 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 } X--- openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2010-04-17 21:48:09.000000000 +0400 X@@ -59,7 +59,10 @@ X X #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__GNUC__) X X-#if defined(__linux__) X+#if defined(_ALLBSD_SOURCE) X+#include /* for ptrdiff_t */ X+#include /* for uintptr_t */ X+#elif defined(__linux__) X #include /* for uintptr_t */ X #include /* for ptrdiff_t */ X #else X--- openjdk/jdk/src/share/native/sun/font/AccelGlyphCache.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/font/AccelGlyphCache.c 2010-04-17 21:48:09.000000000 +0400 X@@ -23,7 +23,11 @@ X * have any questions. X */ X X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X #include "jni.h" X #include "AccelGlyphCache.h" X #include "Trace.h" X--- openjdk/jdk/src/share/native/sun/font/DrawGlyphList.c 2010-04-15 11:35:46.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/font/DrawGlyphList.c 2010-04-17 21:48:09.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" X--- openjdk/jdk/src/share/native/sun/font/sunFont.c 2010-04-15 11:35:47.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/font/sunFont.c 2010-04-17 21:48:09.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" X--- openjdk/jdk/src/share/native/sun/java2d/SurfaceData.c 2010-04-15 11:35:47.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/java2d/SurfaceData.c 2010-04-17 21:48:09.000000000 +0400 X@@ -28,7 +28,11 @@ X #include "jni_util.h" X #include "Disposer.h" X X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include "malloc.h" X+#endif X #include "string.h" X X /** X--- openjdk/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h 2010-04-15 11:35:47.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h 2010-04-17 21:48:09.000000000 +0400 X@@ -26,6 +26,9 @@ X #ifndef OGLFuncs_h_Included X #define OGLFuncs_h_Included X X+#ifdef _ALLBSD_SOURCE X+#include X+#endif X #include "jni.h" X #include "J2D_GL/gl.h" X #include "J2D_GL/glext.h" X--- openjdk/jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c 2010-04-15 11:35:47.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/java2d/opengl/OGLRenderQueue.c 2010-04-17 21:48:09.000000000 +0400 X@@ -25,7 +25,11 @@ X X #ifndef HEADLESS X X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X X #include "sun_java2d_pipe_BufferedOpCodes.h" X X--- openjdk/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c 2010-04-15 11:35:47.000000000 +0400 X+++ openjdk/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c 2010-04-17 21:48:09.000000000 +0400 X@@ -25,7 +25,11 @@ X X #ifndef HEADLESS X X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X #include X #include X X--- openjdk/jdk/src/share/transport/socket/socketTransport.c 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/share/transport/socket/socketTransport.c 2010-04-17 21:48:09.000000000 +0400 X@@ -65,6 +65,9 @@ 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@@ -155,7 +158,7 @@ X } X buf = b; X buf += received; X- n = dbgsysRecv(fd, buf, helloLen-received, 0); X+ n = recv_fully(fd, buf, helloLen-received); X if (n == 0) { X setLastError(0, "handshake failed - connection prematurally closed"); X return JDWPTRANSPORT_ERROR_IO_ERROR; X@@ -180,7 +183,7 @@ X return JDWPTRANSPORT_ERROR_IO_ERROR; X } X X- if (dbgsysSend(fd, (char*)hello, helloLen, 0) != helloLen) { X+ if (send_fully(fd, hello, helloLen) != helloLen) { X RETURN_IO_ERROR("send failed during handshake"); X } X return JDWPTRANSPORT_ERROR_NONE; X@@ -555,19 +558,19 @@ 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@@ -575,13 +578,33 @@ 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 */ X--- openjdk/jdk/src/solaris/back/exec_md.c 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/back/exec_md.c 2010-04-17 21:48:09.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 X--- openjdk/jdk/src/solaris/back/linker_md.c 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/back/linker_md.c 2010-04-17 21:48:09.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 @@ 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 X--- openjdk/jdk/src/solaris/back/util_md.h 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/back/util_md.h 2010-04-17 21:48:09.000000000 +0400 X@@ -29,7 +29,7 @@ X #include X X /* To get uintptr_t */ X-#ifdef LINUX X+#if defined(LINUX) || defined(_ALLBSD_SOURCE) X #include X #else X /* The file stdint.h is not on Solaris 8 machines. */ X@@ -40,6 +40,7 @@ X X #include X #include X+#include X X #ifdef _LP64 X typedef unsigned long UNSIGNED_JLONG; X@@ -55,7 +56,7 @@ 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))) X--- openjdk/jdk/src/solaris/bin/java_md.c 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/bin/java_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -24,6 +24,7 @@ X */ X X #include "java.h" X+#include "jvm_md.h" X #include X #include X #include X@@ -34,17 +35,33 @@ X #include X #include X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#endif X+#ifndef _SC_PHYS_PAGES X+#include 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 X #else X #include 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 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/bin/java_md.h 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/bin/java_md.h 2010-04-17 21:48:09.000000000 +0400 X@@ -58,10 +58,14 @@ X #include 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. X--- openjdk/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2010-04-15 11:35:48.000000000 +0400 X+++ openjdk/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2010-04-17 21:48:09.000000000 +0400 X@@ -403,7 +403,7 @@ 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 @@ 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]); X--- openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2010-04-17 21:48:09.000000000 +0400 X@@ -119,7 +119,11 @@ 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; X--- openjdk/jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java 2010-04-17 21:43:55.000000000 +0400 X+++ openjdk/jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java 2010-04-17 21:48:09.000000000 +0400 X@@ -38,9 +38,6 @@ 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 @@ 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 @@ X // First check for a .java_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 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 @@ 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 @@ 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 } X--- openjdk/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -33,7 +33,7 @@ X #include X #include X X-#ifndef LINUX X+#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) X #include X #endif X X@@ -76,7 +76,7 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/hpi/include/interrupt.h 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/include/interrupt.h 2010-04-17 21:48:09.000000000 +0400 X@@ -75,7 +75,7 @@ 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 @@ 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); X--- openjdk/jdk/src/solaris/hpi/include/largefile.h 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/include/largefile.h 2010-04-17 21:48:09.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 X--- openjdk/jdk/src/solaris/hpi/include/largefile_bsd.h 2010-04-17 21:43:55.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/include/largefile_bsd.h 2010-04-17 21:48:09.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 X #include 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_ */ X--- openjdk/jdk/src/solaris/hpi/native_threads/include/threads_md.h 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/native_threads/include/threads_md.h 2010-04-17 21:48:09.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 @@ 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 @@ 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; X--- openjdk/jdk/src/solaris/hpi/native_threads/src/condvar_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/native_threads/src/condvar_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -58,7 +58,7 @@ 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); X--- openjdk/jdk/src/solaris/hpi/native_threads/src/monitor_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/native_threads/src/monitor_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -147,7 +147,7 @@ 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; X--- openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c 2010-04-17 21:48:09.000000000 +0400 X@@ -39,6 +39,10 @@ X #include X #endif X X+#ifdef __OpenBSD__ X+#include X+#endif X+ X #include X #include X #include 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 X--- openjdk/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c 2010-04-17 21:43:55.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c 2010-04-17 21:48:09.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 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 X-#include X+#include X+#include X+ X+#include X+#if defined(__FreeBSD__) || defined(__OpenBSD__) X+#include X+#endif X+#ifdef __NetBSD__ X+#include 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 X+#include X #include X #include X #include X-#include X #include X #include X-#include X #include X X-#include 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; isys_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 @@ 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"; X--- openjdk/jdk/src/solaris/hpi/src/linker_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/src/linker_md.c 2010-04-17 21:48:09.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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/hpi/src/memory_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/src/memory_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -50,12 +50,24 @@ X #include X #include /* For perror() */ X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#else X #include 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 X #include X #ifdef __linux__ X@@ -73,6 +85,18 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/solaris/hpi/src/system_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/hpi/src/system_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -41,6 +41,7 @@ X #include 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 @@ 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 @@ 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 @@ 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); X--- openjdk/jdk/src/solaris/instrument/EncodingSupport_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/instrument/EncodingSupport_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -28,7 +28,10 @@ X #include X #include X #include X+#ifndef __OpenBSD__ X+#define HAVE_NL_LANGINFO X #include X+#endif X #include X X /* Routines to convert back and forth between Platform Encoding and UTF-8 */ X@@ -63,6 +66,7 @@ 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 @@ 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"); X--- openjdk/jdk/src/solaris/javavm/export/jvm_md.h 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/javavm/export/jvm_md.h 2010-04-17 21:48:09.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 X--- openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c 2010-04-15 11:35:49.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -32,10 +32,16 @@ X X #include X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#else X #include X+#endif X #include X #include X+#ifndef _ALLBSD_SOURCE X #include X+#endif X #include X #include X #include 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 */ X #define _STRUCTURED_PROC 1 X #include 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2010-04-17 21:48:09.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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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) { X--- openjdk/jdk/src/solaris/native/java/io/canonicalize_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/io/canonicalize_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -33,7 +33,9 @@ X #include X #include X #include X+#if !defined(_ALLBSD_SOURCE) X #include X+#endif X X X /* Note: The comments in this file use the terminology X--- openjdk/jdk/src/solaris/native/java/io/io_util_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/io/io_util_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -36,7 +36,7 @@ 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 == '/')) X--- openjdk/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -28,6 +28,11 @@ X #include "jni.h" X #include "jni_util.h" X X+#ifdef __APPLE__ X+#include 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 @@ 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 @@ 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 @@ 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]; X--- openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -40,7 +40,11 @@ X #include X #include X #include X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X #include X #include X #include X@@ -49,6 +53,17 @@ X #include X #include X X+#ifdef __FreeBSD__ X+#include X+#include X+#include X+#endif X+ X+#ifdef __APPLE__ X+#include X+#define environ (*_NSGetEnviron()) X+#endif X+ X #ifndef STDIN_FILENO X #define STDIN_FILENO 0 X #endif X@@ -259,11 +274,89 @@ 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 @@ 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 @@ X X return 1; X } X+#endif /* !__OpenBSD__ */ X X static void X moveDescriptor(int fd_from, int fd_to) X@@ -449,7 +543,9 @@ 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@@ -513,10 +609,15 @@ 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@@ -578,6 +679,30 @@ 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() X--- openjdk/jdk/src/solaris/native/java/lang/java_props_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c 2010-04-17 21:48:09.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 X #include X #endif X@@ -42,9 +42,17 @@ X #include X #include X X+#if defined(_ALLBSD_SOURCE) X+#if !defined(P_tmpdir) X+#include 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ X #else X sprops.unicode_encoding = "UnicodeBig"; X #endif X+#endif /* _ALLBSD_SOURCE */ X X /* user properties */ X { X@@ -405,12 +439,14 @@ 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 } X--- openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -35,17 +35,293 @@ X #include X #include X X+#ifdef _ALLBSD_SOURCE X+#include X+#include 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, "", "()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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; \ X--- openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -32,6 +32,9 @@ X #include X #include X #include X+#ifdef _ALLBSD_SOURCE X+#include /* 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 @@ 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 @@ X } X } X #endif /* AF_INET6 */ X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X } X return (*env)->NewStringUTF(env, hostname); X } X--- openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2010-04-17 21:48:09.000000000 +0400 X@@ -23,13 +23,13 @@ X * have any questions. X */ X X+#include X+#include X #include X #include X #include X #include X #include X-#include X-#include X #include X #include X #include X@@ -47,6 +47,19 @@ X #else X #include X #endif X+#if defined(_ALLBSD_SOURCE) X+#include X+#include X+#if defined(__FreeBSD__) || defined(__APPLE__) X+#include X+#include X+#elif defined(__OpenBSD__) X+#include X+#endif X+#include X+#include X+#include X+#endif X X #ifdef __linux__ X #define ifr_index ifr_ifindex X@@ -584,6 +597,7 @@ X } X X X+#if !defined(_ALLBSD_SOURCE) X /* X * Enumerates and returns all IPv4 interfaces X */ X@@ -694,6 +708,176 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -23,12 +23,12 @@ X * have any questions. X */ X X+#include X+#include X #include X #include X #include X #include X-#include X-#include X X #ifdef __solaris__ X #include X@@ -335,7 +335,7 @@ 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 @@ 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 @@ 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 @@ 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 } X--- openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -528,9 +528,11 @@ 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"); X--- openjdk/jdk/src/solaris/native/java/net/bsd_close.c 2010-04-17 21:43:55.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/bsd_close.c 2010-04-17 21:48:09.000000000 +0400 X@@ -57,7 +57,7 @@ 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 X--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -34,6 +34,15 @@ X #include X #include X X+#ifdef _ALLBSD_SOURCE X+#include X+#include X+#endif X+ X+#ifdef __OpenBSD__ X+#include X+#endif X+ X #ifdef __solaris__ X #include X #include X@@ -219,6 +228,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/native/java/net/net_util_md.h 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.h 2010-04-17 21:48:09.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, X--- openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c 2010-04-17 21:48:09.000000000 +0400 X@@ -38,7 +38,11 @@ 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 @@ 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; X--- openjdk/jdk/src/solaris/native/java/util/FileSystemPreferences.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/util/FileSystemPreferences.c 2010-04-17 21:48:09.000000000 +0400 X@@ -47,8 +47,11 @@ 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 @@ 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 @@ 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); X--- openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -31,7 +31,7 @@ X #include X #include X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X #include X #include X@@ -49,7 +49,7 @@ X #define fileclose fclose X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X X static const char *ETC_TIMEZONE_FILE = "/etc/timezone"; X static const char *ZONEINFO_DIR = "/usr/share/zoneinfo"; X@@ -199,7 +199,9 @@ X int fd; X char *buf; X size_t size; X+ char zoneinfo_file[PATH_MAX+1]; X X+#ifdef __linux__ X /* X * Try reading the /etc/timezone file for Debian distros. There's X * no spec of the file format available. This parsing assumes that X@@ -223,6 +225,7 @@ X return tz; X } X } X+#endif /* __linux__ */ X X /* X * Next, try /etc/localtime to find the zone ID. X@@ -231,6 +234,9 @@ 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@@ -239,21 +245,25 @@ 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(DEFAULT_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 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+ retuen 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@@ -264,7 +274,7 @@ X if (buf == NULL) { X return NULL; X } X- if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { X+ if ((fd = open(zoneinfo_file, O_RDONLY)) == -1) { X free((void *) buf); X return NULL; X } X@@ -493,7 +503,7 @@ 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@@ -532,19 +542,32 @@ 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); X--- openjdk/jdk/src/solaris/native/sun/awt/CUPSfuncs.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/CUPSfuncs.c 2010-04-17 21:48:09.000000000 +0400 X@@ -25,6 +25,7 @@ X X #include X #include X+#include X #include X #include X #include X@@ -65,10 +66,11 @@ 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 } X--- openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c 2010-04-17 21:48:09.000000000 +0400 X@@ -31,7 +31,11 @@ X #endif /* !HEADLESS */ X X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#else X #include X+#endif X X #ifdef __linux__ X /* XXX: Shouldn't be necessary. */ X--- openjdk/jdk/src/solaris/native/sun/awt/X11Color.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/X11Color.c 2010-04-17 21:48:09.000000000 +0400 X@@ -33,7 +33,9 @@ X #include X #include X #include X+#if !defined(_ALLBSD_SOURCE) X #include X+#endif X #ifndef HEADLESS X #include X #include X--- openjdk/jdk/src/solaris/native/sun/awt/XDrawingArea.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/XDrawingArea.c 2010-04-17 21:48:09.000000000 +0400 X@@ -30,7 +30,11 @@ X #include X X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#else X #include X+#endif X X #ifdef DEBUG X #include /* To get jio_fprintf() */ X--- openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c 2010-04-17 21:48:09.000000000 +0400 X@@ -334,7 +334,7 @@ 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 } X--- openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2010-04-17 21:48:09.000000000 +0400 X@@ -40,6 +40,7 @@ X #include X #include X #include X+#include X #include X X #include X@@ -51,6 +52,8 @@ X #include X #include "Trace.h" X X+#include "jvm_md.h" X+ X #ifdef NETSCAPE X #include X extern int awt_init_xt; X@@ -122,7 +125,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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"); X--- openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c 2010-04-17 21:48:09.000000000 +0400 X@@ -69,7 +69,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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(); X--- openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c 2010-04-17 21:48:09.000000000 +0400 X@@ -260,7 +260,11 @@ 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", X--- openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c 2010-04-17 21:48:09.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 @@ 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); X--- openjdk/jdk/src/solaris/native/sun/awt/awt_Mlib.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Mlib.c 2010-04-17 21:48:09.000000000 +0400 X@@ -32,6 +32,7 @@ X #include X #include "jni.h" X #include X+#include "jvm_md.h" X #include "awt_Mlib.h" X #include "java_awt_image_BufferedImage.h" X X@@ -67,11 +68,11 @@ 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) { X--- openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c 2010-04-17 21:48:09.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 X #endif X X--- openjdk/jdk/src/solaris/native/sun/awt/awt_util.h 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_util.h 2010-04-17 21:48:09.000000000 +0400 X@@ -187,15 +187,20 @@ 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. */ X--- openjdk/jdk/src/solaris/native/sun/awt/awt_wm.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_wm.c 2010-04-17 21:48:09.000000000 +0400 X@@ -121,12 +121,19 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 { X--- openjdk/jdk/src/solaris/native/sun/awt/awt_wm.h 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/awt_wm.h 2010-04-17 21:48:09.000000000 +0400 X@@ -45,7 +45,10 @@ 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); X--- openjdk/jdk/src/solaris/native/sun/awt/extutil.h 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/extutil.h 2010-04-17 21:48:09.000000000 +0400 X@@ -58,7 +58,7 @@ 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 @@ X char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) X #endif X X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X--- openjdk/jdk/src/solaris/native/sun/awt/fontpath.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/fontpath.c 2010-04-17 21:48:09.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 X #endif /* __linux__ */ X #include X@@ -40,6 +40,7 @@ X X #include X #include X+#include X #include X #ifndef HEADLESS X #include 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ X } X X #include X-#ifndef __linux__ /* i.e. is solaris */ X+#if !(defined(__linux__) || defined(__APPLE__)) X #include X #endif X X@@ -654,9 +688,9 @@ 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 } X--- openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.c 2010-04-17 21:48:09.000000000 +0400 X@@ -30,8 +30,9 @@ X #include 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) X--- openjdk/jdk/src/solaris/native/sun/awt/list.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/list.c 2010-04-17 21:48:09.000000000 +0400 X@@ -66,7 +66,11 @@ X ----------------------------------------------------------------------- **/ X X #include X+#ifdef _ALLBSD_SOURCE X+#include X+#else X #include X+#endif X #include "list.h" X X X--- openjdk/jdk/src/solaris/native/sun/awt/robot_common.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/awt/robot_common.c 2010-04-17 21:48:09.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 X+#endif X #include "robot_common.h" X X /* X--- openjdk/jdk/src/solaris/native/sun/font/X11FontScaler.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/font/X11FontScaler.c 2010-04-17 21:48:09.000000000 +0400 X@@ -32,7 +32,11 @@ X * into X11FontScaler_md.c, which is compiled into another library. X */ X #include X+#if defined(_ALLBSD_SOURCE) X+#include X+#else X #include X+#endif X #include X #include X X--- openjdk/jdk/src/solaris/native/sun/font/X11TextRenderer.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/font/X11TextRenderer.c 2010-04-17 21:48:09.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 X+#else X #include X+#endif X X X JNIEXPORT void JNICALL AWTDrawGlyphList X--- openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h 2010-04-17 21:48:09.000000000 +0400 X@@ -28,11 +28,11 @@ X #include X X /* X- * Linux version of does not define intptr_t X+ * Linux and BSD's version of does not define intptr_t X */ X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X-#endif /* __linux__ */ X+#endif /* __linux__ || _ALLBSD_SOURCE */ X X typedef unsigned char jubyte; X typedef unsigned short jushort; X--- openjdk/jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c 2010-04-15 11:35:50.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/java2d/loops/mlib_ImageZoom_NN.c 2010-04-17 21:48:09.000000000 +0400 X@@ -66,6 +66,10 @@ X * MLIB_EDGE_SRC_PADDED X */ X X+#ifdef __OpenBSD__ X+#include X+#endif X+#include X #include X #include X X@@ -102,7 +106,7 @@ 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 @@ 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 @@ X 0xFFFF0000u, 0xFFFF00FFu, 0xFFFFFF00u, 0xFFFFFFFFu X }; X X-#endif /* _LITTLE_ENDIAN */ X+#endif /* LITTLE_ENDIAN */ X X /***************************************************************/ X X@@ -344,11 +348,11 @@ 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 @@ 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 @@ 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 */ X--- openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c 2010-04-17 21:48:09.000000000 +0400 X@@ -794,7 +794,7 @@ 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" X--- openjdk/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h 2010-04-17 21:48:09.000000000 +0400 X@@ -27,7 +27,10 @@ X #define OGLFuncs_md_h_Included X X #include X+#ifndef __APPLE__ X #include X+#endif X+#include "jvm_md.h" X #include "J2D_GL/glx.h" X #include "OGLFuncMacros.h" X X@@ -113,7 +116,7 @@ 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 } \ X--- openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c 2010-04-17 21:48:09.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 @@ 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) { X--- openjdk/jdk/src/solaris/native/sun/jdga/dgalock.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/jdga/dgalock.c 2010-04-17 21:48:09.000000000 +0400 X@@ -44,6 +44,7 @@ X #include X X #include "jni.h" X+#include "jvm_md.h" X #include "jdga.h" X #include "jdgadevice.h" X X@@ -84,10 +85,10 @@ 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)) { X--- openjdk/jdk/src/solaris/native/sun/management/FileSystemImpl.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/management/FileSystemImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -26,6 +26,10 @@ X #include X #include 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" X--- openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -33,7 +33,7 @@ X #include X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X #endif X X--- openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c 2010-04-17 21:48:09.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 X #include X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X #else X #include X@@ -109,8 +110,9 @@ 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) { X--- openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c 2010-04-17 21:48:09.000000000 +0400 X@@ -35,7 +35,7 @@ X #include X #include X X-#if __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X #endif X X@@ -86,7 +86,7 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c 2010-04-15 03:35:51.000000000 -0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c 2010-05-13 14:13:21.000000000 -0400 X@@ -72,7 +72,7 @@ X m.msg_accrightslen = 0; X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X m.msg_control = NULL; X m.msg_controllen = 0; X #endif X@@ -120,7 +120,7 @@ X m.msg_accrightslen = 0; X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X m.msg_control = NULL; X m.msg_controllen = 0; X #endif X--- openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c 2010-05-13 14:13:26.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 X #include X+#include X #include "sun_nio_ch_FileChannelImpl.h" X #include "java_lang_Integer.h" X #include "nio.h" X #include "nio_util.h" X #include 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,24 @@ 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 X+#include X+#include X+#include X+#include X+ X+#ifdef __APPLE__ X+typedef int sendfile_func(int fd, int s, off_t offset, off_t *len, X+ struct sf_hdtr *hdtr, int flags); X+#elif defined(__FreeBSD__) X+typedef int sendfile_func(int fd, int s, off_t offset, size_t nbytes, X+ struct sf_hdtr *hdtr, off_t *sbytes, int flags); X+#endif X+ X+#if defined(__APPLE__) || defined(__FreeBSD__) X+sendfile_func* my_sendfile_func = NULL; X+#endif X #endif X X JNIEXPORT jlong JNICALL X@@ -68,7 +92,8 @@ 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@@ -77,6 +102,10 @@ X my_sendfile64_func = (sendfile64_func*) dlsym(RTLD_DEFAULT, "sendfile64"); X #endif X X+#if defined(__APPLE__) || defined(__FreeBSD__) X+ my_sendfile_func = (sendfile_func*) dlsym(RTLD_DEFAULT, "sendfile"); X+#endif X+ X return pageSize; X } X X@@ -278,6 +307,48 @@ X return result; X } X #endif X+ X+#ifdef _ALLBSD_SOURCE X+#if defined(__APPLE__) || defined(__FreeBSD__) X+ if (my_sendfile_func == NULL) X+ return IOS_UNSUPPORTED; X+ X+ off_t numBytes; X+ int result; X+ X+ numBytes = count; X+ X+#ifdef __APPLE__ X+ result = (*my_sendfile_func)(srcFD, dstFD, position, X+ &numBytes, NULL, 0); X+#elif defined(__FreeBSD__) X+ result = (*my_sendfile_func)(srcFD, dstFD, position, X+ count, NULL, &numBytes, 0); X+#else X+ Add an #elif for your BSD flavor X+#endif X+ X+ if (numBytes > 0) X+ return numBytes; X+ X+ if (result == -1) { X+ if (errno == EAGAIN) X+ return IOS_UNAVAILABLE; X+ if (errno == EOPNOTSUPP || errno == ENOTSOCK || errno == ENOTCONN) X+ return IOS_UNSUPPORTED_CASE; X+ if ((errno == EINVAL) && ((ssize_t)count >= 0)) X+ return IOS_UNSUPPORTED_CASE; X+ if (errno == EINTR) X+ return IOS_INTERRUPTED; X+ JNU_ThrowIOExceptionWithLastError(env, "Transfer failed"); X+ return IOS_THROWN; X+ } X+ X+ return result; X+#else X+ return IOS_UNSUPPORTED; X+#endif X+#endif X } X X JNIEXPORT jint JNICALL X@@ -329,6 +400,23 @@ 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 } X--- openjdk/jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/FileDispatcher.c 2010-04-17 21:48:09.000000000 +0400 X@@ -32,8 +32,12 @@ X #include X #include X #include X+#include 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 */ X--- openjdk/jdk/src/solaris/native/sun/nio/ch/FileKey.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/FileKey.c 2010-04-17 21:48:09.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 X--- openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c 2010-04-17 21:48:09.000000000 +0400 X@@ -140,8 +140,31 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; X--- openjdk/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c 2010-04-17 21:48:09.000000000 +0400 X@@ -26,7 +26,9 @@ X #include X #include X #include X+#ifndef __APPLE__ X #include X+#endif X #include "NativeFunc.h" X X /* standard GSS method names (ordering is from mapfile) */ X--- openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -28,12 +28,19 @@ X #include X X #include X+#ifndef __APPLE__ X #include X+#endif X X #include 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 @@ 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 @@ 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 X--- openjdk/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -64,7 +64,9 @@ X #include X X #include X+#ifndef __APPLE__ X #include X+#endif X X #include X X--- openjdk/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -29,7 +29,9 @@ X #include X X #include X+#ifndef __APPLE__ X #include X+#endif X X #include X X--- openjdk/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c 2010-04-17 21:43:55.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c 2010-04-17 21:48:09.000000000 +0400 X@@ -35,10 +35,10 @@ X #include X #include X #include X-#include X #include X #include X #include X+#include 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 @@ 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 @@ 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 @@ 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 @@ 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+} X--- openjdk/jdk/src/solaris/native/sun/xawt/XWindow.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/xawt/XWindow.c 2010-04-17 21:48:09.000000000 +0400 X@@ -228,10 +228,10 @@ 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 @@ 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. X--- openjdk/jdk/src/solaris/native/sun/xawt/awt_Desktop.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/native/sun/xawt/awt_Desktop.c 2010-04-17 21:48:09.000000000 +0400 X@@ -24,6 +24,7 @@ X */ X X #include X+#include X #include X X typedef int gboolean; X@@ -36,7 +37,7 @@ 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 @@ 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"); X--- openjdk/jdk/src/solaris/npt/npt_md.h 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/npt/npt_md.h 2010-04-17 21:48:09.000000000 +0400 X@@ -32,9 +32,10 @@ X #include X #include X #include X+#ifndef __APPLE__ X #include X- X-#define NPT_LIBNAME "libnpt.so" X+#endif X+#include 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"); \ X--- openjdk/jdk/src/solaris/transport/socket/socket_md.c 2010-04-15 11:35:51.000000000 +0400 X+++ openjdk/jdk/src/solaris/transport/socket/socket_md.c 2010-04-17 21:48:09.000000000 +0400 X@@ -36,7 +36,7 @@ X #ifdef __solaris__ X #include X #endif X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X #include X #include X #endif X@@ -283,7 +283,7 @@ X X #endif X X-#ifdef __linux__ X+#if defined(__linux__) || defined(_ALLBSD_SOURCE) X int X dbgsysTlsAlloc() { X pthread_key_t key; X--- openjdk/langtools/src/share/classes/com/sun/tools/javah/Util.java 2010-04-15 11:36:33.000000000 +0400 X+++ openjdk/langtools/src/share/classes/com/sun/tools/javah/Util.java 2010-04-17 21:48:09.000000000 +0400 X@@ -180,6 +180,14 @@ 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; X--- openjdk/corba/make/common/Defs-bsd.gmk.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/corba/make/common/Defs-bsd.gmk 2010-07-08 18:44:59.000000000 +0000 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 @@ 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 @@ 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 @@ 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+ X+ifneq ($(OS_VENDOR), Apple) X LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) 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 @@ 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 @@ 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 @@ 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--- openjdk/hotspot/agent/src/os/bsd/ps_core.c.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/agent/src/os/bsd/ps_core.c 2010-07-08 18:46:32.000000000 +0000 X@@ -142,6 +142,7 @@ 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@@ -240,7 +241,7 @@ 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@@ -250,7 +251,7 @@ 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@@ -264,7 +265,7 @@ 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@@ -504,12 +505,12 @@ 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@@ -517,6 +518,13 @@ X return false; X } 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+ X static ps_prochandle_ops core_ops = { X .release= core_release, X .p_pread= core_read_data, X@@ -536,52 +544,52 @@ 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@@ -823,7 +831,7 @@ 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@@ -833,19 +841,23 @@ 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@@ -867,14 +879,14 @@ 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@@ -918,7 +930,7 @@ 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@@ -932,7 +944,6 @@ 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) { X--- openjdk/hotspot/make/bsd/makefiles/defs.make.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/make/bsd/makefiles/defs.make 2010-07-08 18:48:46.000000000 +0000 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 @@ 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,15 @@ 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_CLIENT_DIR)/libjsig.$(LIBRARY_SUFFIX) X+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) X+ EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) 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_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) X+ EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar X endif X--- openjdk/hotspot/make/bsd/makefiles/gcc.make.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/make/bsd/makefiles/gcc.make 2010-07-08 18:49:39.000000000 +0000 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@@ -55,7 +58,7 @@ 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@@ -65,6 +68,15 @@ 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@@ -98,6 +110,11 @@ 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@@ -133,20 +150,40 @@ 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 X--- openjdk/hotspot/make/bsd/makefiles/vm.make.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/make/bsd/makefiles/vm.make 2010-07-08 18:50:35.000000000 +0000 X@@ -95,7 +95,7 @@ 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@@ -110,7 +110,11 @@ 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@@ -124,7 +128,8 @@ X rm -f $@ X cat $^ > $@ X X-STATIC_CXX = true X+# On BSD shared object could not be linked with static libstd++ X+STATIC_CXX = false X X ifeq ($(LINK_INTO),AOUT) X LIBJVM.o = X@@ -177,11 +182,6 @@ 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--- openjdk/hotspot/make/Makefile.orig 2010-02-17 03:11:04.000000000 +0000 X+++ openjdk/hotspot/make/Makefile 2010-07-08 18:53:28.000000000 +0000 X@@ -265,6 +265,19 @@ 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@@ -275,6 +288,7 @@ X $(install-file) X $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so X $(install-file) X+ endif X endif X X # Jar file (sa-jdi.jar) X--- openjdk/hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/src/os/bsd/vm/os_bsd.cpp 2010-07-08 18:25:31.000000000 +0000 X@@ -42,17 +42,39 @@ X # include X # include X # include X+# include X # include X # include X # include X # include X # include X+#ifdef _ALLBSD_SOURCE X+# include X+# include X+#else X # include X # include X # include X+#endif X # include X # include X+ X+#ifndef __APPLE__ X # include X+#endif X+ X+#if defined(__FreeBSD__) || defined(__NetBSD__) X+# include X+#endif X+ X+#ifdef __APPLE__ X+#include // semaphore_* API X+#include X+#endif X+ X+#ifndef MAP_ANONYMOUS X+#define MAP_ANONYMOUS MAP_ANON X+#endif X X #define MAX_PATH (2 * K) X X@@ -64,19 +86,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@@ -94,8 +122,6 @@ X static int SR_signum = SIGUSR2; X sigset_t SR_sigset; X X-/* Used to protect dlsym() calls */ X-static pthread_mutex_t dl_mutex; X X //////////////////////////////////////////////////////////////////////////////// X // utility functions X@@ -108,11 +134,16 @@ 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 // 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 +191,7 @@ 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 +206,7 @@ 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 +226,7 @@ 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 +253,47 @@ 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 +310,7 @@ 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 +431,11 @@ 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 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 +594,7 @@ X } X } X X+#ifndef _ALLBSD_SOURCE X ////////////////////////////////////////////////////////////////////////////// X // detecting pthread library X X@@ -567,15 +647,15 @@ X } X X if (strstr(libpthread_version(), "NPTL")) { X- os::Bsd::set_is_NPTL(); X+ os::Bsd::set_is_NPTL(); X } else { X- os::Bsd::set_is_BsdThreads(); X+ os::Bsd::set_is_BsdThreads(); X } X X // BsdThreads have two flavors: floating-stack mode, which allows variable X // stack size; and fixed-stack mode. NPTL is always floating-stack. X if (os::Bsd::is_NPTL() || os::Bsd::supports_variable_stack_size()) { X- os::Bsd::set_is_floating_stack(); X+ os::Bsd::set_is_floating_stack(); X } X } X X@@ -678,6 +758,7 @@ X } X return false; X } X+#endif X X ////////////////////////////////////////////////////////////////////////////// X // create new thread X@@ -686,6 +767,9 @@ 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@@ -719,6 +803,7 @@ 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@@ -746,6 +831,10 @@ 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@@ -755,6 +844,7 @@ 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@@ -835,17 +925,22 @@ 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@@ -859,7 +954,9 @@ 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@@ -875,9 +972,11 @@ 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@@ -915,7 +1014,11 @@ 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@@ -926,6 +1029,7 @@ 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@@ -952,6 +1056,7 @@ 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@@ -1010,6 +1115,7 @@ 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@@ -1243,6 +1349,7 @@ 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@@ -1264,9 +1371,7 @@ X return (1000 * 1000); X } X X-// For now, we say that bsd does not support vtime. I have no idea X-// whether it can actually be made to (DLD, 9/13/05). X- X+// XXX: For now, code this as if BSD does not support vtime. X bool os::supports_vtime() { return false; } X bool os::enable_vtime() { return false; } X bool os::vtime_enabled() { return false; } X@@ -1286,6 +1391,21 @@ 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@@ -1321,7 +1441,9 @@ X } X } X } X+#endif X X+#ifndef _ALLBSD_SOURCE X #ifndef SYS_clock_getres X X #if defined(IA32) || defined(AMD64) X@@ -1360,6 +1482,7 @@ X _pthread_getcpuclockid = pthread_getcpuclockid_func; X } X } X+#endif X X jlong os::javaTimeNanos() { X if (Bsd::supports_monotonic_clock()) { X@@ -1510,7 +1633,14 @@ 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@@ -1528,13 +1658,13 @@ X const size_t pnamelen = pname ? strlen(pname) : 0; X X // Quietly truncate on buffer overflow. Should be an error. X- if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { X- *buffer = '\0'; X- return; X+ if (pnamelen + strlen(fname) + strlen(JNI_LIB_PREFIX) + strlen(JNI_LIB_SUFFIX) + 2 > buflen) { X+ *buffer = '\0'; X+ return; X } X X if (pnamelen == 0) { X- snprintf(buffer, buflen, "lib%s.so", fname); X+ snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname); X } else if (strchr(pname, *os::path_separator()) != NULL) { X int n; X char** pelements = split_path(pname, &n); X@@ -1543,7 +1673,8 @@ X if (pelements[i] == NULL || strlen(pelements[i]) == 0) { X continue; // skip the empty path values X } X- snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname); X+ snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, X+ pelements[i], fname); X if (file_exists(buffer)) { X break; X } X@@ -1558,7 +1689,7 @@ X FREE_C_HEAP_ARRAY(char*, pelements); X } X } else { X- snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); X+ snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname); X } X } X X@@ -1599,6 +1730,23 @@ 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@@ -1673,11 +1821,27 @@ 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@@ -1730,6 +1894,18 @@ 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 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@@ -1810,17 +1986,11 @@ X X return NULL; X } X+#endif /* !__APPLE__ */ X X-/* X- * glibc-2.0 libdl is not MT safe. If you are building with any glibc, X- * chances are you might want to run the generated bits against glibc-2.0 X- * libdl.so, so always use locking for any version of glibc. X- */ X+// XXX: Do we need a lock around this as per Linux? X void* os::dll_lookup(void* handle, const char* name) { X- pthread_mutex_lock(&dl_mutex); X- void* res = dlsym(handle, name); X- pthread_mutex_unlock(&dl_mutex); X- return res; X+ return dlsym(handle, name); X } X X X@@ -1843,7 +2013,51 @@ 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@@ -1852,6 +2066,7 @@ 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@@ -1884,6 +2099,7 @@ 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@@ -1898,6 +2114,7 @@ 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@@ -1923,6 +2140,7 @@ 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@@ -1935,6 +2153,7 @@ 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@@ -1942,18 +2161,22 @@ 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@@ -2180,19 +2403,29 @@ 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@@ -2214,7 +2447,7 @@ 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@@ -2225,7 +2458,7 @@ 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@@ -2313,36 +2546,27 @@ X } X X void os::numa_make_global(char *addr, size_t bytes) { X- Bsd::numa_interleave_memory(addr, bytes); X } X X void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { X- Bsd::numa_tonode_memory(addr, bytes, lgrp_hint); X } X X bool os::numa_topology_changed() { return false; } X X size_t os::numa_get_groups_num() { X- int max_node = Bsd::numa_max_node(); X- return max_node > 0 ? max_node + 1 : 1; X+ return 1; X } X X int os::numa_get_group_id() { X- int cpu_id = Bsd::sched_getcpu(); X- if (cpu_id != -1) { X- int lgrp_id = Bsd::get_node_by_cpu(cpu_id); X- if (lgrp_id != -1) { X- return lgrp_id; X- } X- } X return 0; X } X X size_t os::numa_get_leaf_groups(int *ids, size_t size) { X- for (size_t i = 0; i < size; i++) { X- ids[i] = i; X+ if (size > 0) { X+ ids[0] = 0; X+ return 1; X } X- return size; X+ return 0; X } X X bool os::get_page_info(char *start, page_info* info) { X@@ -2353,6 +2577,7 @@ X return end; X } X X+#ifndef _ALLBSD_SOURCE X extern "C" void numa_warn(int number, char *where, ...) { } X extern "C" void numa_error(char *where) { } X X@@ -2548,6 +2773,9 @@ 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@@ -2602,6 +2830,7 @@ 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@@ -2776,7 +3005,7 @@ X } X X size_t os::read(int fd, void *buf, unsigned int nBytes) { X- return ::read(fd, buf, nBytes); X+ RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes)); X } X X // TODO-FIXME: reconcile Solaris' os::sleep with the bsd variation. X@@ -2912,6 +3141,44 @@ 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@@ -2929,6 +3196,7 @@ X X -5 // 10 MaxPriority X }; X+#endif X X static int prio_init() { X if (ThreadPriorityPolicy == 1) { X@@ -2948,8 +3216,28 @@ 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__) || defined(__NetBSD__) 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@@ -2959,7 +3247,17 @@ X } X X errno = 0; X+#if defined(__OpenBSD__) || defined(__FreeBSD__) X+ *priority_ptr = pthread_getprio(thread->osthread()->pthread_id()); X+#elif defined(__APPLE__) || defined(__NetBSD__) 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@@ -3069,7 +3367,7 @@ 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@@ -3412,6 +3710,28 @@ 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@@ -3432,6 +3752,7 @@ 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@@ -3446,6 +3767,7 @@ 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@@ -3667,13 +3989,13 @@ 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@@ -3686,7 +4008,16 @@ X X Bsd::clock_init(); X initial_time_count = os::elapsed_counter(); X- pthread_mutex_init(&dl_mutex, NULL); 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@@ -3699,7 +4030,9 @@ 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@@ -3748,6 +4081,7 @@ 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@@ -3770,6 +4104,7 @@ X UseNUMA = true; X } X } X+#endif X X if (MaxFDLimit) { X // set the number of file descriptors to max. print out error X@@ -3781,6 +4116,14 @@ 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@@ -3789,8 +4132,10 @@ 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@@ -3838,11 +4183,15 @@ X }; X X int os::active_processor_count() { X+#ifdef _ALLBSD_SOURCE X+ return _processor_count; X+#else 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@@ -3884,6 +4233,9 @@ 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@@ -3899,6 +4251,7 @@ X #endif // IA64 X return status; X } X+#endif X } X X //////////////////////////////////////////////////////////////////////////////// X@@ -4034,17 +4387,17 @@ 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@@ -4094,6 +4447,7 @@ 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@@ -4105,6 +4459,7 @@ 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@@ -4114,39 +4469,71 @@ 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@@ -4235,6 +4622,7 @@ 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@@ -4251,7 +4639,13 @@ 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@@ -4384,7 +4778,7 @@ 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@@ -4436,7 +4830,7 @@ 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@@ -4494,10 +4888,10 @@ 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@@ -4589,7 +4983,7 @@ 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@@ -4648,7 +5042,7 @@ 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@@ -4701,7 +5095,7 @@ 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@@ -4743,14 +5137,12 @@ X } X X X+/* Darwin has no "environ" in a dynamic library. */ X+#ifdef __APPLE__ X+#include 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@@ -4765,8 +5157,7 @@ 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@@ -4782,8 +5173,7 @@ 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); X--- openjdk/hotspot/src/os/bsd/vm/os_bsd.hpp.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/hotspot/src/os/bsd/vm/os_bsd.hpp 2010-07-08 18:57:32.000000000 +0000 X@@ -27,6 +27,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@@ -47,6 +53,7 @@ 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@@ -58,6 +65,7 @@ X static bool _is_floating_stack; X static bool _is_NPTL; X static bool _supports_fast_thread_cpu_time; X+#endif X X static GrowableArray* _cpu_to_node; X X@@ -65,38 +73,52 @@ 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 static void rebuild_cpu_to_node_map(); X static GrowableArray* cpu_to_node() { return _cpu_to_node; } X public: 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 static bool is_initial_thread(void); X X static int page_size(void) { return _page_size; } X@@ -133,6 +155,7 @@ 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@@ -147,7 +170,7 @@ X X static void libpthread_init(); X static bool libnuma_init(); X- X+#endif X // Minimum stack size a thread can be created with (allowing X // the VM to completely create the thread and enter user code) X static size_t min_stack_allowed; X@@ -156,17 +179,21 @@ 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@@ -176,6 +203,7 @@ 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@@ -185,6 +213,7 @@ X } X X static jlong fast_thread_cpu_time(clockid_t clockid); X+#endif X X // Stack repair handling X X--- openjdk/hotspot/src/share/vm/runtime/os.cpp.orig 2010-02-17 03:11:10.000000000 +0000 X+++ openjdk/hotspot/src/share/vm/runtime/os.cpp 2010-07-08 18:58:53.000000000 +0000 X@@ -80,7 +80,11 @@ X return NULL; X } X X+#if defined(_ALLBSD_SOURCE) X+ const time_t zone = (time_t) time_struct.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 X--- openjdk/jdk/make/common/Defs-bsd.gmk.orig 2010-07-08 18:25:30.000000000 +0000 X+++ openjdk/jdk/make/common/Defs-bsd.gmk 2010-07-08 19:00:21.000000000 +0000 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 @@ 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 @@ 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@@ -184,7 +182,7 @@ 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@@ -194,33 +192,15 @@ 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@@ -242,9 +222,9 @@ X ifeq ($(VARIANT), OPT) X ifneq ($(NO_STRIP), true) X ifneq ($(DEBUG_BINARIES), true) X- # Debug 'strip -g' leaves local function Elf symbols (better stack X+ # Debug 'strip -S' leaves local function Elf symbols (better stack X # traces) X- POST_STRIP_PROCESS = $(STRIP) -g X+ POST_STRIP_PROCESS = $(STRIP) -S X endif X endif X endif X@@ -254,13 +234,9 @@ 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@@ -289,7 +265,9 @@ 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@@ -300,13 +278,9 @@ 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@@ -327,6 +301,14 @@ 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 # e1f70f95ed7382a6cea41512ca6370dc echo x - icedtea6-plugin/files/patch-patches-xrender-icedtea-002.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-xrender-icedtea-002.patch << '37ead304072a815863117482b48dc5a2' X--- patches/xrender/icedtea-002.patch.orig 2010-07-09 13:34:22.000000000 +0000 X+++ patches/xrender/icedtea-002.patch 2010-07-09 13:36:19.000000000 +0000 X@@ -6,14 +6,14 @@ X Summary: Comments, bug fixes, initial solaris work X X diff -r 6d294fa2bd42 -r 4b11af86e814 make/sun/xawt/Makefile X---- openjdk/jdk/make/sun/xawt/Makefile Sat Jul 26 00:13:41 2008 +0200 X-+++ openjdk/jdk/make/sun/xawt/Makefile Fri Aug 01 22:43:51 2008 +0200 X-@@ -86,7 +86,7 @@ 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 -lXrender -ldl \ X-+OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender -ldl -lm \ X+--- openjdk/jdk/make/sun/xawt/Makefile.orig 2010-07-09 13:33:30.000000000 +0000 X++++ openjdk/jdk/make/sun/xawt/Makefile 2010-07-09 13:35:27.000000000 +0000 X+@@ -96,7 +96,7 @@ X+ else X+ LIBDL=-ldl X+ endif X+-OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) \ X++OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender -lm $(LIBDL) \ X $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi X X ifeq ($(PLATFORM), solaris) 37ead304072a815863117482b48dc5a2 echo x - icedtea6-plugin/files/patch-patches-zero-6890308.patch sed 's/^X//' >icedtea6-plugin/files/patch-patches-zero-6890308.patch << '6adf15430e186116803ead52308e9c00' X--- patches/zero/6890308.patch.orig 2010-07-08 19:28:24.000000000 +0000 X+++ patches/zero/6890308.patch 2010-07-08 19:31:57.000000000 +0000 X@@ -1,6 +1,6 @@ X diff -r 03b336640699 -r 354d3184f6b2 make/Makefile X---- openjdk/hotspot/make/Makefile Wed Oct 07 15:38:37 2009 -0700 X-+++ openjdk/hotspot/make/Makefile Tue Oct 13 12:04:21 2009 -0700 X+--- openjdk/hotspot/make/Makefile.orig 2010-07-08 19:27:17.000000000 +0000 X++++ openjdk/hotspot/make/Makefile 2010-07-08 19:29:56.000000000 +0000 X @@ -84,6 +84,7 @@ X C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1 X C2_VM_TARGETS=product fastdebug optimized jvmg X@@ -72,28 +72,28 @@ X X # Bin files (windows) X ifeq ($(OSNAME),windows) X-@@ -265,6 +289,12 @@ X+@@ -261,6 +285,7 @@ X+ $(install-file) X+ $(EXPORT_KERNEL_DIR)/%.map: $(KERNEL_DIR)/%.map X+ $(install-file) X++ endif X+ endif X X # Shared Library X- ifneq ($(OSNAME),windows) X+@@ -278,6 +303,12 @@ X+ $(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) X+ $(install-file) X+ else X + ifeq ($(ZERO_BUILD), true) X +$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so X-+ $(install-file) X++ $(install-file) X +$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so X-+ $(install-file) 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-@@ -275,6 +305,7 @@ X- $(install-file) X- $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so X- $(install-file) X-+ endif X- endif X- X- # Jar file (sa-jdi.jar) X-@@ -313,6 +344,7 @@ X+@@ -330,6 +361,7 @@ X $(RM) -r $(C1_DIR) X $(RM) -r $(C2_DIR) X $(RM) -r $(KERNEL_DIR) X@@ -101,7 +101,7 @@ X clean_export: X $(RM) -r $(EXPORT_PATH) X clean_jdk: X-@@ -335,8 +367,10 @@ X+@@ -352,8 +384,10 @@ X ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -) X X test_jdk: 6adf15430e186116803ead52308e9c00 echo x - icedtea6-plugin/Makefile sed 's/^X//' >icedtea6-plugin/Makefile << '671f20aec1570ed3082ddad80cecc9cc' X# New ports collection makefile for: icedtea6-plugin X# Date created: 06 July 2010 X# Whom: Beat Gaetzi X# X# $FreeBSD$ X# X XPORTNAME= icedtea6-plugin XPORTVERSION= 1.8 XCATEGORIES= www java XMASTER_SITES= http://icedtea.classpath.org/download/source/ \ X ${MASTER_SITE_SOURCEWARE:S|$|:ecj|} \ X https://jaxp.dev.java.net/files/documents/913/147329/:jaxp \ X http://download.java.net/openjdk/jdk6/promoted/b18/:ojdk XMASTER_SITE_SUBDIR+= java/:ecj XDISTFILES= ${PORTNAME:C/-plugin//}-${PORTVERSION}${EXTRACT_SUFX} \ X ${ECJ_JAR}:ecj \ X ${JAXP_ZIP}:jaxp \ X ${OJDK_TGZ}:ojdk XEXTRACT_ONLY= ${DISTFILES:S|${ECJ_JAR}:ecj||:S|${JAXP_ZIP}:jaxp||:S|${OJDK_TGZ}:ojdk||} X X# XXX: Find a maintainer XMAINTAINER= beat@FreeBSD.org XCOMMENT= A free plugin with LiveConnect and Java Web Start support X X# XXX: Patch out wget dependency as we download the distfiles during fetch target XBUILD_DEPENDS= wget:${PORTSDIR}/ftp/wget \ X zip:${PORTSDIR}/archivers/zip \ X unzip:${PORTSDIR}/archivers/unzip \ X gawk:${PORTSDIR}/lang/gawk \ X ant:${PORTSDIR}/devel/apache-ant \ X ${JAVALIBDIR}/xalan.jar:${PORTSDIR}/textproc/xalan-j \ X ${JAVALIBDIR}/xercesImpl.jar:${PORTSDIR}/textproc/xerces-j \ X ${JAVASHAREDIR}/rhino/rhino.jar:${PORTSDIR}/lang/rhino \ X ${LOCALBASE}/include/cups/cups.h:${PORTSDIR}/print/cups-client XLIB_DEPENDS= nss3:${PORTSDIR}/security/nss \ X gif.5:${PORTSDIR}/graphics/giflib X XWRKSRC= ${WRKDIR}/${PORTNAME:C/-plugin/-1.8/} XGNU_CONFIGURE= yes XJAVA_VENDOR= openjdk XJAVA_VERSION= 1.6 XUSE_GECKO= libxul XUSE_GMAKE= yes XUSE_JAVA= yes X XPLIST_FILES= lib/netscape/plugins/IcedTeaPlugin.so XPLIST_DIRS= lib/netscape/plugins lib/netscape X XCONFIGURE_ARGS= --with-gcj-home=${LOCALBASE}/openjdk6 \ X --with-ecj-jar=${DISTDIR}/${ECJ_JAR} \ X --with-jaxp-drop-zip=${DISTDIR}/${JAXP_ZIP} \ X --with-openjdk-src-dir=${DISTDIR}/${OJDK_TGZ} \ X --with-xalan2-jar=${JAVALIBDIR}/xalan.jar \ X --with-xalan2-serializer-jar=${JAVALIBDIR}/serializer.jar \ X --with-xerces2-jar=${JAVALIBDIR}/xercesImpl.jar \ X --with-rhino=${JAVASHAREDIR}/rhino/rhino.jar \ X --with-openjdk=${LOCALBASE}/openjdk6 \ X --disable-docs \ X --disable-dependency-tracking XCONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" X XECJ_JAR= ecj-4.5.jar XJAXP_ZIP= jdk6-jaxp-2009_10_13.zip XOJDK_TGZ= openjdk-6-src-b18-16_feb_2010.tar.gz X XCOPYDIRS= \ X openjdk/hotspot/src/os/linux/launcher \ X openjdk/hotspot/src/os/linux/vm \ X openjdk/hotspot/src/os_cpu/linux_x86/vm \ X openjdk/hotspot/agent/src/os/linux \ X openjdk/hotspot/make/linux \ X openjdk/hotspot/make/linux/makefiles \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64 \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86 \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_amd64 \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_x86 \ X openjdk/jdk/src/linux/doc/man X XCOPYFILES= \ X openjdk/corba/make/common/Defs-linux.gmk \ X openjdk/corba/make/common/shared/Defs-linux.gmk \ X openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java \ X openjdk/jdk/make/com/sun/tools/attach/mapfile-linux \ X openjdk/jdk/make/common/Defs-linux.gmk \ X openjdk/jdk/make/common/shared/Defs-linux.gmk \ X openjdk/jdk/make/java/nio/mapfile-linux \ X openjdk/jdk/make/netbeans/common/architectures/name-Linux.properties \ X openjdk/jdk/make/sun/awt/mapfile-vers-linux \ X openjdk/jdk/make/tools/sharing/classlist.linux \ X openjdk/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux \ X openjdk/jdk/src/solaris/classes/sun/tools/attach/LinuxAttachProvider.java \ X openjdk/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java \ X openjdk/jdk/src/solaris/hpi/include/largefile_linux.h \ X openjdk/jdk/src/solaris/native/java/net/linux_close.c \ X openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c X X.include X Xpost-extract: X# XXX: This part including COPYDIRS COPYFILES is taken from the openjdk port. Do we really need this? X @${MKDIR} ${WRKSRC}/openjdk X @cd ${WRKSRC}/openjdk && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/${OJDK_TGZ} ${EXTRACT_AFTER_ARGS} X X @for d in ${COPYDIRS}; do \ X ${MKDIR} `echo ${WRKSRC}/$$d | ${SED} 's/linux/bsd/g;'`; \ X cd ${WRKSRC}/$$d; \ X for f in *; do \ X if [ -f $$f ]; then \ X t=`echo ${WRKSRC}/$$d/$$f | ${SED} 's/linux/bsd/g; s/Linux/Bsd/g'`; \ X ${SED} 's/linux/bsd/g; s/Linux/Bsd/g' < $$f > $$t; \ X fi; \ X done; \ X done X @for f in ${COPYFILES}; do \ X t=`echo $$f | ${SED} 's/linux/bsd/g; s/Linux/Bsd/g'`; \ X ${SED} 's/linux/bsd/g; s/Linux/Bsd/g' < ${WRKSRC}/$$f > ${WRKSRC}/$$t; \ X done X @${SED} 's/solaris/bsd/g; s/Solaris/Bsd/g' \ X < ${WRKSRC}/openjdk/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c \ X > ${WRKSRC}/openjdk/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c X @${FIND} ${WRKSRC}/openjdk/jdk/test -type f -name \*.sh -exec ${SED} -i "" -e s/Linux/FreeBSD/g {} \; X Xpost-patch: X @${REINPLACE_CMD} -e 's|md5sum|md5|' \ X -e 's|sha256sum|sha256|' ${WRKSRC}/configure X @${REINPLACE_CMD} -e 's|$(SHA256SUM) --check|$(SHA256SUM) -q|' \ X -e 's|--dry-run|--check|' \ X -e 's|rhino/rhino.{old,new}|rhino/rhino.old rhino/rhino.new|' \ X -e 's|find -type|find . -type|' \ X ${WRKSRC}/Makefile.in X @${REINPLACE_CMD} -e 's|%s/../../bin/java|${LOCALBASE}/openjdk6/bin/java|' \ X ${WRKSRC}/plugin/icedteanp/IcedTeaNPPlugin.cc X Xpost-configure: X# XXX: This is real ugly and evil. Fix me in configure. X @${REINPLACE_CMD} -e 's|/usr/bin/make|${LOCALBASE}/bin/gmake|' \ X ${WRKSRC}/Makefile X Xdo-build: X cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} stamps/liveconnect-dist.stamp X cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${WRKSRC}/plugin/icedteanp/IcedTeaPlugin.so X Xdo-install: X# XXX: Whats the correct location for installing the plugin? X# XXX: Looks like we need to install work/icedtea6-1.8/liveconnect/* somewhere. But where? X ${MKDIR} ${PREFIX}/lib/netscape/plugins X ${INSTALL_DATA} ${WRKSRC}/plugin/icedteanp/IcedTeaPlugin.so ${PREFIX}/lib/netscape/plugins X X.include 671f20aec1570ed3082ddad80cecc9cc echo x - icedtea6-plugin/distinfo sed 's/^X//' >icedtea6-plugin/distinfo << 'd3e980a0a0f8ebe041d0297985df4c73' XMD5 (icedtea6-1.8.tar.gz) = e08dd0762749fb50ec6c273c366ee8ae XSHA256 (icedtea6-1.8.tar.gz) = 6823ff87969d978fe5523c729be3074142698c89acc8cc96c05b849fde54f61b XSIZE (icedtea6-1.8.tar.gz) = 6068172 XMD5 (ecj-4.5.jar) = d7cd6a27c8801e66cbaa964a039ecfdb XSHA256 (ecj-4.5.jar) = 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781 XSIZE (ecj-4.5.jar) = 1470676 XMD5 (jdk6-jaxp-2009_10_13.zip) = a2f7b972124cd776ff71e7754eb9a429 XSHA256 (jdk6-jaxp-2009_10_13.zip) = 8714d55de18db48ca9da0ee986202005082f44cf4c215da8683342b70e61792b XSIZE (jdk6-jaxp-2009_10_13.zip) = 5975524 XMD5 (openjdk-6-src-b18-16_feb_2010.tar.gz) = 94db01691ab38f98b7d42b2ebf4d5c0b XSHA256 (openjdk-6-src-b18-16_feb_2010.tar.gz) = 778ea7b323aaa24d3c6e8fe32b8bb0f49040d9e86271859077ada9f9ee3c8ebf XSIZE (openjdk-6-src-b18-16_feb_2010.tar.gz) = 44216412 d3e980a0a0f8ebe041d0297985df4c73 echo x - icedtea6-plugin/pkg-descr sed 's/^X//' >icedtea6-plugin/pkg-descr << '448b5467fbe0f24a9f15583fdb99b930' XA free Java plugin with LiveConnect and Java Web Start support X XWWW: http://openjdk.java.net/projects/icedtea/ 448b5467fbe0f24a9f15583fdb99b930 exit