--- old/make/RunTestsPrebuilt.gmk 2020-05-20 17:58:24.212234589 -0700 +++ new/make/RunTestsPrebuilt.gmk 2020-05-20 17:58:23.828227215 -0700 @@ -169,8 +169,6 @@ OPENJDK_TARGET_OS := linux else ifeq ($(UNAME_OS), Darwin) OPENJDK_TARGET_OS := macosx - else ifeq ($(UNAME_OS), SunOS) - OPENJDK_TARGET_OS := solaris else OPENJDK_TARGET_OS := $(UNAME_OS) endif @@ -183,28 +181,15 @@ # Assume little endian unless otherwise specified OPENJDK_TARGET_CPU_ENDIAN := little -ifeq ($(OPENJDK_TARGET_OS), solaris) - # On solaris, use uname -p - UNAME_CPU := $(shell $(UNAME) -p) - # Assume 64-bit platform - OPENJDK_TARGET_CPU_BITS := 64 - ifeq ($(UNAME_CPU), i386) - OPENJDK_TARGET_CPU := x86_64 - else - OPENJDK_TARGET_CPU := $(UNAME_CPU) - endif +UNAME_CPU := $(shell $(UNAME) -m) +ifeq ($(UNAME_CPU), i686) + OPENJDK_TARGET_CPU := x86 + OPENJDK_TARGET_CPU_BITS := 32 else - # ... all others use uname -m - UNAME_CPU := $(shell $(UNAME) -m) - ifeq ($(UNAME_CPU), i686) - OPENJDK_TARGET_CPU := x86 - OPENJDK_TARGET_CPU_BITS := 32 - else - # Assume all others are 64-bit. We use the same CPU name as uname for - # at least x86_64 and aarch64. - OPENJDK_TARGET_CPU := $(UNAME_CPU) - OPENJDK_TARGET_CPU_BITS := 64 - endif + # Assume all others are 64-bit. We use the same CPU name as uname for + # at least x86_64 and aarch64. + OPENJDK_TARGET_CPU := $(UNAME_CPU) + OPENJDK_TARGET_CPU_BITS := 64 endif OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU) @@ -229,11 +214,6 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx) NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024) -else ifeq ($(OPENJDK_TARGET_OS), solaris) - NUM_CORES := $(shell /usr/sbin/psrinfo -v | $(GREP) -c on-line) - MEMORY_SIZE := $(shell \ - /usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \ - ) else ifeq ($(OPENJDK_TARGET_OS), windows) NUM_CORES := $(NUMBER_OF_PROCESSORS) MEMORY_SIZE := $(shell \ --- old/make/RunTestsPrebuiltSpec.gmk 2020-05-20 17:58:25.304255556 -0700 +++ new/make/RunTestsPrebuiltSpec.gmk 2020-05-20 17:58:24.916248106 -0700 @@ -173,16 +173,6 @@ FILE := file ULIMIT := ulimit -# On Solaris gnu versions of some tools are required. -ifeq ($(OPENJDK_BUILD_OS), solaris) - AWK := gawk - GREP := ggrep - EGREP := ggrep -E - FGREP := grep -F - SED := gsed - TAR := gtar -endif - ifeq ($(OPENJDK_BUILD_OS), windows) PATHTOOL := cygpath endif --- old/make/autoconf/basic_tools.m4 2020-05-20 17:58:27.308294035 -0700 +++ new/make/autoconf/basic_tools.m4 2020-05-20 17:58:26.972287584 -0700 @@ -274,8 +274,6 @@ TAR_TYPE="bsd" elif test "x$($TAR --version | $GREP "busybox")" != "x"; then TAR_TYPE="busybox" - elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then - TAR_TYPE="solaris" elif test "x$OPENJDK_BUILD_OS" = "xaix"; then TAR_TYPE="aix" fi --- old/make/autoconf/build-aux/config.guess 2020-05-20 17:58:28.372314465 -0700 +++ new/make/autoconf/build-aux/config.guess 2020-05-20 17:58:27.980306938 -0700 @@ -53,14 +53,6 @@ fi fi -# Test and fix solaris on x86_64 -echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null -if test $? = 0; then - # isainfo -n returns either i386 or amd64 - REAL_CPU=`isainfo -n` - OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` -fi - # Test and fix cygwin/msys CPUs echo $OUT | grep -e "-pc-cygwin" > /dev/null 2> /dev/null if test $? != 0; then --- old/make/autoconf/build-performance.m4 2020-05-20 17:58:29.436334895 -0700 +++ new/make/autoconf/build-performance.m4 2020-05-20 17:58:29.052327522 -0700 @@ -33,9 +33,6 @@ if test "$NUM_CORES" -eq "0"; then NUM_CORES=`cat /proc/cpuinfo | grep -c ^CPU` fi - elif test -x /usr/sbin/psrinfo; then - # Looks like a Solaris system - NUM_CORES=`/usr/sbin/psrinfo -v | grep -c on-line` elif test -x /usr/sbin/sysctl; then # Looks like a MacOSX system NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu` @@ -68,7 +65,7 @@ MEMORY_SIZE=`expr $MEMORY_SIZE / 1024` FOUND_MEM=yes elif test -x /usr/sbin/prtconf; then - # Looks like a Solaris or AIX system + # Looks like an AIX system MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'` FOUND_MEM=yes elif test -x /usr/sbin/sysctl; then --- old/make/autoconf/jdk-options.m4 2020-05-20 17:58:35.812457321 -0700 +++ new/make/autoconf/jdk-options.m4 2020-05-20 17:58:35.432450025 -0700 @@ -291,7 +291,7 @@ ZIP_EXTERNAL_DEBUG_SYMBOLS=false elif test "x$with_native_debug_symbols" = xexternal; then - if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then + if test "x$OPENJDK_TARGET_OS" = xlinux; then if test "x$OBJCOPY" = x; then # enabling of enable-debug-symbols and can't find objcopy # this is an error @@ -304,7 +304,7 @@ ZIP_EXTERNAL_DEBUG_SYMBOLS=false elif test "x$with_native_debug_symbols" = xzipped; then - if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then + if test "x$OPENJDK_TARGET_OS" = xlinux; then if test "x$OBJCOPY" = x; then # enabling of enable-debug-symbols and can't find objcopy # this is an error --- old/make/autoconf/libraries.m4 2020-05-20 17:58:41.188560546 -0700 +++ new/make/autoconf/libraries.m4 2020-05-20 17:58:40.768552482 -0700 @@ -127,7 +127,7 @@ BASIC_JVM_LIBS="$LIBM" # Dynamic loading library - if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then + if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL" fi @@ -146,12 +146,6 @@ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat" fi - if test "x$OPENJDK_TARGET_OS" = xsolaris; then - BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -lnsl \ - -lkstat" - BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM" - fi - if test "x$OPENJDK_TARGET_OS" = xwindows; then BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \ comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib powrprof.lib uuid.lib \ --- old/make/autoconf/platform.m4 2020-05-20 17:58:42.328582435 -0700 +++ new/make/autoconf/platform.m4 2020-05-20 17:58:41.904574294 -0700 @@ -202,10 +202,6 @@ VAR_OS=linux VAR_OS_TYPE=unix ;; - *solaris*) - VAR_OS=solaris - VAR_OS_TYPE=unix - ;; *darwin*) VAR_OS=macosx VAR_OS_TYPE=unix @@ -613,9 +609,6 @@ AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], [ - if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then - RELEASE_FILE_OS_NAME=SunOS - fi if test "x$OPENJDK_TARGET_OS" = "xlinux"; then RELEASE_FILE_OS_NAME=Linux fi --- old/make/autoconf/toolchain.m4 2020-05-20 17:58:44.612626291 -0700 +++ new/make/autoconf/toolchain.m4 2020-05-20 17:58:44.216618687 -0700 @@ -39,7 +39,6 @@ # These toolchains are valid on different platforms VALID_TOOLCHAINS_linux="gcc clang" -VALID_TOOLCHAINS_solaris="gcc" VALID_TOOLCHAINS_macosx="clang" VALID_TOOLCHAINS_aix="clang" VALID_TOOLCHAINS_windows="microsoft" --- old/make/common/FileUtils.gmk 2020-05-20 17:58:45.708647335 -0700 +++ new/make/common/FileUtils.gmk 2020-05-20 17:58:45.324639962 -0700 @@ -111,33 +111,7 @@ ################################################################################ # All install-file and related macros automatically call DecodeSpace when needed. -ifeq ($(call isTargetOs, solaris), true) - # On Solaris, if the target is a symlink and exists, cp won't overwrite. - # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the - # name of the target file differs from the source file, rename after copy. - # If the source and target parent directories are the same, recursive copy doesn't work - # so we fall back on regular copy, which isn't preserving symlinks. - define install-file - $(call MakeTargetDir) - $(RM) '$(call DecodeSpace, $@)' - if [ '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))' != \ - '$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))' ]; then \ - $(CP) -f -r -P '$(call DecodeSpace, $<)' \ - '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))'; \ - if [ '$(call DecodeSpace, $(notdir $(call EncodeSpace, $@)))' != \ - '$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))' ]; then \ - $(MV) '$(call DecodeSpace, $(dir $(call EncodeSpace, $@))/$(notdir $(call EncodeSpace, $<)))' \ - '$(call DecodeSpace, $@)'; \ - fi; \ - else \ - if [ -L '$(call DecodeSpace, $<)' ]; then \ - $(ECHO) "Source file is a symlink and target is in the same directory: $< $@" ; \ - exit 1; \ - fi; \ - $(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'; \ - fi - endef -else ifeq ($(call isTargetOs, macosx), true) +ifeq ($(call isTargetOs, macosx), true) # On mac, extended attributes sometimes creep into the source files, which may later # cause the creation of ._* files which confuses testing. Clear these with xattr if # set. Some files get their write permissions removed after being copied to the --- old/make/common/modules/LauncherCommon.gmk 2020-05-20 17:58:50.820745492 -0700 +++ new/make/common/modules/LauncherCommon.gmk 2020-05-20 17:58:50.488739117 -0700 @@ -170,7 +170,6 @@ -DLAUNCHER_NAME='"$$(LAUNCHER_NAME)"' \ -DPROGNAME='"$1"' \ $$($1_CFLAGS), \ - CFLAGS_solaris := -fPIC, \ EXTRA_HEADER_DIRS := java.base:libjvm, \ JAVA_HEADERS := false, \ DISABLED_WARNINGS_gcc := unused-function unused-variable, \ @@ -178,7 +177,6 @@ LDFLAGS := $$($1_LDFLAGS), \ LDFLAGS_linux := $$(call SetExecutableOrigin,/../lib), \ LDFLAGS_macosx := $$(call SetExecutableOrigin,/../lib), \ - LDFLAGS_solaris := $$(call SetExecutableOrigin,/../lib), \ LDFLAGS_FILTER_OUT := $$($1_LDFLAGS_FILTER_OUT), \ JDK_LIBS := $$($1_JDK_LIBS), \ JDK_LIBS_windows := $$($1_JDK_LIBS_windows), \ --- old/make/hotspot/gensrc/GensrcAdlc.gmk 2020-05-20 17:58:54.036807242 -0700 +++ new/make/hotspot/gensrc/GensrcAdlc.gmk 2020-05-20 17:58:53.652799869 -0700 @@ -39,9 +39,6 @@ # NOTE: No optimization or debug flags set here ifeq ($(call isBuildOs, linux), true) ADLC_CFLAGS := -fno-exceptions -DLINUX - else ifeq ($(call isBuildOs, solaris), true) - ADLC_LDFLAGS := -m64 - ADLC_CFLAGS := -m64 -fpermissive else ifeq ($(call isBuildOs, aix), true) ADLC_LDFLAGS += -m64 ADLC_CFLAGS := -fno-rtti -fexceptions -ffunction-sections -m64 -DAIX -mcpu=pwr8 @@ -102,8 +99,6 @@ # ADLC flags depending on target OS ifeq ($(call isTargetOs, linux), true) ADLCFLAGS += -DLINUX=1 -D_GNU_SOURCE=1 - else ifeq ($(call isTargetOs, solaris), true) - ADLCFLAGS += -DSOLARIS=1 else ifeq ($(call isTargetOs, aix), true) ADLCFLAGS += -DAIX=1 else ifeq ($(call isTargetOs, macosx), true) --- old/make/hotspot/gensrc/GensrcDtrace.gmk 2020-05-20 17:58:55.056826827 -0700 +++ new/make/hotspot/gensrc/GensrcDtrace.gmk 2020-05-20 17:58:54.720820376 -0700 @@ -32,10 +32,7 @@ ifeq ($(call check-jvm-feature, dtrace), true) - ifeq ($(call isTargetOs, solaris), true) - DTRACE_FLAGS := -64 - DTRACE_CPP_FLAGS := -D_LP64 -x c - else ifeq ($(call isTargetOs, macosx), true) + ifeq ($(call isTargetOs, macosx), true) DTRACE_CPP_FLAGS := -D_LP64 -x c else ifeq ($(call isTargetOs, linux), true) DTRACE_CPP_FLAGS := -x c @@ -59,66 +56,6 @@ TARGETS += $(patsubst $(DTRACE_SOURCE_DIR)/%.d, \ $(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d)) - ifeq ($(call isTargetOs, notsolarisyet), true) - ############################################################################ - # - # This is currently disabled. If you enable DTrace, the shared probes - # will be built, but the solaris-specific code doesn't currently work - # at all, and may be removed in future. - # - # First we need to generate the dtraceGenOffsets tool. When run, this will - # produce two header files and a C++ file. Note that generateJvmOffsets.cpp - # is using the same JVM_CFLAGS as libjvm.so. - - # Include support files that will setup JVM compiler flags. - include lib/JvmFeatures.gmk - include lib/JvmFlags.gmk - - # We cannot compile until the JVMTI and JFR gensrc has finished. - # JFR_FILES is defined in GensrcJfr.gmk. - JVMTI_H := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h - - $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \ - NAME := dtraceGenOffsets, \ - TYPE := EXECUTABLE, \ - SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \ - TOOLCHAIN := $(TOOLCHAIN_BUILD), \ - LDFLAGS := -m64, \ - CFLAGS := -m64 $(JVM_CFLAGS), \ - EXTRA_DEPS := $(JVMTI_H) $(JFR_FILES), \ - OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \ - OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \ - )) - - DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET) - - # Argument 1: Output filename - # Argument 2: dtrace-gen-offset tool command line option - define SetupDtraceOffsetsGeneration - $$(eval $$(call SetupExecute, dtrace_offset_$$(strip $2), \ - INFO := Generating dtrace $2 file, \ - DEPS := $$(BUILD_DTRACE_GEN_OFFSETS), \ - OUTPUT_FILE := $1, \ - COMMAND := ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $1 ), \ - )) - - TARGETS += $$(dtrace_offset_$$(strip $2)_TARGET) - endef - - JVM_OFFSETS_H := $(DTRACE_GENSRC_DIR)/JvmOffsets.h - JVM_OFFSETS_CPP := $(DTRACE_GENSRC_DIR)/JvmOffsets.cpp - JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h - - ############################################################################ - # Run the dtrace-gen-offset tool to generate these three files. - # The generated JvmOffsets.cpp is compiled with the rest of libjvm. - # The header files are used by libjvm_db and jhelper.d, respectively. - - $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header)) - $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index)) - $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table)) - endif - endif ################################################################################ --- old/make/hotspot/lib/CompileJvm.gmk 2020-05-20 17:58:57.164867303 -0700 +++ new/make/hotspot/lib/CompileJvm.gmk 2020-05-20 17:58:56.788860083 -0700 @@ -36,9 +36,6 @@ include lib/JvmOverrideFiles.gmk include lib/JvmFlags.gmk -# Include support files that will setup DTRACE_EXTRA_OBJECT_FILES. -include lib/JvmDtraceObjects.gmk - ################################################################################ # Setup compilation of the main Hotspot native library (libjvm). @@ -188,7 +185,6 @@ EXCLUDES := $(JVM_EXCLUDES), \ EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \ EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ - EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ DEFAULT_CFLAGS := false, \ CFLAGS := $(JVM_CFLAGS), \ abstract_vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ --- old/make/hotspot/lib/CompileLibraries.gmk 2020-05-20 17:58:58.224887656 -0700 +++ new/make/hotspot/lib/CompileLibraries.gmk 2020-05-20 17:58:57.836880206 -0700 @@ -30,7 +30,6 @@ include HotspotCommon.gmk include JdkNativeCompilation.gmk include lib/CompileJvm.gmk -include lib/CompileDtraceLibraries.gmk ifneq ($(GTEST_FRAMEWORK_SRC), ) ifneq ($(CREATING_BUILDJDK), true) --- old/make/ide/visualstudio/hotspot/CreateVSProject.gmk 2020-05-20 17:59:05.797033047 -0700 +++ new/make/ide/visualstudio/hotspot/CreateVSProject.gmk 2020-05-20 17:59:05.409025597 -0700 @@ -75,7 +75,6 @@ -ignorePath linux \ -ignorePath posix \ -ignorePath ppc \ - -ignorePath solaris \ -ignorePath x86_32 \ -ignorePath zero \ # --- old/make/modules/java.base/Lib.gmk 2020-05-20 17:59:10.037114459 -0700 +++ new/make/modules/java.base/Lib.gmk 2020-05-20 17:59:09.661107240 -0700 @@ -57,7 +57,6 @@ -delayload:winhttp.dll, \ JDK_LIBS := libjava libjvm, \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := -lnsl -lsocket $(LIBDL), \ LIBS_aix := $(LIBDL), \ LIBS_windows := advapi32.lib delayimp.lib iphlpapi.lib secur32.lib \ winhttp.lib ws2_32.lib, \ @@ -81,9 +80,8 @@ libjvm, \ DISABLED_WARNINGS_clang_Net.c := unused-function unused-variable, \ DISABLED_WARNINGS_clang_UnixNativeDispatcher.c := unused-variable, \ + JDK_LIBS := libjava libnet, \ - JDK_LIBS := libjava libjvm libnet, \ LIBS_linux := $(LIBDL) $(LIBPTHREAD), \ - LIBS_solaris := -lsocket $(LIBDL) -lsendfile, \ LIBS_aix := $(LIBDL), \ LIBS_macosx := \ -framework CoreFoundation \ @@ -125,7 +123,6 @@ DISABLED_WARNINGS_gcc_jsig.c := unused-but-set-variable, \ DISABLED_WARNINGS_clang_jsig.c := unused-but-set-variable, \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := $(LIBDL), \ LIBS_aix := $(LIBDL), \ ONLY_EXPORTED := true, \ )) --- old/make/modules/java.base/gensrc/GensrcMisc.gmk 2020-05-20 17:59:11.161136042 -0700 +++ new/make/modules/java.base/gensrc/GensrcMisc.gmk 2020-05-20 17:59:10.769128515 -0700 @@ -141,21 +141,6 @@ endif -################################################################################ - -ifeq ($(call isTargetOs, solaris), true) - - GENSRC_SC_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java - - $(GENSRC_SC_FILE): \ - $(TOPDIR)/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template - $(generate-preproc-src) - - TARGETS += $(GENSRC_SC_FILE) - -endif - -################################################################################ # Create the javax/crypto/JceSecurity.class, using the build default. # ifeq ($(UNLIMITED_CRYPTO), true) --- old/make/modules/java.base/lib/CoreLibraries.gmk 2020-05-20 17:59:12.217156318 -0700 +++ new/make/modules/java.base/lib/CoreLibraries.gmk 2020-05-20 17:59:11.829148868 -0700 @@ -63,7 +63,6 @@ DISABLED_WARNINGS_clang_TimeZone_md.c := unused-variable, \ JDK_LIBS := libjvm, \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL), \ LIBS_aix := $(LIBDL) $(LIBM), \ LIBS_macosx := \ -framework CoreFoundation \ @@ -192,7 +191,6 @@ DISABLED_WARNINGS_clang_java_md_macosx.m := unused-variable, \ LIBS_unix := $(LIBZ_LIBS), \ LIBS_linux := $(LIBDL) $(LIBPTHREAD), \ - LIBS_solaris := $(LIBDL), \ LIBS_macosx := \ -framework ApplicationServices \ -framework Cocoa \ --- old/make/modules/java.desktop/Gensrc.gmk 2020-05-20 17:59:13.277176671 -0700 +++ new/make/modules/java.desktop/Gensrc.gmk 2020-05-20 17:59:12.889169221 -0700 @@ -31,7 +31,7 @@ include gensrc/GensrcIcons.gmk endif -ifeq ($(call isTargetOs, linux solaris aix), true) +ifeq ($(call isTargetOs, linux aix), true) include gensrc/GensrcX11Wrappers.gmk endif --- old/make/modules/java.desktop/Lib.gmk 2020-05-20 17:59:14.281195949 -0700 +++ new/make/modules/java.desktop/Lib.gmk 2020-05-20 17:59:13.949189574 -0700 @@ -47,15 +47,10 @@ -DX_PLATFORM=X_$(OPENJDK_TARGET_OS_UPPERCASE) \ -DUSE_PORTS=TRUE \ -DUSE_DAUDIO=TRUE \ + -DUSE_PLATFORM_MIDI_OUT=TRUE \ + -DUSE_PLATFORM_MIDI_IN=TRUE \ # - ifeq ($(call isTargetOs, solaris), false) - LIBJSOUND_CFLAGS += \ - -DUSE_PLATFORM_MIDI_OUT=TRUE \ - -DUSE_PLATFORM_MIDI_IN=TRUE \ - # - endif - LIBJSOUND_LINK_TYPE := C ifeq ($(call isTargetOs, macosx), true) LIBJSOUND_LINK_TYPE := C++ --- old/make/modules/java.desktop/lib/AwtLibraries.gmk 2020-05-20 17:59:15.341216302 -0700 +++ new/make/modules/java.desktop/lib/AwtLibraries.gmk 2020-05-20 17:59:14.945208698 -0700 @@ -61,7 +61,7 @@ # endif -ifeq ($(call isTargetOs, solaris linux macosx aix), true) +ifeq ($(call isTargetOs, linux macosx aix), true) LIBAWT_EXCLUDE_FILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c endif @@ -141,7 +141,6 @@ JDK_LIBS := java.base:libjava java.base:libjvm, \ LIBS_unix := $(LIBM), \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := $(LIBDL), \ LIBS_aix := $(LIBDL), \ LIBS_macosx := \ -framework ApplicationServices \ @@ -216,9 +215,8 @@ DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \ DISABLED_WARNINGS_clang_X11Renderer.c := unused-function, \ DISABLED_WARNINGS_clang_X11SurfaceData.c := unused-function, \ - JDK_LIBS := libawt java.base:libjava java.base:libjvm, \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_linux := $(LIBDL) $(LIBM), \ - LIBS_solaris := $(LIBDL) $(LIBM) $(LIBCXX), \ STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \ )) @@ -310,7 +308,7 @@ DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \ parentheses, \ DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := unused-function sign-compare, \ - JDK_LIBS := libawt java.base:libjava java.base:libjvm, \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \ -lXtst, \ LIBS_linux := $(LIBPTHREAD), \ @@ -434,7 +432,7 @@ endif ifeq ($(call isTargetOsType, unix)+$(call isTargetOs, macosx), true+false) - LIBJAWT_JDK_LIBS_unix := libawt java.base:libjava java.base:libjvm + LIBJAWT_JDK_LIBS_unix := libawt ifeq ($(ENABLE_HEADLESS_ONLY), false) LIBJAWT_JDK_LIBS_unix += libawt_xawt else @@ -454,7 +452,6 @@ LDFLAGS_windows := $(LDFLAGS_CXX_JDK), \ LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \ JDK_LIBS_unix := $(LIBJAWT_JDK_LIBS_unix), \ - LIBS_solaris := $(X_LIBS) -lXrender, \ JDK_LIBS_windows := libawt, \ JDK_LIBS_macosx := libawt_lwawt, \ LIBS_macosx := -framework Cocoa, \ --- old/make/modules/java.desktop/lib/ClientLibraries.gmk 2020-05-20 17:59:15.341216302 -0700 +++ new/make/modules/java.desktop/lib/ClientLibraries.gmk 2020-05-20 17:59:14.945208698 -0700 @@ -90,7 +90,7 @@ DISABLED_WARNINGS_gcc := format-nonliteral stringop-truncation \ unused-variable, \ DISABLED_WARNINGS_clang := format-nonliteral, \ - JDK_LIBS := libawt java.base:libjava java.base:libjvm, \ + JDK_LIBS := libawt java.base:libjava, \ LIBS_unix := $(LCMS_LIBS) $(LIBM), \ )) @@ -127,7 +127,7 @@ DISABLED_WARNINGS_gcc_jcmaster.c := implicit-fallthrough, \ DISABLED_WARNINGS_gcc_jdphuff.c := shift-negative-value, \ DISABLED_WARNINGS_clang_imageioJPEG.c := unused-but-set-variable, \ - JDK_LIBS := java.base:libjava java.base:libjvm, \ + JDK_LIBS := java.base:libjava, \ LIBS := $(LIBJPEG_LIBS), \ )) @@ -266,7 +266,6 @@ LIBS := $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(LIBZ_LIBS) $(PNG_LIBS) $(ICONV_LIBS), \ LIBS_unix := $(LIBM) $(LIBPTHREAD), \ LIBS_linux := $(X_LIBS) -lX11 -lXext, \ - LIBS_solaris := $(X_LIBS) -lX11 -lXext, \ LIBS_macosx := \ -framework ApplicationServices \ -framework Cocoa \ @@ -316,7 +315,7 @@ -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \ -DHB_NO_PRAGMA_GCC_DIAGNOSTIC endif + ifeq ($(call isTargetOs, linux macosx), true) - ifeq ($(call isTargetOs, solaris linux macosx), true) HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES -DHB_NO_VISIBILITY endif --- old/make/modules/java.management/Lib.gmk 2020-05-20 17:59:17.481257392 -0700 +++ new/make/modules/java.management/Lib.gmk 2020-05-20 17:59:17.145250941 -0700 @@ -35,7 +35,6 @@ NAME := management, \ OPTIMIZATION := HIGH, \ JDK_LIBS := java.base:libjava java.base:libjvm, \ - LIBS_solaris := -lkstat, \ LIBS_aix := -lperfstat, \ LIBS_windows := advapi32.lib psapi.lib, \ )) --- old/make/modules/jdk.attach/Lib.gmk 2020-05-20 17:59:20.593317146 -0700 +++ new/make/modules/jdk.attach/Lib.gmk 2020-05-20 17:59:20.209309773 -0700 @@ -43,8 +43,7 @@ OPTIMIZATION := LOW, \ CFLAGS := $(LIBATTACH_CFLAGS), \ CFLAGS_windows := -Gy, \ + JDK_LIBS := java.base:libjava, \ - JDK_LIBS := java.base:libjava java.base:libjvm, \ - LIBS_solaris := -ldoor, \ LIBS_windows := advapi32.lib psapi.lib, \ )) --- old/make/modules/jdk.hotspot.agent/Lib.gmk 2020-05-20 17:59:21.653337499 -0700 +++ new/make/modules/jdk.hotspot.agent/Lib.gmk 2020-05-20 17:59:21.257329896 -0700 @@ -70,9 +70,8 @@ CFLAGS := $(LIBSAPROC_CFLAGS), \ CXXFLAGS := $(LIBSAPROC_CFLAGS) $(LIBSAPROC_CXXFLAGS), \ EXTRA_SRC := $(LIBSAPROC_EXTRA_SRC), \ - JDK_LIBS := java.base:libjava java.base:libjvm, \ + JDK_LIBS := java.base:libjava, \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := -ldl -lstdc++ -lproc, \ LIBS_macosx := \ -framework CoreFoundation \ -framework Foundation \ --- old/make/modules/jdk.jdwp.agent/Lib.gmk 2020-05-20 17:59:23.709376977 -0700 +++ new/make/modules/jdk.jdwp.agent/Lib.gmk 2020-05-20 17:59:23.321369527 -0700 @@ -39,7 +39,6 @@ include \ libjdwp/export, \ LIBS_linux := $(LIBPTHREAD), \ - LIBS_solaris := -lnsl -lsocket, \ LIBS_windows := iphlpapi.lib ws2_32.lib, \ )) @@ -78,7 +77,6 @@ JDK_LIBS := java.base:libjvm, \ LIBS := $(ICONV_LIBS), \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := $(LIBDL), \ )) TARGETS += $(BUILD_LIBJDWP) --- old/make/modules/jdk.management/Lib.gmk 2020-05-20 17:59:24.761397176 -0700 +++ new/make/modules/jdk.management/Lib.gmk 2020-05-20 17:59:24.373389726 -0700 @@ -46,7 +46,6 @@ DISABLED_WARNINGS_clang_UnixOperatingSystem.c := format-nonliteral, \ CFLAGS := $(LIBMANAGEMENT_EXT_CFLAGS), \ JDK_LIBS := java.base:libjava java.base:libjvm, \ - LIBS_solaris := -lkstat, \ LIBS_aix := -lperfstat, \ LIBS_windows := advapi32.lib psapi.lib, \ )) --- old/make/modules/jdk.management.agent/Lib.gmk Fri Apr 19 15:01:40 2024 +++ new/make/modules/jdk.management.agent/Lib.gmk Thu Apr 18 06:50:24 2024 @@ -34,7 +34,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \ NAME := management_agent, \ OPTIMIZATION := LOW, \ - JDK_LIBS := java.base:libjava java.base:libjvm, \ + JDK_LIBS := java.base:libjava, \ LIBS_windows := advapi32.lib, \ )) --- old/make/modules/jdk.net/Lib.gmk 2020-05-20 17:59:25.877418605 -0700 +++ new/make/modules/jdk.net/Lib.gmk 2020-05-20 17:59:25.493411232 -0700 @@ -31,8 +31,6 @@ ## Build libextnet ################################################################################ -ifeq ($(call isTargetOs, solaris), false) - $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \ NAME := extnet, \ OPTIMIZATION := LOW, \ @@ -42,7 +40,5 @@ )) TARGETS += $(BUILD_LIBEXTNET) ################################################################################ - -endif --- old/make/modules/jdk.sctp/Lib.gmk 2020-05-20 17:59:26.921438651 -0700 +++ new/make/modules/jdk.sctp/Lib.gmk 2020-05-20 17:59:26.541431354 -0700 @@ -42,7 +42,6 @@ java.base:libnio/ch, \ JDK_LIBS := java.base:libjava java.base:libnet, \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := -lsocket, \ )) TARGETS += $(BUILD_LIBSCTP) --- old/make/scripts/compare.sh 2020-05-20 17:59:27.985459081 -0700 +++ new/make/scripts/compare.sh 2020-05-20 17:59:27.597451631 -0700 @@ -75,14 +75,7 @@ # Disassembly diff filters. These filters try to filter out ephemeral parts of the # disassembly, such as hard-coded addresses, to be able to catch "actual" differences. -if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then - if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then - # Random strings looking like this differ: <.XAKoKoPIac2W0OA. - DIS_DIFF_FILTER="$SED \ - -e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \ - " - fi -elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then +if [ "$OPENJDK_TARGET_OS" = "windows" ]; then DIS_DIFF_FILTER="$SED -r \ -e 's/^ [0-9A-F]{16}: //' \ -e 's/\[[0-9A-F]{4,16}h\]/[]/' \ @@ -392,14 +385,7 @@ fi CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff - # On solaris, there is no -q option. - if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then - $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \ - | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \ - > $CONTENTS_DIFF_FILE - else - $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE - fi + $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE) ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE) @@ -421,14 +407,8 @@ fi if [ "$CMP_ZIPS_CONTENTS" = "true" ]; then - if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then - DIFFING_FILES=$($GREP -e 'differ$' -e '^diff ' $CONTENTS_DIFF_FILE \ - | $SED -e 's/^Files //g' -e 's/diff -r //g' | $CUT -f 1 -d ' ' \ - | $SED "s|$OTHER_UNZIPDIR/||g") - else - DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \ - | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g") - fi + DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \ + | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g") # Separate executable/library files from other files in zip. DIFFING_TEXT_FILES= @@ -776,10 +756,6 @@ # to filter out that extra information. $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this - elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then - # Some symbols get seemingly random 15 character prefixes. Filter them out. - $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this elif [ "$OPENJDK_TARGET_OS" = "aix" ]; then $OBJDUMP -T $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other $OBJDUMP -T $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this --- old/make/test/JtregNativeHotspot.gmk 2020-05-20 17:59:33.301561154 -0700 +++ new/make/test/JtregNativeHotspot.gmk 2020-05-20 17:59:32.909553627 -0700 @@ -78,10 +78,6 @@ HOTSPOT_JTREG_EXCLUDE += libTestSVEWithJNI.c endif -ifeq ($(call isTargetOs, solaris), true) - HOTSPOT_JTREG_EXCLUDE += libterminatedThread.c -endif - ifeq ($(call isTargetOs, windows), true) HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libnativeStack := java.base:libjvm --- old/make/test/JtregNativeJdk.gmk 2020-05-20 17:59:34.437582966 -0700 +++ new/make/test/JtregNativeJdk.gmk 2020-05-20 17:59:34.045575440 -0700 @@ -55,8 +55,8 @@ BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeCallerAccessTest := java.base:libjvm BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeNullCallerTest := java.base:libjvm -BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava java.base:libjvm +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava -BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava java.base:libjvm +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava # Platform specific setup ifeq ($(call isTargetOs, windows), true) @@ -84,9 +84,6 @@ BUILD_JDK_JTREG_EXCLUDE += exerevokeall.c ifeq ($(call isTargetOs, linux), true) BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl - else ifeq ($(call isTargetOs, solaris), true) - BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libInheritedChannel := java.base:libjava java.base:libjvm - BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -lsocket -lnsl -ldl endif BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) endif --- old/src/hotspot/cpu/x86/globalDefinitions_x86.hpp 2020-05-20 17:59:37.533642413 -0700 +++ new/src/hotspot/cpu/x86/globalDefinitions_x86.hpp 2020-05-20 17:59:37.197635961 -0700 @@ -46,7 +46,7 @@ // hardware. If not, DEFAULT_CACHE_LINE_SIZE might as well suffice. #define DEFAULT_PADDING_SIZE (DEFAULT_CACHE_LINE_SIZE*2) -#if defined(LINUX) || defined(SOLARIS) || defined(__APPLE__) +#if defined(LINUX) || defined(__APPLE__) #define SUPPORT_RESERVED_STACK_AREA #endif --- old/src/hotspot/os/posix/include/jvm_md.h 2020-05-20 17:59:41.957727358 -0700 +++ new/src/hotspot/os/posix/include/jvm_md.h 2020-05-20 17:59:41.561719755 -0700 @@ -47,7 +47,7 @@ #endif #define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX -#if defined(AIX) || defined(SOLARIS) +#if defined(AIX) #define JVM_MAXPATHLEN MAXPATHLEN #else // Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may @@ -80,9 +80,6 @@ #define JVM_SIGTERM SIGTERM #define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */ -#ifdef SOLARIS -#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */ -#endif // SOLARIS #define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */ #define SHUTDOWN2_SIGNAL SIGINT #define SHUTDOWN3_SIGNAL SIGTERM --- old/src/hotspot/os/posix/os_posix.cpp 2020-05-20 17:59:42.965746713 -0700 +++ new/src/hotspot/os/posix/os_posix.cpp 2020-05-20 17:59:42.629740261 -0700 @@ -618,7 +618,7 @@ st->print("%ld", sysconf(_SC_CHILD_MAX)); print_rlimit(st, ", THREADS", RLIMIT_THREADS); -#elif !defined(SOLARIS) +#else print_rlimit(st, ", NPROC", RLIMIT_NPROC); #endif @@ -636,12 +636,6 @@ print_rlimit(st, ", MEMLOCK", RLIMIT_MEMLOCK, true); #endif -#if defined(SOLARIS) - // maximum size of mapped address space of a process in bytes; - // if the limit is exceeded, mmap and brk fail - print_rlimit(st, ", VMEM", RLIMIT_VMEM, true); -#endif - // MacOS; The maximum size (in bytes) to which a process's resident set size may grow. #if defined(__APPLE__) print_rlimit(st, ", RSS", RLIMIT_RSS, true); --- old/src/hotspot/share/cds/classListParser.cpp 2020-05-20 18:00:04.798165911 -0700 +++ new/src/hotspot/share/cds/classListParser.cpp 2020-05-20 18:00:04.402158309 -0700 @@ -528,7 +528,7 @@ // This function is used for loading classes for customized class loaders // during archive dumping. InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) { -#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(__APPLE__) || defined(_WINDOWS))) +#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__) || defined(_WINDOWS))) // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and // (3) MacOSX/64-bit and (4) Windowss/64-bit // This #if condition should be in sync with the areCustomLoadersSupportedForCDS --- old/src/hotspot/share/runtime/abstract_vm_version.cpp 2020-05-20 18:00:26.906590409 -0700 +++ new/src/hotspot/share/runtime/abstract_vm_version.cpp 2020-05-20 18:00:26.522583036 -0700 @@ -189,7 +189,6 @@ #define OS LINUX_ONLY("linux") \ WINDOWS_ONLY("windows") \ - SOLARIS_ONLY("solaris") \ AIX_ONLY("aix") \ BSD_ONLY("bsd") --- old/src/hotspot/share/runtime/semaphore.hpp 2020-05-20 18:00:35.454754540 -0700 +++ new/src/hotspot/share/runtime/semaphore.hpp 2020-05-20 18:00:35.066747091 -0700 @@ -28,7 +28,7 @@ #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" -#if defined(LINUX) || defined(SOLARIS) || defined(AIX) +#if defined(LINUX) || defined(AIX) # include "semaphore_posix.hpp" #else # include OS_HEADER(semaphore) --- old/src/hotspot/share/nmt/memTracker.cpp 2020-05-20 18:00:38.698816829 -0700 +++ new/src/hotspot/share/nmt/memTracker.cpp 2020-05-20 18:00:38.318809532 -0700 @@ -48,12 +48,6 @@ #include #endif -#ifdef SOLARIS - volatile bool NMT_stack_walkable = false; -#else - volatile bool NMT_stack_walkable = true; -#endif - NMT_TrackingLevel MemTracker::_tracking_level = NMT_unknown; DeferredStatic MemTracker::_baseline; --- old/src/hotspot/share/nmt/memTracker.hpp 2020-05-20 18:00:39.774837489 -0700 +++ new/src/hotspot/share/nmt/memTracker.hpp 2020-05-20 18:00:39.374829809 -0700 @@ -37,11 +37,9 @@ #include "utilities/deferredStatic.hpp" #include "utilities/nativeCallStack.hpp" -extern volatile bool NMT_stack_walkable; - -#define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \ +#define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail) ? \ NativeCallStack(0) : FAKE_CALLSTACK) -#define CALLER_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \ +#define CALLER_PC ((MemTracker::tracking_level() == NMT_detail) ? \ NativeCallStack(1) : FAKE_CALLSTACK) class MemTracker : AllStatic { --- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp 2020-05-20 18:00:44.978937412 -0700 +++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp 2020-05-20 18:00:44.586929885 -0700 @@ -57,19 +57,6 @@ #include #include -#ifdef SOLARIS -#include -#include -#include -#include -#include -#include -// leak from regset.h, but used in hotspot -#ifdef ES -#undef ES -#endif -#endif // SOLARIS - #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX) #include #ifndef __OpenBSD__ @@ -87,10 +70,7 @@ #endif // LINUX || _ALLBSD_SOURCE // checking for nanness -#ifdef SOLARIS -inline int g_isnan(float f) { return isnan(f); } -inline int g_isnan(double f) { return isnan(f); } -#elif defined(__APPLE__) +#if defined(__APPLE__) inline int g_isnan(double f) { return isnan(f); } #elif defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX) inline int g_isnan(float f) { return isnan(f); } --- old/src/hotspot/share/utilities/macros.hpp 2020-05-20 18:00:46.046957918 -0700 +++ new/src/hotspot/share/utilities/macros.hpp 2020-05-20 18:00:45.666950622 -0700 @@ -415,14 +415,6 @@ #define NOT_AIX(code) code #endif -#ifdef SOLARIS -#define SOLARIS_ONLY(code) code -#define NOT_SOLARIS(code) -#else -#define SOLARIS_ONLY(code) -#define NOT_SOLARIS(code) code -#endif - #ifdef _WINDOWS #define WINDOWS_ONLY(code) code #define NOT_WINDOWS(code) --- old/src/hotspot/share/utilities/ostream.cpp 2020-05-20 18:00:47.142978963 -0700 +++ new/src/hotspot/share/utilities/ostream.cpp 2020-05-20 18:00:46.754971513 -0700 @@ -1080,7 +1080,7 @@ #ifndef PRODUCT -#if defined(SOLARIS) || defined(LINUX) || defined(AIX) || defined(_ALLBSD_SOURCE) +#if defined(LINUX) || defined(AIX) || defined(_ALLBSD_SOURCE) #include #include #include --- old/src/hotspot/share/utilities/vmError.cpp 2020-05-20 18:00:48.214999546 -0700 +++ new/src/hotspot/share/utilities/vmError.cpp 2020-05-20 18:00:47.822992019 -0700 @@ -1962,8 +1962,6 @@ out.print_raw ("# Executing "); #if defined(LINUX) || defined(_ALLBSD_SOURCE) out.print_raw ("/bin/sh -c "); -#elif defined(SOLARIS) - out.print_raw ("/usr/bin/sh -c "); #elif defined(_WINDOWS) out.print_raw ("cmd /C "); #endif @@ -2028,8 +2026,6 @@ tty->print("# Executing "); #if defined(LINUX) tty->print ("/bin/sh -c "); -#elif defined(SOLARIS) - tty->print ("/usr/bin/sh -c "); #endif tty->print_cr("\"%s\"...", cmd); --- old/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template 2020-05-20 18:00:51.403060759 -0700 +++ new/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template 2020-05-20 18:00:51.019053386 -0700 @@ -43,8 +43,6 @@ #define SO_REUSEPORT 0 #elif defined(__linux__) #define SO_REUSEPORT 15 -#elif defined(__solaris__) -#define SO_REUSEPORT 0x100e #elif defined(AIX) || defined(MACOSX) #define SO_REUSEPORT 0x0200 #else @@ -52,10 +50,6 @@ #endif #endif -/* On Solaris, "sun" is defined as a macro. Undefine to make package - declaration valid */ -#undef sun - /* To be able to name the Java constants the same as the C constants without having the preprocessor rewrite those identifiers, add PREFIX_ to all identifiers matching a C constant. The PREFIX_ is filtered out in the --- old/src/java.base/share/conf/security/java.security 2020-05-20 18:00:54.519120590 -0700 +++ new/src/java.base/share/conf/security/java.security 2020-05-20 18:00:54.183114138 -0700 @@ -110,11 +110,7 @@ #ifdef macosx security.provider.tbd=Apple #endif -#ifdef solaris -security.provider.tbd=SunPKCS11 ${java.home}/conf/security/sunpkcs11-solaris.cfg -#else security.provider.tbd=SunPKCS11 -#endif # # A list of preferred providers for specific algorithms. These providers will --- old/src/java.base/share/native/libjli/jli_util.h 2020-05-20 18:00:56.651161527 -0700 +++ new/src/java.base/share/native/libjli/jli_util.h 2020-05-20 18:00:56.263154077 -0700 @@ -100,11 +100,7 @@ #define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2)) #define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3)) #define JLI_Open open -#ifdef __solaris__ -#define JLI_Lseek llseek -#else #define JLI_Lseek lseek -#endif #endif /* _WIN32 */ /* --- old/src/java.base/share/native/libnet/net_util.c 2020-05-20 18:00:57.667181035 -0700 +++ new/src/java.base/share/native/libnet/net_util.c 2020-05-20 18:00:57.335174660 -0700 @@ -85,7 +85,7 @@ /* check if SO_REUSEPORT is supported on this platform */ REUSEPORT_available = reuseport_supported(IPv6_available); - parseExclusiveBindProperty(env); + return JNI_VERSION_1_2; } --- old/src/java.base/share/native/libnet/net_util.h 2020-05-20 18:00:58.723201311 -0700 +++ new/src/java.base/share/native/libnet/net_util.h 2020-05-20 18:00:58.339193938 -0700 @@ -142,8 +142,6 @@ JNIEXPORT jobject JNICALL NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port); -void parseExclusiveBindProperty(JNIEnv *env); - JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(SOCKETADDRESS *sa); JNIEXPORT jboolean JNICALL --- old/src/java.base/unix/classes/java/lang/ProcessImpl.java 2020-05-20 18:00:59.739220820 -0700 +++ new/src/java.base/unix/classes/java/lang/ProcessImpl.java 2020-05-20 18:00:59.399214291 -0700 @@ -79,9 +79,6 @@ private /* final */ InputStream stdout; private /* final */ InputStream stderr; - // only used on Solaris - private /* final */ DeferredCloseInputStream stdout_inner_stream; - private static enum LaunchMechanism { // order IS important! FORK, @@ -119,7 +116,6 @@ } case AIX: case MACOS: - case SOLARIS: if (lm != LaunchMechanism.VFORK) { return lm; // All but VFORK are valid } @@ -366,44 +362,6 @@ }); break; - case SOLARIS: - stdin = (fds[0] == -1) ? - ProcessBuilder.NullOutputStream.INSTANCE : - new BufferedOutputStream( - new FileOutputStream(newFileDescriptor(fds[0]))); - - stdout = (fds[1] == -1 || forceNullOutputStream) ? - ProcessBuilder.NullInputStream.INSTANCE : - new BufferedInputStream( - stdout_inner_stream = - new DeferredCloseInputStream( - newFileDescriptor(fds[1]))); - - stderr = (fds[2] == -1) ? - ProcessBuilder.NullInputStream.INSTANCE : - new DeferredCloseInputStream(newFileDescriptor(fds[2])); - - /* - * For each subprocess forked a corresponding reaper task - * is submitted. That task is the only thread which waits - * for the subprocess to terminate and it doesn't hold any - * locks while doing so. This design allows waitFor() and - * exitStatus() to be safely executed in parallel (and they - * need no native code). - */ - ProcessHandleImpl.completion(pid, true).handle((exitcode, throwable) -> { - lock.lock(); - try { - this.exitcode = (exitcode == null) ? -1 : exitcode.intValue(); - this.hasExited = true; - condition.signalAll(); - } finally { - lock.unlock(); - } - return null; - }); - break; - case AIX: stdin = (fds[0] == -1) ? ProcessBuilder.NullOutputStream.INSTANCE : @@ -520,32 +478,6 @@ try { stderr.close(); } catch (IOException ignored) {} break; - case SOLARIS: - // There is a risk that pid will be recycled, causing us to - // kill the wrong process! So we only terminate processes - // that appear to still be running. Even with this check, - // there is an unavoidable race condition here, but the window - // is very small, and OSes try hard to not recycle pids too - // soon, so this is quite safe. - lock.lock(); - try { - if (!hasExited) - processHandle.destroyProcess(force); - } finally { - lock.unlock(); - } - try { - stdin.close(); - if (stdout_inner_stream != null) - stdout_inner_stream.closeDeferred(stdout); - if (stderr instanceof DeferredCloseInputStream) - ((DeferredCloseInputStream) stderr) - .closeDeferred(stderr); - } catch (IOException e) { - // ignore - } - break; - default: throw new AssertionError("Unsupported platform: " + OperatingSystem.current()); } } --- old/src/java.base/unix/classes/sun/net/PortConfig.java 2020-05-20 18:01:00.803241250 -0700 +++ new/src/java.base/unix/classes/sun/net/PortConfig.java 2020-05-20 18:01:00.419233877 -0700 @@ -48,10 +48,6 @@ defaultLower = 32768; defaultUpper = 61000; break; - case SOLARIS: - defaultLower = 32768; - defaultUpper = 65535; - break; case MACOS: defaultLower = 49152; defaultUpper = 65535; --- old/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template 2020-05-20 18:01:02.831280190 -0700 +++ new/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template 2020-05-20 18:01:02.495273738 -0700 @@ -35,10 +35,6 @@ #include #endif -/* On Solaris, "sun" is defined as a macro. Undefine to make package - declaration valid */ -#undef sun - /* To be able to name the Java constants the same as the C constants without having the preprocessor rewrite those identifiers, add PREFIX_ to all identifiers matching a C constant. The PREFIX_ is filtered out in the --- old/src/java.base/unix/classes/sun/security/provider/NativePRNG.java 2020-05-20 18:01:06.091342785 -0700 +++ new/src/java.base/unix/classes/sun/security/provider/NativePRNG.java 2020-05-20 18:01:05.707335412 -0700 @@ -33,7 +33,7 @@ import sun.security.util.Debug; /** - * Native PRNG implementation for Solaris/Linux/MacOS. + * Native PRNG implementation for Linux/MacOS. *

* It obtains seed and random numbers by reading system files such as * the special device files /dev/random and /dev/urandom. This --- old/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c 2020-05-20 18:01:07.167363445 -0700 +++ new/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c 2020-05-20 18:01:06.779355995 -0700 @@ -44,16 +44,8 @@ #include #include -/* For POSIX-compliant getpwuid_r on Solaris */ -#if defined(__solaris__) -#define _POSIX_PTHREAD_SEMANTICS -#endif #include -#ifdef __solaris__ -#include -#endif - #if defined(_AIX) #include #endif @@ -119,18 +111,13 @@ #define WTERMSIG(status) ((status)&0x7F) #endif -#ifdef __solaris__ /* The child exited because of a signal. * The best value to return is 0x80 + signal number, * because that is what all Unix shells do, and because * it allows callers to distinguish between process exit and * process death by signal. - * Unfortunately, the historical behavior on Solaris is to return - * the signal number, and we preserve this for compatibility. */ -#define WTERMSIG_RETURN(status) WTERMSIG(status) -#else + */ #define WTERMSIG_RETURN(status) (WTERMSIG(status) + 0x80) -#endif /* Field id for jString 'command' in java.lang.ProcessHandleImpl.Info */ jfieldID ProcessHandleImpl_Info_commandID; --- old/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h 2020-05-20 18:01:08.239384029 -0700 +++ new/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h 2020-05-20 18:01:07.851376579 -0700 @@ -29,7 +29,7 @@ * Declaration of ProcessHandleImpl functions common on all Unix platforms. * 'unix_' functions have a single implementation in ProcessHandleImpl_unix.c * 'os_' prefixed functions have different, os-specific implementations in the - * various ProcessHandleImpl_{linux,macosx,solaris,aix}.c files. + * various ProcessHandleImpl_{linux,macosx,aix}.c files. * See ProcessHandleImpl_unix.c for more details. */ --- old/src/java.base/unix/native/libjava/ProcessImpl_md.c 2020-05-20 18:01:09.319404766 -0700 +++ new/src/java.base/unix/native/libjava/ProcessImpl_md.c 2020-05-20 18:01:08.935397393 -0700 @@ -230,14 +230,7 @@ static const char* defaultPath(void) { -#ifdef __solaris__ - /* These really are the Solaris defaults! */ - return (geteuid() == 0 || getuid() == 0) ? - "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" : - "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:"; -#else - return ":/bin:/usr/bin"; /* glibc */ -#endif + return ":/bin:/usr/bin"; } static const char* @@ -495,7 +488,7 @@ #endif /* vfork(2) is deprecated on Darwin */ -#ifndef __solaris__ +#ifndef __APPLE__ static pid_t vforkChild(ChildStuff *c) { volatile pid_t resultPid; @@ -661,7 +654,7 @@ startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) { switch (c->mode) { /* vfork(2) is deprecated on Darwin*/ - #ifndef __solaris__ + #ifndef __APPLE__ case MODE_VFORK: return vforkChild(c); #endif --- old/src/java.base/unix/native/libjava/TimeZone_md.c 2020-05-20 18:01:10.467426810 -0700 +++ new/src/java.base/unix/native/libjava/TimeZone_md.c 2020-05-20 18:01:10.059418975 -0700 @@ -35,9 +35,6 @@ #include #include #include -#if defined(__solaris__) -#include -#endif #include "jvm.h" #include "jni_util.h" @@ -44,11 +41,9 @@ #include "TimeZone_md.h" #include "path_util.h" -#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64) #define fileopen fopen #define filegets fgets #define fileclose fclose -#endif #if defined(__linux__) || defined(_ALLBSD_SOURCE) static const char *ZONEINFO_DIR = "/usr/share/zoneinfo"; @@ -61,8 +56,8 @@ static const char popularZones[][4] = {"UTC", "GMT"}; -#if defined(__linux__) || defined(MACOSX) || defined(__solaris__) +#if defined(__linux__) || defined(MACOSX) static char *isFileIdentical(char* buf, size_t size, char *pathname); /* * remove repeated path separators ('/') in the given 'path'. @@ -172,13 +167,6 @@ */ if ((strcmp(dp->d_name, "ROC") == 0) || (strcmp(dp->d_name, "posixrules") == 0) -#if defined(__solaris__) - /* - * Skip the "src" and "tab" directories on Solaris. - */ - || (strcmp(dp->d_name, "src") == 0) - || (strcmp(dp->d_name, "tab") == 0) -#endif || (strcmp(dp->d_name, "localtime") == 0)) { continue; } @@ -250,8 +238,6 @@ return possibleMatch; } -#if defined(__linux__) || defined(MACOSX) - /* * Performs Linux specific mapping and returns a zone ID * if found. Otherwise, NULL is returned. @@ -336,183 +322,6 @@ return tz; } -#elif defined(__solaris__) - -/* - * Performs Solaris dependent mapping. Returns a zone ID if - * found. Otherwise, NULL is returned. Solaris libc looks up - * "/etc/default/init" to get the default TZ value if TZ is not defined - * as an environment variable. - */ -static char * -getPlatformTimeZoneID() -{ - char *tz = NULL; - FILE *fp; - - /* - * Try the TZ entry in /etc/default/init. - */ - if ((fp = fileopen(SYS_INIT_FILE, "r")) != NULL) { - char line[256]; - char quote = '\0'; - - while (filegets(line, sizeof(line), fp) != NULL) { - char *p = line; - char *s; - char c; - - /* quick check for comment lines */ - if (*p == '#') { - continue; - } - if (strncmp(p, "TZ=", 3) == 0) { - p += 3; - while (*p == ' ' || *p == '\t') p++; - c = *p; - if (c == '"' || c == '\'') { - quote = c; - p++; - } - - /* - * PSARC/2001/383: quoted string support - */ - for (s = p; (c = *s) != '\0' && c != '\n'; s++) { - /* No '\\' is supported here. */ - if (c == quote) { - quote = '\0'; - break; - } - if (c == ' ' && quote == '\0') { - break; - } - } - if (quote != '\0') { - jio_fprintf(stderr, "ZoneInfo: unterminated time zone name in /etc/TIMEZONE\n"); - } - *s = '\0'; - tz = strdup(p); - break; - } - } - (void) fileclose(fp); - } - return tz; -} - -#define TIMEZONE_FMRI "svc:/system/timezone:default" -#define TIMEZONE_PG "timezone" -#define LOCALTIME_PROP "localtime" - -static void -cleanupScf(scf_handle_t *h, - scf_snapshot_t *snap, - scf_instance_t *inst, - scf_propertygroup_t *pg, - scf_property_t *prop, - scf_value_t *val, - char *buf) { - if (buf != NULL) { - free(buf); - } - if (snap != NULL) { - scf_snapshot_destroy(snap); - } - if (val != NULL) { - scf_value_destroy(val); - } - if (prop != NULL) { - scf_property_destroy(prop); - } - if (pg != NULL) { - scf_pg_destroy(pg); - } - if (inst != NULL) { - scf_instance_destroy(inst); - } - if (h != NULL) { - scf_handle_destroy(h); - } -} - -/* - * Returns a zone ID of Solaris when the TZ value is "localtime". - * First, it tries scf. If scf fails, it looks for the same file as - * /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/. - */ -static char * -getSolarisDefaultZoneID() { - char *tz = NULL; - struct stat64 statbuf; - size_t size; - char *buf; - int fd; - int res; - /* scf specific variables */ - scf_handle_t *h = NULL; - scf_snapshot_t *snap = NULL; - scf_instance_t *inst = NULL; - scf_propertygroup_t *pg = NULL; - scf_property_t *prop = NULL; - scf_value_t *val = NULL; - - if ((h = scf_handle_create(SCF_VERSION)) != NULL - && scf_handle_bind(h) == 0 - && (inst = scf_instance_create(h)) != NULL - && (snap = scf_snapshot_create(h)) != NULL - && (pg = scf_pg_create(h)) != NULL - && (prop = scf_property_create(h)) != NULL - && (val = scf_value_create(h)) != NULL - && scf_handle_decode_fmri(h, TIMEZONE_FMRI, NULL, NULL, inst, - NULL, NULL, SCF_DECODE_FMRI_REQUIRE_INSTANCE) == 0 - && scf_instance_get_snapshot(inst, "running", snap) == 0 - && scf_instance_get_pg_composed(inst, snap, TIMEZONE_PG, pg) == 0 - && scf_pg_get_property(pg, LOCALTIME_PROP, prop) == 0 - && scf_property_get_value(prop, val) == 0) { - ssize_t len; - - /* Gets the length of the zone ID string */ - len = scf_value_get_astring(val, NULL, 0); - if (len != -1) { - tz = malloc(++len); /* +1 for a null byte */ - if (tz != NULL && scf_value_get_astring(val, tz, len) != -1) { - cleanupScf(h, snap, inst, pg, prop, val, NULL); - return tz; - } - } - } - cleanupScf(h, snap, inst, pg, prop, val, tz); - - RESTARTABLE(stat64(DEFAULT_ZONEINFO_FILE, &statbuf), res); - if (res == -1) { - return NULL; - } - size = (size_t) statbuf.st_size; - buf = malloc(size); - if (buf == NULL) { - return NULL; - } - RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd); - if (fd == -1) { - free((void *) buf); - return NULL; - } - - RESTARTABLE(read(fd, buf, size), res); - if (res != (ssize_t) size) { - (void) close(fd); - free((void *) buf); - return NULL; - } - (void) close(fd); - tz = findZoneinfoFile(buf, size, ZONEINFO_DIR); - free((void *) buf); - return tz; -} - -#endif /* defined(__solaris__) */ - #elif defined(_AIX) static const char *ETC_ENVIRONMENT_FILE = "/etc/environment"; @@ -679,15 +488,6 @@ free((void *) freetz); } #else -#if defined(__solaris__) - /* Solaris might use localtime, so handle it here. */ - if (strcmp(tz, "localtime") == 0) { - javatz = getSolarisDefaultZoneID(); - if (freetz != NULL) { - free((void *) freetz); - } - } else -#endif if (freetz == NULL) { /* strdup if we are still working on getenv result. */ javatz = strdup(tz); --- old/src/java.base/unix/native/libjava/UnixFileSystem_md.c 2020-05-20 18:01:11.571448007 -0700 +++ new/src/java.base/unix/native/libjava/UnixFileSystem_md.c 2020-05-20 18:01:11.171440327 -0700 @@ -57,11 +57,6 @@ #endif #define statvfs statvfs64 #endif - -#if defined(__solaris__) && !defined(NAME_MAX) - #define NAME_MAX MAXNAMLEN -#endif - /* -- Field IDs -- */ static struct { --- old/src/java.base/unix/native/libjava/io_util_md.c 2020-05-20 18:01:12.679469282 -0700 +++ new/src/java.base/unix/native/libjava/io_util_md.c 2020-05-20 18:01:12.271461448 -0700 @@ -30,10 +30,6 @@ #include #include -#ifdef __solaris__ -#include -#endif - #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) #include #endif --- old/src/java.base/unix/native/libjsig/jsig.c 2020-05-20 18:01:20.019610218 -0700 +++ new/src/java.base/unix/native/libjsig/jsig.c 2020-05-20 18:01:19.603602231 -0700 @@ -35,16 +35,6 @@ #include "jni.h" -#ifdef SOLARIS -/* Our redeclarations of the system functions must not have a less - * restrictive linker scoping, so we have to declare them as JNIEXPORT - * before including signal.h */ -#include "sys/signal.h" -JNIEXPORT void (*signal(int sig, void (*disp)(int)))(int); -JNIEXPORT void (*sigset(int sig, void (*disp)(int)))(int); -JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); -#endif - #include #include #include @@ -54,18 +44,9 @@ #include #include -#ifdef SOLARIS -#define MAX_SIGNALS (_SIGRTMAX+1) - -/* On solaris, SIGRTMAX is a macro and _SIGRTMAX a constant. - * Historically we used SIGRTMAX and allocated sact dynamically. - */ -static struct sigaction *sact = (struct sigaction *)NULL; /* saved signal handlers */ -#else #define MAX_SIGNALS NSIG static struct sigaction sact[MAX_SIGNALS]; /* saved signal handlers */ -#endif static bool deprecated_usage[MAX_SIGNALS]; /* usage of signal/sigset */ static sigset_t jvmsigs; /* Signals used by jvm. */ @@ -90,20 +73,6 @@ static bool warning_printed = false; -/* assume called within signal_lock */ -static void allocate_sact() { -#ifdef SOLARIS - if (sact == NULL) { - sact = (struct sigaction *)malloc((MAX_SIGNALS) * (size_t)sizeof(struct sigaction)); - if (sact == NULL) { - printf("%s\n", "libjsig.so unable to allocate memory"); - exit(0); - } - memset(sact, 0, (MAX_SIGNALS) * (size_t)sizeof(struct sigaction)); - } -#endif -} - static void signal_lock() { pthread_mutex_lock(&mutex); /* When the jvm is installing its set of signal handlers, threads @@ -168,18 +137,7 @@ sact[sig].sa_handler = disp; sigemptyset(&set); sact[sig].sa_mask = set; - if (!is_sigset) { -#ifdef SOLARIS - sact[sig].sa_flags = SA_NODEFER; - if (sig != SIGILL && sig != SIGTRAP && sig != SIGPWR) { - sact[sig].sa_flags |= SA_RESETHAND; - } -#else - sact[sig].sa_flags = 0; -#endif - } else { - sact[sig].sa_flags = 0; - } + sact[sig].sa_flags = 0; } static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) { @@ -188,7 +146,6 @@ bool sigblocked; signal_lock(); - allocate_sact(); deprecated_usage[sig] = true; @@ -203,13 +160,6 @@ oldhandler = sact[sig].sa_handler; save_signal_handler(sig, disp, is_sigset); -#ifdef SOLARIS - if (is_sigset && sigblocked) { - /* We won't honor the SIG_HOLD request to change the signal mask */ - oldhandler = SIG_HOLD; - } -#endif - signal_unlock(); return oldhandler; } else if (jvm_signal_installing) { @@ -287,7 +237,6 @@ signal_lock(); - allocate_sact(); sigused = sigismember(&jvmsigs, sig); if (jvm_signal_installed && sigused) { /* jvm has installed its signal handler for this signal. */ @@ -357,7 +306,6 @@ } JNIEXPORT struct sigaction *JVM_get_signal_action(int sig) { - allocate_sact(); /* Does race condition make sense here? */ if (sigismember(&jvmsigs, sig)) { return &sact[sig]; --- old/src/java.base/unix/native/libnet/NetworkInterface.c 2020-05-20 18:01:23.023667898 -0700 +++ new/src/java.base/unix/native/libnet/NetworkInterface.c 2020-05-20 18:01:22.695661600 -0700 @@ -37,11 +37,6 @@ #include #endif -#if defined(__solaris__) -#include -#include -#endif - #if defined(_ALLBSD_SOURCE) #include #include @@ -1674,265 +1669,6 @@ #endif /* _AIX */ -/** Solaris **/ -#if defined(__solaris__) - -/* - * Opens a socket for further ioctl calls. Tries AF_INET socket first and - * if it fails return AF_INET6 socket. - */ -static int openSocketWithFallback(JNIEnv *env, const char *ifname) { - int sock, alreadyV6 = 0; - struct lifreq if2; - - if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT) { - if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed"); - return -1; - } - alreadyV6 = 1; - } else { // errno is not NOSUPPORT - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "IPV4 Socket creation failed"); - return -1; - } - } - - // Solaris requires that we have an IPv6 socket to query an interface - // without an IPv4 address - check it here. POSIX 1 require the kernel to - // return ENOTTY if the call is inappropriate for a device e.g. the NETMASK - // for a device having IPv6 only address but not all devices follow the - // standard so fall back on any error. It's not an ecologically friendly - // gesture but more reliable. - if (!alreadyV6) { - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1); - if (ioctl(sock, SIOCGLIFNETMASK, (char *)&if2) < 0) { - close(sock); - if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed"); - return -1; - } - } - } - - return sock; -} - -/* - * Enumerates and returns all IPv4 interfaces on Solaris. - */ -static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { - struct lifconf ifc; - struct lifreq *ifreqP; - struct lifnum numifs; - char *buf = NULL; - unsigned i; - - // call SIOCGLIFNUM to get the interface count - numifs.lifn_family = AF_INET; - numifs.lifn_flags = 0; - if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNUM) failed"); - return ifs; - } - - // call SIOCGLIFCONF to enumerate the interfaces - ifc.lifc_len = numifs.lifn_count * sizeof(struct lifreq); - CHECKED_MALLOC3(buf, char *, ifc.lifc_len); - ifc.lifc_buf = buf; - ifc.lifc_family = AF_INET; - ifc.lifc_flags = 0; - if (ioctl(sock, SIOCGLIFCONF, (char *)&ifc) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFCONF) failed"); - free(buf); - return ifs; - } - - // iterate through each interface - ifreqP = ifc.lifc_req; - for (i = 0; i < numifs.lifn_count; i++, ifreqP++) { - struct sockaddr addr, *broadaddrP = NULL; - - // ignore non IPv4 addresses - if (ifreqP->lifr_addr.ss_family != AF_INET) { - continue; - } - - // save socket address - memcpy(&addr, &(ifreqP->lifr_addr), sizeof(struct sockaddr)); - - // determine broadcast address, if applicable - if ((ioctl(sock, SIOCGLIFFLAGS, ifreqP) == 0) && - ifreqP->lifr_flags & IFF_BROADCAST) { - - // restore socket address to ifreqP - memcpy(&(ifreqP->lifr_addr), &addr, sizeof(struct sockaddr)); - - // query broadcast address and set pointer to it - if (ioctl(sock, SIOCGLIFBRDADDR, ifreqP) == 0) { - broadaddrP = (struct sockaddr *)&(ifreqP->lifr_broadaddr); - } - } - - // add to the list - ifs = addif(env, sock, ifreqP->lifr_name, ifs, - &addr, broadaddrP, AF_INET, (short)ifreqP->lifr_addrlen); - - // if an exception occurred we return immediately - if ((*env)->ExceptionOccurred(env)) { - free(buf); - return ifs; - } - } - - // free buffer - free(buf); - return ifs; -} - -/* - * Enumerates and returns all IPv6 interfaces on Solaris. - */ -static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { - struct lifconf ifc; - struct lifreq *ifreqP; - struct lifnum numifs; - char *buf = NULL; - unsigned i; - - // call SIOCGLIFNUM to get the interface count - numifs.lifn_family = AF_INET6; - numifs.lifn_flags = 0; - if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNUM) failed"); - return ifs; - } - - // call SIOCGLIFCONF to enumerate the interfaces - ifc.lifc_len = numifs.lifn_count * sizeof(struct lifreq); - CHECKED_MALLOC3(buf, char *, ifc.lifc_len); - ifc.lifc_buf = buf; - ifc.lifc_family = AF_INET6; - ifc.lifc_flags = 0; - if (ioctl(sock, SIOCGLIFCONF, (char *)&ifc) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFCONF) failed"); - free(buf); - return ifs; - } - - // iterate through each interface - ifreqP = ifc.lifc_req; - for (i = 0; i < numifs.lifn_count; i++, ifreqP++) { - - // ignore non IPv6 addresses - if (ifreqP->lifr_addr.ss_family != AF_INET6) { - continue; - } - - // set scope ID to interface index - ((struct sockaddr_in6 *)&(ifreqP->lifr_addr))->sin6_scope_id = - getIndex(sock, ifreqP->lifr_name); - - // add to the list - ifs = addif(env, sock, ifreqP->lifr_name, ifs, - (struct sockaddr *)&(ifreqP->lifr_addr), - NULL, AF_INET6, (short)ifreqP->lifr_addrlen); - - // if an exception occurred we return immediately - if ((*env)->ExceptionOccurred(env)) { - free(buf); - return ifs; - } - } - - // free buffer - free(buf); - return ifs; -} - -/* - * Try to get the interface index. - */ -static int getIndex(int sock, const char *name) { - struct lifreq if2; - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.lifr_name, name, sizeof(if2.lifr_name) - 1); - - if (ioctl(sock, SIOCGLIFINDEX, (char *)&if2) < 0) { - return -1; - } - - return if2.lifr_index; -} - -/* - * Gets the Hardware address (usually MAC address) for the named interface. - * On return puts the data in buf, and returns the length, in byte, of the - * MAC address. Returns -1 if there is no hardware address on that interface. - */ -static int getMacAddress - (JNIEnv *env, const char *ifname, const struct in_addr *addr, - unsigned char *buf) -{ - struct lifreq if2; - int sock; - - if ((sock = openSocketWithFallback(env, ifname)) < 0) { - return -1; - } - - // Use the new (S11) SIOCGLIFHWADDR ioctl(). - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1); - - if (ioctl(sock, SIOCGLIFHWADDR, &if2) != -1) { - struct sockaddr_dl *sp; - sp = (struct sockaddr_dl *)&if2.lifr_addr; - memcpy(buf, &sp->sdl_data[0], sp->sdl_alen); - close(sock); - return sp->sdl_alen; - } - close(sock); - return -1; -} - -static int getMTU(JNIEnv *env, int sock, const char *ifname) { - struct lifreq if2; - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1); - - if (ioctl(sock, SIOCGLIFMTU, (char *)&if2) < 0) { - JNU_ThrowByNameWithMessageAndLastError - (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFMTU) failed"); - return -1; - } - - return if2.lifr_mtu; -} - -static int getFlags(int sock, const char *ifname, int *flags) { - struct lifreq if2; - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1); - - if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) { - return -1; - } - - *flags = if2.lifr_flags; - return 0; -} - -#endif /* __solaris__ */ - /** BSD **/ #if defined(_ALLBSD_SOURCE) --- old/src/java.base/unix/native/libnet/net_util_md.c 2020-05-20 18:01:28.435771815 -0700 +++ new/src/java.base/unix/native/libnet/net_util_md.c 2020-05-20 18:01:28.059764595 -0700 @@ -36,14 +36,6 @@ #include #endif -#if defined(__solaris__) -#include -#include -#include -#include -#include -#endif - #if defined(MACOSX) #include #endif @@ -67,20 +59,6 @@ return 0; } -#if defined(__solaris__) && !defined(MAXINT) -#define MAXINT INT_MAX -#endif - -/* - * EXCLBIND socket options only on Solaris - */ -#if defined(__solaris__) && !defined(TCP_EXCLBIND) -#define TCP_EXCLBIND 0x21 -#endif -#if defined(__solaris__) && !defined(UDP_EXCLBIND) -#define UDP_EXCLBIND 0x0101 -#endif - void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail) { @@ -87,94 +65,6 @@ JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail); } -#ifdef __solaris__ -static int init_tcp_max_buf, init_udp_max_buf; -static int tcp_max_buf; -static int udp_max_buf; -static int useExclBind = 0; - -/* - * Get the specified parameter from the specified driver. The value - * of the parameter is assumed to be an 'int'. If the parameter - * cannot be obtained return -1 - */ -int net_getParam(char *driver, char *param) -{ - struct strioctl stri; - char buf [64]; - int s; - int value; - - s = open (driver, O_RDWR); - if (s < 0) { - return -1; - } - strncpy (buf, param, sizeof(buf)); - stri.ic_cmd = ND_GET; - stri.ic_timout = 0; - stri.ic_dp = buf; - stri.ic_len = sizeof(buf); - if (ioctl (s, I_STR, &stri) < 0) { - value = -1; - } else { - value = atoi(buf); - } - close (s); - return value; -} - -/* - * Iterative way to find the max value that SO_SNDBUF or SO_RCVBUF - * for Solaris versions that do not support the ioctl() in net_getParam(). - * Ugly, but only called once (for each sotype). - * - * As an optimization, we make a guess using the default values for Solaris - * assuming they haven't been modified with ndd. - */ - -#define MAX_TCP_GUESS 1024 * 1024 -#define MAX_UDP_GUESS 2 * 1024 * 1024 - -#define FAIL_IF_NOT_ENOBUFS if (errno != ENOBUFS) return -1 - -static int findMaxBuf(int fd, int opt, int sotype) { - int a = 0; - int b = MAXINT; - int initial_guess; - int limit = -1; - - if (sotype == SOCK_DGRAM) { - initial_guess = MAX_UDP_GUESS; - } else { - initial_guess = MAX_TCP_GUESS; - } - - if (setsockopt(fd, SOL_SOCKET, opt, &initial_guess, sizeof(int)) == 0) { - initial_guess++; - if (setsockopt(fd, SOL_SOCKET, opt, &initial_guess,sizeof(int)) < 0) { - FAIL_IF_NOT_ENOBUFS; - return initial_guess - 1; - } - a = initial_guess; - } else { - FAIL_IF_NOT_ENOBUFS; - b = initial_guess - 1; - } - do { - int mid = a + (b-a)/2; - if (setsockopt(fd, SOL_SOCKET, opt, &mid, sizeof(int)) == 0) { - limit = mid; - a = mid + 1; - } else { - FAIL_IF_NOT_ENOBUFS; - b = mid - 1; - } - } while (b >= a); - - return limit; -} -#endif - void NET_ThrowNew(JNIEnv *env, int errorNumber, char *msg) { char fullMsg[512]; @@ -252,50 +142,6 @@ } #endif - /** - * On Solaris 8 it's possible to create INET6 sockets even - * though IPv6 is not enabled on all interfaces. Thus we - * query the number of IPv6 addresses to verify that IPv6 - * has been configured on at least one interface. - * - * On Linux it doesn't matter - if IPv6 is built-in the - * kernel then IPv6 addresses will be bound automatically - * to all interfaces. - */ -#ifdef __solaris__ - -#ifdef SIOCGLIFNUM - { - struct lifnum numifs; - - numifs.lifn_family = AF_INET6; - numifs.lifn_flags = 0; - if (ioctl(fd, SIOCGLIFNUM, (char *)&numifs) < 0) { - /** - * SIOCGLIFNUM failed - assume IPv6 not configured - */ - close(fd); - return JNI_FALSE; - } - /** - * If no IPv6 addresses then return false. If count > 0 - * it's possible that all IPv6 addresses are "down" but - * that's okay as they may be brought "up" while the - * VM is running. - */ - if (numifs.lifn_count == 0) { - close(fd); - return JNI_FALSE; - } - } -#else - /* SIOCGLIFNUM not defined in build environment ??? */ - close(fd); - return JNI_FALSE; -#endif - -#endif /* __solaris */ - /* * OK we may have the stack available in the kernel, * we should also check if the APIs are available. @@ -376,26 +222,6 @@ } } -void parseExclusiveBindProperty(JNIEnv *env) { -#ifdef __solaris__ - jstring s, flagSet; - jclass iCls; - jmethodID mid; - - s = (*env)->NewStringUTF(env, "sun.net.useExclusiveBind"); - CHECK_NULL(s); - iCls = (*env)->FindClass(env, "java/lang/System"); - CHECK_NULL(iCls); - mid = (*env)->GetStaticMethodID(env, iCls, "getProperty", - "(Ljava/lang/String;)Ljava/lang/String;"); - CHECK_NULL(mid); - flagSet = (*env)->CallStaticObjectMethod(env, iCls, mid, s); - if (flagSet != NULL) { - useExclBind = 1; - } -#endif -} - JNIEXPORT jint JNICALL NET_EnableFastTcpLoopback(int fd) { return 0; @@ -637,65 +463,6 @@ *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK); } - /* - * SOL_SOCKET/{SO_SNDBUF,SO_RCVBUF} - On Solaris we may need to clamp - * the value when it exceeds the system limit. - */ -#ifdef __solaris__ - if (level == SOL_SOCKET) { - if (opt == SO_SNDBUF || opt == SO_RCVBUF) { - int sotype=0; - socklen_t arglen; - int *bufsize, maxbuf; - int ret; - - /* Attempt with the original size */ - ret = setsockopt(fd, level, opt, arg, len); - if ((ret == 0) || (ret == -1 && errno != ENOBUFS)) - return ret; - - /* Exceeded system limit so clamp and retry */ - - arglen = sizeof(sotype); - if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, - &arglen) < 0) { - return -1; - } - - /* - * We try to get tcp_max_buf (and udp_max_buf) using - * an ioctl() that isn't available on all versions of Solaris. - * If that fails, we use the search algorithm in findMaxBuf() - */ - if (!init_tcp_max_buf && sotype == SOCK_STREAM) { - tcp_max_buf = net_getParam("/dev/tcp", "tcp_max_buf"); - if (tcp_max_buf == -1) { - tcp_max_buf = findMaxBuf(fd, opt, SOCK_STREAM); - if (tcp_max_buf == -1) { - return -1; - } - } - init_tcp_max_buf = 1; - } else if (!init_udp_max_buf && sotype == SOCK_DGRAM) { - udp_max_buf = net_getParam("/dev/udp", "udp_max_buf"); - if (udp_max_buf == -1) { - udp_max_buf = findMaxBuf(fd, opt, SOCK_DGRAM); - if (udp_max_buf == -1) { - return -1; - } - } - init_udp_max_buf = 1; - } - - maxbuf = (sotype == SOCK_STREAM) ? tcp_max_buf : udp_max_buf; - bufsize = (int *)arg; - if (*bufsize > maxbuf) { - *bufsize = maxbuf; - } - } - } -#endif - #ifdef _AIX if (level == SOL_SOCKET) { if (opt == SO_SNDBUF || opt == SO_RCVBUF) { @@ -810,20 +577,10 @@ * * Linux allows a socket to bind to 127.0.0.255 which must be * caught. - * - * On Solaris with IPv6 enabled we must use an exclusive - * bind to guarantee a unique port number across the IPv4 and - * IPv6 port spaces. - * */ int NET_Bind(int fd, SOCKETADDRESS *sa, int len) { -#if defined(__solaris__) - int level = -1; - int exclbind = -1; - int arg, alen; -#endif int rv; #ifdef __linux__ @@ -840,61 +597,8 @@ } #endif -#if defined(__solaris__) - /* - * Solaris has separate IPv4 and IPv6 port spaces so we - * use an exclusive bind when SO_REUSEADDR is not used to - * give the illusion of a unified port space. - * This also avoids problems with IPv6 sockets connecting - * to IPv4 mapped addresses whereby the socket conversion - * results in a late bind that fails because the - * corresponding IPv4 port is in use. - */ - alen = sizeof(arg); - - if (useExclBind || - getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&arg, &alen) == 0) - { - if (useExclBind || arg == 0) { - /* - * SO_REUSEADDR is disabled or sun.net.useExclusiveBind - * property is true so enable TCP_EXCLBIND or - * UDP_EXCLBIND - */ - alen = sizeof(arg); - if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg, &alen) == 0) - { - if (arg == SOCK_STREAM) { - level = IPPROTO_TCP; - exclbind = TCP_EXCLBIND; - } else { - level = IPPROTO_UDP; - exclbind = UDP_EXCLBIND; - } - } - - arg = 1; - setsockopt(fd, level, exclbind, (char *)&arg, sizeof(arg)); - } - } - -#endif - rv = bind(fd, &sa->sa, len); -#if defined(__solaris__) - if (rv < 0) { - int en = errno; - /* Restore *_EXCLBIND if the bind fails */ - if (exclbind != -1) { - int arg = 0; - setsockopt(fd, level, exclbind, (char *)&arg, - sizeof(arg)); - } - errno = en; - } -#endif - return rv; } --- old/src/java.base/unix/native/libnet/net_util_md.h 2020-05-20 18:01:29.539793012 -0700 +++ new/src/java.base/unix/native/libnet/net_util_md.h 2020-05-20 18:01:29.147785486 -0700 @@ -47,8 +47,6 @@ #ifndef SO_REUSEPORT #ifdef __linux__ #define SO_REUSEPORT 15 -#elif defined(__solaris__) -#define SO_REUSEPORT 0x100e #elif defined(AIX) || defined(MACOSX) #define SO_REUSEPORT 0x0200 #else @@ -82,8 +80,4 @@ void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail); -#ifdef __solaris__ -int net_getParam(char *driver, char *param); -#endif - #endif /* NET_UTILS_MD_H */ --- old/src/java.base/unix/native/libnet/portconfig.c 2020-05-20 18:01:30.539812214 -0700 +++ new/src/java.base/unix/native/libnet/portconfig.c 2020-05-20 18:01:30.203805762 -0700 @@ -60,13 +60,6 @@ } return -1; } - -#elif defined(__solaris__) - { - range->higher = net_getParam("/dev/tcp", "tcp_largest_anon_port"); - range->lower = net_getParam("/dev/tcp", "tcp_smallest_anon_port"); - return 0; - } #elif defined(_ALLBSD_SOURCE) { int ret; --- old/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c 2020-05-20 18:01:31.615832874 -0700 +++ new/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c 2020-05-20 18:01:31.211825117 -0700 @@ -50,9 +50,6 @@ jint fd = fdval(env, fdo); int rv; -#if defined(__solaris__) - rv = connect(fd, 0, 0); -#else #if defined(__APPLE__) // On macOS systems we use disconnectx rv = disconnectx(fd, SAE_ASSOCID_ANY, SAE_CONNID_ANY); @@ -86,8 +83,6 @@ rv = errno = 0; #endif // defined(_ALLBSD_SOURCE) || defined(_AIX) -#endif // defined(__solaris__) - if (rv < 0) handleSocketError(env, errno); } --- old/src/java.base/unix/native/libnio/ch/NativeThread.c 2020-05-20 18:01:33.783874502 -0700 +++ new/src/java.base/unix/native/libnio/ch/NativeThread.c 2020-05-20 18:01:33.371866591 -0700 @@ -40,8 +40,6 @@ #elif defined(_AIX) /* Also defined in net/aix_close.c */ #define INTERRUPT_SIGNAL (SIGRTMAX - 1) -#elif defined(__solaris__) - #define INTERRUPT_SIGNAL (SIGRTMAX - 2) #elif defined(_ALLBSD_SOURCE) /* Also defined in net/bsd_close.c */ #define INTERRUPT_SIGNAL SIGIO --- old/src/java.base/unix/native/libnio/ch/Net.c 2020-05-20 18:01:34.943896775 -0700 +++ new/src/java.base/unix/native/libnio/ch/Net.c 2020-05-20 18:01:34.515888557 -0700 @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -226,7 +225,7 @@ JNIEXPORT jboolean JNICALL Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl) { -#if defined(__linux__) || defined(__APPLE__) || defined(__solaris__) +#if defined(__linux__) || defined(__APPLE__) /* IPv6 sockets can join IPv4 multicast groups */ return JNI_TRUE; #else @@ -238,7 +237,7 @@ JNIEXPORT jboolean JNICALL Java_sun_nio_ch_Net_canJoin6WithIPv4Group0(JNIEnv* env, jclass cl) { -#if defined(__APPLE__) || defined(__solaris__) +#if defined(__APPLE__) /* IPV6_ADD_MEMBERSHIP can be used to join IPv4 multicast groups */ return JNI_TRUE; #else --- old/src/java.base/unix/native/libnio/ch/nio_util.h 2020-05-20 18:01:36.115919279 -0700 +++ new/src/java.base/unix/native/libnio/ch/nio_util.h 2020-05-20 18:01:35.695911215 -0700 @@ -35,8 +35,6 @@ #ifndef SO_REUSEPORT #ifdef __linux__ #define SO_REUSEPORT 15 -#elif defined(__solaris__) -#define SO_REUSEPORT 0x100e #elif defined(AIX) || defined(MACOSX) #define SO_REUSEPORT 0x0200 #else --- old/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c 2020-05-20 18:01:37.127938711 -0700 +++ new/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c 2020-05-20 18:01:36.787932182 -0700 @@ -50,17 +50,10 @@ #include #endif -/* For POSIX-compliant getpwuid_r, getgrgid_r on Solaris */ -#if defined(__solaris__) -#define _POSIX_PTHREAD_SEMANTICS -#endif +/* For POSIX-compliant getpwuid_r */ #include #include -#ifdef __solaris__ -#include -#endif - #ifdef __linux__ #include // For uintXX_t types used in statx support #include @@ -351,8 +344,7 @@ my_openat_func = (openat_func*) dlsym(RTLD_DEFAULT, "open64at"); my_fstatat_func = (fstatat_func*) dlsym(RTLD_DEFAULT, "stat64at"); my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir64"); -#elif defined(__solaris__) || defined(_ALLBSD_SOURCE) - /* Solaris 64-bit does not have openat64/fstatat64 */ +#elif defined(_ALLBSD_SOURCE) my_openat_func = (openat_func*) openat; my_fstatat_func = (fstatat_func*) fstatat; my_fdopendir_func = (fdopendir_func*) fdopendir; --- old/src/java.base/windows/native/libnet/net_util_md.c 2020-05-20 18:01:38.255960369 -0700 +++ new/src/java.base/windows/native/libnet/net_util_md.c 2020-05-20 18:01:37.863952843 -0700 @@ -117,8 +117,6 @@ return WSAStartup(MAKEWORD(2,2), &wsadata); } - -void parseExclusiveBindProperty(JNIEnv *env) {} /* * Since winsock doesn't have the equivalent of strerror(errno) --- old/src/java.desktop/share/classes/sun/awt/FontConfiguration.java 2020-05-20 18:01:41.588024347 -0700 +++ new/src/java.desktop/share/classes/sun/awt/FontConfiguration.java 2020-05-20 18:01:41.204016974 -0700 @@ -1401,22 +1401,6 @@ } } } - if (OSInfo.getOSType() == OSInfo.OSType.SOLARIS) { - for (int ii = 0; ii < table_awtfontpaths.length; ii++) { - if (table_awtfontpaths[ii] == 0) { - String script = getString(table_scriptIDs[ii]); - if (script.contains("dingbats") || - script.contains("symbol")) { - continue; - } - System.err.println("\nError: " - + " entry is missing!!!"); - errors++; - } - } - } if (errors != 0) { System.err.println("!!THERE ARE " + errors + " ERROR(S) IN " + "THE FONTCONFIG FILE, PLEASE CHECK ITS CONTENT!!\n"); --- old/src/java.desktop/share/classes/sun/awt/OSInfo.java 2020-05-20 18:01:42.704045776 -0700 +++ new/src/java.desktop/share/classes/sun/awt/OSInfo.java 2020-05-20 18:01:42.320038402 -0700 @@ -39,7 +39,6 @@ public static enum OSType { WINDOWS, LINUX, - SOLARIS, MACOSX, AIX, UNKNOWN @@ -96,7 +95,6 @@ // Map OperatingSystem enum values to OSType enum values. case WINDOWS -> WINDOWS; case LINUX -> LINUX; - case SOLARIS -> SOLARIS; case MACOS -> MACOSX; case AIX -> AIX; default -> UNKNOWN; --- old/src/java.desktop/share/classes/sun/font/FontUtilities.java 2020-05-20 18:01:48.020147849 -0700 +++ new/src/java.desktop/share/classes/sun/font/FontUtilities.java 2020-05-20 18:01:47.620140168 -0700 @@ -39,8 +39,6 @@ */ public final class FontUtilities { - public static boolean isSolaris; - public static boolean isLinux; public static boolean isMacOSX; @@ -61,8 +59,6 @@ @SuppressWarnings("deprecation") // PlatformLogger.setLevel is deprecated. private static void initStatic() { - - isSolaris = OSInfo.getOSType() == OSInfo.OSType.SOLARIS; isLinux = OSInfo.getOSType() == OSInfo.OSType.LINUX; --- old/src/java.desktop/share/native/libjsound/SoundDefs.h 2020-05-20 18:01:56.500310674 -0700 +++ new/src/java.desktop/share/native/libjsound/SoundDefs.h 2020-05-20 18:01:56.112303224 -0700 @@ -29,10 +29,9 @@ // types for X_PLATFORM #define X_WINDOWS 1 -#define X_SOLARIS 2 -#define X_LINUX 3 -#define X_BSD 4 -#define X_MACOSX 5 +#define X_LINUX 2 +#define X_BSD 3 +#define X_MACOSX 4 // ********************************** // Make sure you set X_PLATFORM defines correctly. @@ -45,7 +44,7 @@ // following is needed for _LP64 -#if ((X_PLATFORM == X_SOLARIS) || (X_PLATFORM == X_LINUX) || (X_PLATFORM == X_MACOSX)) +#if ((X_PLATFORM == X_LINUX) || (X_PLATFORM == X_MACOSX)) #include #endif @@ -115,11 +114,6 @@ #endif -#if X_PLATFORM == X_SOLARIS -#define INLINE -#endif - - #if X_PLATFORM == X_LINUX #define INLINE inline #endif --- old/src/java.desktop/unix/classes/sun/awt/X11FontManager.java 2020-05-20 18:02:35.237054448 -0700 +++ new/src/java.desktop/unix/classes/sun/awt/X11FontManager.java 2020-05-20 18:02:34.897047919 -0700 @@ -687,8 +687,7 @@ * and do the best we can. */ FontConfiguration mFontConfig = new MFontConfiguration(this); - if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) || - (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) { + if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile())) { FcFontConfiguration fcFontConfig = new FcFontConfiguration(this); if (fcFontConfig.init()) { --- old/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java 2020-05-20 18:02:37.405096076 -0700 +++ new/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java 2020-05-20 18:02:37.021088702 -0700 @@ -69,59 +69,7 @@ @Override protected void initReorderMap() { reorderMap = new HashMap<>(); - if (osName.equals("SunOS")) { - initReorderMapForSolaris(); - } else { - initReorderMapForLinux(); - } - } - - private void initReorderMapForSolaris() { - /* Don't create a no-op entry, so we can optimize this case - * i.e. we don't need to do anything so can avoid slower paths in - * the code. - */ -// reorderMap.put("UTF-8", "latin-1"); - reorderMap.put("UTF-8.hi", "devanagari"); // NB is in Lucida. - reorderMap.put("UTF-8.ja", - new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"}); - reorderMap.put("UTF-8.ko", "korean-johab"); - reorderMap.put("UTF-8.th", "thai"); - reorderMap.put("UTF-8.zh.TW", "chinese-big5"); - reorderMap.put("UTF-8.zh.HK", new String[] {"chinese-big5", "chinese-hkscs"}); - reorderMap.put("UTF-8.zh.CN", - new String[] {"chinese-gb18030-0", "chinese-gb18030-1"}); - reorderMap.put("UTF-8.zh", - new String[] {"chinese-big5", "chinese-hkscs", "chinese-gb18030-0,chinese-gb18030-1"}); - reorderMap.put("Big5", "chinese-big5"); - reorderMap.put("Big5-HKSCS", new String[] {"chinese-big5", "chinese-hkscs"}); - reorderMap.put("GB2312", new String[] {"chinese-gbk", "chinese-gb2312"}); - reorderMap.put("x-EUC-TW", - new String[] {"chinese-cns11643-1", "chinese-cns11643-2", "chinese-cns11643-3"}); - reorderMap.put("GBK", "chinese-gbk"); - reorderMap.put("GB18030",new String[] {"chinese-gb18030-0", "chinese-gb18030-1"}); - - reorderMap.put("TIS-620", "thai"); - reorderMap.put("x-PCK", - new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"}); - reorderMap.put("x-eucJP-Open", - new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"}); - reorderMap.put("EUC-KR", "korean"); - /* Don't create a no-op entry, so we can optimize this case */ -// reorderMap.put("ISO-8859-1", "latin-1"); - reorderMap.put("ISO-8859-2", "latin-2"); - reorderMap.put("ISO-8859-5", "cyrillic-iso8859-5"); - reorderMap.put("windows-1251", "cyrillic-cp1251"); - reorderMap.put("KOI8-R", "cyrillic-koi8-r"); - reorderMap.put("ISO-8859-6", "arabic"); - reorderMap.put("ISO-8859-7", "greek"); - reorderMap.put("ISO-8859-8", "hebrew"); - reorderMap.put("ISO-8859-9", "latin-5"); - reorderMap.put("ISO-8859-13", "latin-7"); - reorderMap.put("ISO-8859-15", "latin-9"); - } - private void initReorderMapForLinux() { reorderMap.put("UTF-8.ja.JP", "japanese-iso10646"); reorderMap.put("UTF-8.ko.KR", "korean-iso10646"); reorderMap.put("UTF-8.zh.TW", "chinese-tw-iso10646"); --- old/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java 2020-05-20 18:02:38.501117121 -0700 +++ new/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java 2020-05-20 18:02:38.117109747 -0700 @@ -139,10 +139,6 @@ return OSInfo.getOSType() == OSInfo.OSType.MACOSX; } - static boolean isSysV() { - return OSInfo.getOSType() == OSInfo.OSType.SOLARIS; - } - static boolean isLinux() { return OSInfo.getOSType() == OSInfo.OSType.LINUX; } @@ -149,7 +145,6 @@ static boolean isBSD() { return (OSInfo.getOSType() == OSInfo.OSType.LINUX || - OSInfo.getOSType() == OSInfo.OSType.SOLARIS || OSInfo.getOSType() == OSInfo.OSType.MACOSX); } @@ -287,7 +282,7 @@ } } } else { - if (isMac() || isSysV()) { + if (isMac()) { printers = getAllPrinterNamesSysV(); } else if (isAIX()) { printers = getAllPrinterNamesAIX(); @@ -471,7 +466,7 @@ } /* fallback if nothing not having a printer at this point */ PrintService printer = null; - if (isMac() || isSysV()) { + if (isMac()) { printer = getNamedPrinterNameSysV(name); } else if (isAIX()) { printer = getNamedPrinterNameAIX(name); @@ -629,7 +624,7 @@ psuri = printerInfo[1]; } } else { - if (isMac() || isSysV()) { + if (isMac()) { defaultPrinter = getDefaultPrinterNameSysV(); } else if (isAIX()) { defaultPrinter = getDefaultPrinterNameAIX(); --- old/src/java.desktop/unix/native/common/awt/fontpath.c 2020-05-20 18:02:43.805218963 -0700 +++ new/src/java.desktop/unix/native/common/awt/fontpath.c 2020-05-20 18:02:43.465212435 -0700 @@ -57,16 +57,7 @@ #define MAXFDIRS 512 /* Max number of directories that contain fonts */ -#if defined(__solaris__) -/* These are well known Solaris 11 or illumos X11 directories. - */ -static char *fullSolarisFontPath[] = { - "/usr/share/fonts/TrueType", - "/usr/share/fonts/X11/Type1", - NULL, /* terminates the list */ -}; - -#elif defined( __linux__) +#if defined( __linux__) /* All the known interesting locations we have discovered on * various flavors of Linux */ @@ -330,8 +321,6 @@ #if defined(__linux__) knowndirs = fullLinuxFontPath; -#elif defined(__solaris__) - knowndirs = fullSolarisFontPath; #elif defined(_AIX) knowndirs = fullAixFontPath; #endif --- old/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c 2020-05-20 18:02:46.009261282 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c 2020-05-20 18:02:45.625253909 -0700 @@ -404,12 +404,7 @@ xrenderLibHandle = dlopen("libXrender.so", RTLD_LAZY | RTLD_GLOBAL); } -#if defined(__solaris__) - if (xrenderLibHandle == NULL) { - xrenderLibHandle = dlopen("libXrender.so.1", - RTLD_LAZY | RTLD_GLOBAL); - } -#elif defined(_AIX) +#if defined(_AIX) if (xrenderLibHandle == NULL) { xrenderLibHandle = dlopen("libXrender.a(libXrender.so.0)", RTLD_MEMBER | RTLD_LAZY | RTLD_GLOBAL); --- old/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c 2020-05-20 18:02:47.985299224 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c 2020-05-20 18:02:47.661293003 -0700 @@ -76,29 +61,6 @@ #include -#if defined(__solaris__) -/* Solaris 10 will not have these symbols at compile time */ - -typedef Picture (*XRenderCreateLinearGradientFuncType) - (Display *dpy, - const XLinearGradient *gradient, - const XFixed *stops, - const XRenderColor *colors, - int nstops); - -typedef Picture (*XRenderCreateRadialGradientFuncType) - (Display *dpy, - const XRadialGradient *gradient, - const XFixed *stops, - const XRenderColor *colors, - int nstops); - -static -XRenderCreateLinearGradientFuncType XRenderCreateLinearGradientFunc = NULL; -static - XRenderCreateRadialGradientFuncType XRenderCreateRadialGradientFunc = NULL; -#endif - #define BUILD_TRANSFORM_MATRIX(TRANSFORM, M00, M01, M02, M10, M11, M12) \ { \ TRANSFORM.matrix[0][0] = M00; \ @@ -166,27 +128,6 @@ } else { available = JNI_FALSE; } -#elif defined(__solaris__) - xrenderlib = dlopen("libXrender.so",RTLD_GLOBAL|RTLD_LAZY); - if (xrenderlib != NULL) { - - XRenderCreateLinearGradientFunc = - (XRenderCreateLinearGradientFuncType) - dlsym(xrenderlib, "XRenderCreateLinearGradient"); - - XRenderCreateRadialGradientFunc = - (XRenderCreateRadialGradientFuncType) - dlsym(xrenderlib, "XRenderCreateRadialGradient"); - - if (XRenderCreateLinearGradientFunc == NULL || - XRenderCreateRadialGradientFunc == NULL) - { - available = JNI_FALSE; - } - dlclose(xrenderlib); - } else { - available = JNI_FALSE; - } #else Dl_info info; jboolean versionInfoIsFound = JNI_FALSE; @@ -593,13 +534,7 @@ colors[i].green = pixels[i*4 + 2]; colors[i].blue = pixels[i*4 + 3]; } -#ifdef __solaris__ - if (XRenderCreateLinearGradientFunc!=NULL) { - gradient = (*XRenderCreateLinearGradientFunc)(awt_display, &grad, stops, colors, numStops); - } -#else gradient = XRenderCreateLinearGradient(awt_display, &grad, stops, colors, numStops); -#endif free(colors); free(stops); @@ -677,13 +612,7 @@ colors[i].green = pixels[i*4 + 2]; colors[i].blue = pixels[i*4 + 3]; } -#ifdef __solaris__ - if (XRenderCreateRadialGradientFunc != NULL) { - gradient = (jint) (*XRenderCreateRadialGradientFunc)(awt_display, &grad, stops, colors, numStops); - } -#else gradient = (jint) XRenderCreateRadialGradient(awt_display, &grad, stops, colors, numStops); -#endif free(colors); free(stops); --- old/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2020-05-20 18:02:49.005318809 -0700 +++ new/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2020-05-20 18:02:48.665312280 -0700 @@ -83,9 +83,6 @@ String defaultLib = System.getProperty("sun.security.jgss.lib"); if (defaultLib == null || defaultLib.trim().equals("")) { gssLibs = switch (OperatingSystem.current()) { - case SOLARIS -> new String[]{ - "libgss.so", - }; case LINUX -> new String[]{ "libgssapi.so", "libgssapi_krb5.so", --- old/src/java.security.jgss/share/classes/sun/security/krb5/Config.java 2020-05-20 18:02:50.089339623 -0700 +++ new/src/java.security.jgss/share/classes/sun/security/krb5/Config.java 2020-05-20 18:02:49.705332249 -0700 @@ -981,8 +981,6 @@ if (name == null) { name = "c:\\winnt\\krb5.ini"; } - } else if (OperatingSystem.isSolaris()) { - name = "/etc/krb5/krb5.conf"; } else if (OperatingSystem.isMacOS()) { name = findMacosConfigFile(); } else { --- old/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java 2020-05-20 18:02:51.185360667 -0700 +++ new/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java 2020-05-20 18:02:50.801353294 -0700 @@ -106,7 +106,7 @@ private static long uid; static { - // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix + // Available on Linux and Mac. Otherwise, -1 and no _euid suffix uid = jdk.internal.misc.VM.geteuid(); } --- old/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 2020-05-20 18:02:52.281381711 -0700 +++ new/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 2020-05-20 18:02:51.897374338 -0700 @@ -86,12 +86,8 @@ if (k != -1) { String libDir; if ("64".equals(System.getProperty("sun.arch.data.model"))) { - if ("SunOS".equals(System.getProperty("os.name"))) { - libDir = "lib/64"; - } else { - // assume Linux convention - libDir = "lib64"; - } + // assume Linux convention + libDir = "lib64"; } else { // must be 32-bit libDir = "lib"; --- old/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2020-05-20 18:02:53.293401143 -0700 +++ new/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2020-05-20 18:02:52.961394768 -0700 @@ -33,21 +33,12 @@ private static final int KB = 1024; private static int BUFFER_SIZE = 4 * KB; - static { - // Set a larger buffer size for Solaris - final String osName = System.getProperty("os.name"); - if (osName.equalsIgnoreCase("solaris")) { - BUFFER_SIZE = 32 * KB; - } - } - private Writer _writer; /** * Initializes a WriterOutputBuffer by creating an instance of a * BufferedWriter. The size of the buffer in this writer may have - * a significant impact on throughput. Solaris prefers a larger - * buffer, while Linux works better with a smaller one. + * a significant impact on throughput. */ public WriterOutputBuffer(Writer writer) { _writer = new BufferedWriter(writer, BUFFER_SIZE); --- old/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java 2020-05-20 18:02:58.681504598 -0700 +++ new/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java 2020-05-20 18:02:58.345498147 -0700 @@ -95,7 +95,7 @@ private static class Decoder extends CharsetDecoder { private static final String SJISName = getSJISName(); - private static final String EUCJPName = getEUCJPName(); + private static final String EUCJPName = "EUC_JP"; private DelegatableDecoder detectedDecoder = null; public Decoder(Charset cs) { @@ -223,24 +223,11 @@ * Returned Shift_JIS Charset name is OS dependent */ private static String getSJISName() { - if (OperatingSystem.isSolaris()) - return("PCK"); - else if (OperatingSystem.isWindows()) + if (OperatingSystem.isWindows()) return("windows-31J"); else return("Shift_JIS"); } - /** - * Returned EUC-JP Charset name is OS dependent - */ - - private static String getEUCJPName() { - if (OperatingSystem.isSolaris()) - return("x-eucjp-open"); - else - return("EUC_JP"); - } - } } --- old/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java 2020-05-20 18:02:59.697524107 -0700 +++ new/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java 2020-05-20 18:02:59.357517578 -0700 @@ -725,10 +725,10 @@ lib = expand(lib); int i = lib.indexOf("/$ISA/"); if (i != -1) { - // replace "/$ISA/" with "/amd64/" on Solaris AMD64. + // replace "/$ISA/" with "/" String prefix = lib.substring(0, i); String suffix = lib.substring(i + 5); - lib = prefix + "/amd64" + suffix; + lib = prefix + suffix; } if (DEBUG) { System.out.println(keyword + ": " + lib); --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java 2020-05-20 18:03:16.561847914 -0700 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java 2020-05-20 18:03:16.225841462 -0700 @@ -28,7 +28,6 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; @@ -93,9 +92,7 @@ access = null; // FIXME: find the platform specific PD class by reflection? - if (os.equals("solaris")) { - access = new SolarisAMD64JavaThreadPDAccess(); - } else if (os.equals("win32")) { + if (os.equals("win32")) { if (cpu.equals("amd64")) { access = new Win32AMD64JavaThreadPDAccess(); } else if (cpu.equals("aarch64")) { --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2020-05-20 18:03:17.573867346 -0700 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2020-05-20 18:03:17.241860971 -0700 @@ -28,14 +28,10 @@ system. */ public class PlatformInfo { - /* Returns "solaris" if on Solaris; "win32" if Windows; "linux" if - Linux. Used to determine location of dbx and import module, or - possible debugger agent on win32. */ + /* Returns "win32" if Windows; "linux" if Linux. */ public static String getOS() throws UnsupportedPlatformException { String os = System.getProperty("os.name"); - if (os.equals("SunOS")) { - return "solaris"; - } else if (os.equals("Linux")) { + if (os.equals("Linux")) { return "linux"; } else if (os.equals("FreeBSD")) { return "bsd"; --- old/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2020-05-20 18:03:36.322227327 -0700 +++ new/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2020-05-20 18:03:35.934219877 -0700 @@ -77,63 +77,7 @@ // true = get available swap in bytes // false = get total swap in bytes static jlong get_total_or_available_swap_space_size(JNIEnv* env, jboolean available) { -#ifdef __solaris__ - long total, avail; - int nswap, i, count; - swaptbl_t *stbl; - char *strtab; - - // First get the number of swap resource entries - if ((nswap = swapctl(SC_GETNSWP, NULL)) == -1) { - throw_internal_error(env, "swapctl failed to get nswap"); - return -1; - } - if (nswap == 0) { - return 0; - } - - // Allocate storage for resource entries - stbl = (swaptbl_t*) malloc(nswap * sizeof(swapent_t) + - sizeof(struct swaptable)); - if (stbl == NULL) { - JNU_ThrowOutOfMemoryError(env, 0); - return -1; - } - - // Allocate storage for the table - strtab = (char*) malloc((nswap + 1) * MAXPATHLEN); - if (strtab == NULL) { - free(stbl); - JNU_ThrowOutOfMemoryError(env, 0); - return -1; - } - - for (i = 0; i < (nswap + 1); i++) { - stbl->swt_ent[i].ste_path = strtab + (i * MAXPATHLEN); - } - stbl->swt_n = nswap + 1; - - // Get the entries - if ((count = swapctl(SC_LIST, stbl)) < 0) { - free(stbl); - free(strtab); - throw_internal_error(env, "swapctl failed to get swap list"); - return -1; - } - - // Sum the entries to get total and free swap - total = 0; - avail = 0; - for (i = 0; i < count; i++) { - total += stbl->swt_ent[i].ste_pages; - avail += stbl->swt_ent[i].ste_free; - } - - free(stbl); - free(strtab); - return available ? ((jlong)avail * page_size) : - ((jlong)total * page_size); -#elif defined(__linux__) +#if defined(__linux__) int ret; jlong total = 0, avail = 0; @@ -182,37 +126,7 @@ Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { -#ifdef __solaris__ - psinfo_t psinfo; - ssize_t result; - size_t remaining; - char* addr; - int fd; - - fd = open64("/proc/self/psinfo", O_RDONLY, 0); - if (fd < 0) { - throw_internal_error(env, "Unable to open /proc/self/psinfo"); - return -1; - } - - addr = (char *)&psinfo; - for (remaining = sizeof(psinfo_t); remaining > 0;) { - result = read(fd, addr, remaining); - if (result < 0) { - if (errno != EINTR) { - close(fd); - throw_internal_error(env, "Unable to read /proc/self/psinfo"); - return -1; - } - } else { - remaining -= result; - addr += result; - } - } - - close(fd); - return (jlong) psinfo.pr_size * 1024; -#elif defined(__APPLE__) +#if defined(__APPLE__) struct task_basic_info t_info; mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; --- old/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java 2020-05-20 18:03:38.442268035 -0700 +++ new/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java 2020-05-20 18:03:38.054260584 -0700 @@ -42,12 +42,6 @@ /* -- Miscellaneous SCTP utilities -- */ private static boolean IPv4MappedAddresses() { - if (true) { - /* FIXME - nonportable hack */ - /* Solaris supports IPv4Mapped Addresses with bindx */ - return true; - } /* else { //other OS/implementations */ - /* lksctp/linux requires Ipv4 addresses */ return false; } --- old/src/jdk.sctp/unix/native/libsctp/Sctp.h 2020-05-20 18:03:39.494288233 -0700 +++ new/src/jdk.sctp/unix/native/libsctp/Sctp.h 2020-05-20 18:03:39.114280937 -0700 @@ -26,48 +26,6 @@ #ifndef SUN_NIO_CH_SCTP_H #define SUN_NIO_CH_SCTP_H -#ifdef __solaris__ - -#define _XPG4_2 -#define __EXTENSIONS__ -#include -#include -#include "jni.h" - -/* Current Solaris headers don't comply with draft rfc */ -#ifndef SCTP_EOF -#define SCTP_EOF MSG_EOF -#endif - -#ifndef SCTP_UNORDERED -#define SCTP_UNORDERED MSG_UNORDERED -#endif - -/* The current version of the socket API extension shipped with Solaris does - * not define the following options that the Java API (optionally) supports */ -#ifndef SCTP_EXPLICIT_EOR -#define SCTP_EXPLICIT_EOR -1 -#endif -#ifndef SCTP_FRAGMENT_INTERLEAVE -#define SCTP_FRAGMENT_INTERLEAVE -1 -#endif -#ifndef SCTP_SET_PEER_PRIMARY_ADDR -#define SCTP_SET_PEER_PRIMARY_ADDR -1 -#endif - -/* Function types to support dynamic linking of socket API extension functions - * for SCTP. This is so that there is no linkage dependency during build or - * runtime for libsctp.*/ -typedef int sctp_getladdrs_func(int sock, sctp_assoc_t id, void **addrs); -typedef int sctp_freeladdrs_func(void* addrs); -typedef int sctp_getpaddrs_func(int sock, sctp_assoc_t id, void **addrs); -typedef int sctp_freepaddrs_func(void *addrs); -typedef int sctp_bindx_func(int sock, void *addrs, int addrcnt, int flags); -typedef int sctp_peeloff_func(int sock, sctp_assoc_t id); - - - -#else /* __linux__ */ #include #include #include @@ -320,8 +278,6 @@ typedef int sctp_peeloff_func(int sock, sctp_assoc_t id); -#endif /* __linux__ */ - extern sctp_getladdrs_func* nio_sctp_getladdrs; extern sctp_freeladdrs_func* nio_sctp_freeladdrs; extern sctp_getpaddrs_func* nio_sctp_getpaddrs; --- old/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c 2020-05-20 18:03:40.558308663 -0700 +++ new/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c 2020-05-20 18:03:40.174301290 -0700 @@ -331,10 +331,11 @@ break; case SCTP_ADDR_MADE_PRIM : event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_MADE_PRIM; -#ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */ break; +#ifdef __linux__ case SCTP_ADDR_CONFIRMED : event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_CONFIRMED; + break; #endif /* __linux__ */ } --- old/src/jdk.sctp/unix/native/libsctp/SctpNet.c 2020-05-20 18:03:41.630329248 -0700 +++ new/src/jdk.sctp/unix/native/libsctp/SctpNet.c 2020-05-20 18:03:41.242321797 -0700 @@ -371,11 +371,7 @@ int i, addrCount; jobjectArray isaa; -#ifdef __solaris__ - if ((addrCount = nio_sctp_getladdrs(fd, 0, (void **)&addr_buf)) == -1) { -#else /* __linux__ */ if ((addrCount = nio_sctp_getladdrs(fd, 0, (struct sockaddr **)&addr_buf)) == -1) { -#endif sctpHandleSocketError(env, errno); return NULL; } @@ -420,11 +416,7 @@ int i, addrCount; jobjectArray isaa; -#if defined(__solaris__) - if ((addrCount = nio_sctp_getpaddrs(fd, id, (void **)&addr_buf)) == -1) { -#else /* __linux__ */ if ((addrCount = nio_sctp_getpaddrs(fd, id, (struct sockaddr **)&addr_buf)) == -1) { -#endif sctpHandleSocketError(env, errno); return NULL; } --- old/src/jdk.security.auth/unix/native/libjaas/Unix.c 2020-05-20 18:03:43.842371720 -0700 +++ new/src/jdk.security.auth/unix/native/libjaas/Unix.c 2020-05-20 18:03:43.450364193 -0700 @@ -32,10 +32,6 @@ #include #include -/* For POSIX-compliant getpwuid_r on Solaris */ -#if defined(__solaris__) -#define _POSIX_PTHREAD_SEMANTICS -#endif #include /* --- old/src/java.desktop/solaris/data/fontconfig/fontconfig.properties 2020-05-20 18:08:13.719553558 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,516 +0,0 @@ -# -# -# Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Version - -version=1 - -# Component Font Mappings - -allfonts.chinese-gb2312=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-gbk=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-gb18030-0=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-gb18030-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-cns11643-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-cns11643-2=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-cns11643-3=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-big5=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.chinese-hkscs=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.dingbats=-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific -allfonts.japanese-x0212=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.korean=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.korean-johab=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -allfonts.symbol=-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol -allfonts.bengali=-misc-lohit bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.gujarati=-misc-lohit gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.hindi=-misc-lohit hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.kannada=-misc-lohit kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.malayalam=-misc-lohit malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.marathi=-misc-lohit marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.tamil=-misc-lohit tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.telugu=-misc-lohit telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1 -allfonts.dejavusans=-misc-dejavu sans-medium-r-normal--0-0-0-0-p-0-iso10646-1 - -serif.plain.arabic=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.cyrillic-iso8859-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.cyrillic-cp1251=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.cyrillic-koi8-r=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.greek=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.hebrew=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.plain.latin-1=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.latin-2=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.latin-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.latin-7=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.latin-9=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.plain.thai=-monotype-angsana new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 - -serif.bold.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.cyrillic-iso8859-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.cyrillic-cp1251=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.cyrillic-koi8-r=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.greek=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.hebrew=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.bold.latin-1=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.latin-2=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.latin-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.latin-7=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.latin-9=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bold.thai=-monotype-angsana new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 - -serif.italic.arabic=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.cyrillic-iso8859-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.cyrillic-cp1251=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.cyrillic-koi8-r=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.greek=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.hebrew=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.italic.latin-1=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.latin-2=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.latin-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.latin-7=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.latin-9=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.italic.thai=-monotype-angsana new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 - -serif.bolditalic.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.cyrillic-iso8859-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.cyrillic-cp1251=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.cyrillic-koi8-r=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.greek=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.hebrew=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -serif.bolditalic.latin-1=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.latin-2=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.latin-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.latin-7=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.latin-9=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -serif.bolditalic.thai=-monotype-angsana new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 - -sansserif.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 - -sansserif.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 - -sansserif.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 - -sansserif.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -sansserif.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 - -monospaced.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 - -monospaced.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 - -monospaced.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 - -monospaced.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -monospaced.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -monospaced.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 - -dialog.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 - -dialog.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 - -dialog.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 - -dialog.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialog.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 - -dialoginput.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 - -dialoginput.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 - -dialoginput.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1 - -dialoginput.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1 -dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 -dialoginput.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1 - -# Search Sequences - -sequence.allfonts=latin-1 - -sequence.allfonts.Big5=latin-1,chinese-big5 - -sequence.allfonts.Big5-HKSCS-2001=latin-1,chinese-big5,chinese-hkscs - -sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1 - -sequence.allfonts.GB2312=latin-1,chinese-gb2312 - -sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212 - -sequence.allfonts.EUC-KR=latin-1,korean - -sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3 - -sequence.allfonts.GBK=latin-1,chinese-gbk - -sequence.allfonts.GB18030=latin-1,chinese-gb18030-0,chinese-gb18030-1 - -sequence.allfonts.ISO-8859-2=latin-2,latin-1 - -sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1 - -sequence.allfonts.ISO-8859-6=arabic,latin-1 - -sequence.allfonts.ISO-8859-7=latin-1,greek - -sequence.allfonts.ISO-8859-8=latin-1,hebrew - -sequence.allfonts.ISO-8859-9=latin-5,latin-1 - -sequence.allfonts.ISO-8859-13=latin-7,latin-1 - -sequence.allfonts.ISO-8859-15=latin-9 - -sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1 - -sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212 - -sequence.allfonts.TIS-620=latin-1,thai - -sequence.allfonts.UTF-8=latin-1 -sequence.allfonts.UTF-8.en=latin-1 -sequence.allfonts.UTF-8.hi=latin-1,hindi -sequence.allfonts.UTF-8.be=latin-1,bengali -sequence.allfonts.UTF-8.te=latin-1,telugu -sequence.allfonts.UTF-8.mr=latin-1,marathi -sequence.allfonts.UTF-8.ta=latin-1,tamil -sequence.allfonts.UTF-8.gu=latin-1,gujarati -sequence.allfonts.UTF-8.kn=latin-1,kannada -sequence.allfonts.UTF-8.ma=latin-1,malayalam - -sequence.allfonts.UTF-8.ko=latin-1,korean-johab,japanese-x0201,japanese-x0208,japanese-x0212 - -sequence.allfonts.UTF-8.th=latin-1,thai - -sequence.allfonts.UTF-8.zh.CN=latin-1,chinese-gb18030-0,chinese-gb18030-1,chinese-big5,chinese-hkscs - -sequence.allfonts.UTF-8.zh.HK=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1 - -sequence.allfonts.UTF-8.zh.TW=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1 - -# the fallback sequence omits the following character subsets: -# - chinese: all same file : just use chinese-gb18030-0 -# - japanese-x0208: same files as japanese-x0201 -# - japanese-x0212: same files as japanese-x0201 -# - korean: same file as korean-johab -sequence.fallback=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\ - arabic,hebrew,thai,\ - chinese-gb18030-0,\ - japanese-x0201,korean-johab,\ - hindi,bengali,telugu,marathi,tamil,gujarati,kannada,malayalam,\ - dejavusans,dingbats,symbol - -# Font File Names - -filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf -filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf -filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbd.ttf -filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf -filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf -filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf -filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbd.ttf -filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf -filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf -filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf -filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbd.ttf -filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf - -filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf -filename.-monotype-angsana_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsai.ttf -filename.-monotype-angsana_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsab.ttf -filename.-monotype-angsana_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsaz.ttf -filename.-monotype-browallia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browa.ttf -filename.-monotype-browallia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browai.ttf -filename.-monotype-browallia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browab.ttf -filename.-monotype-browallia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browaz.ttf -filename.-monotype-cordia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordia.ttf -filename.-monotype-cordia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiai.ttf -filename.-monotype-cordia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiab.ttf -filename.-monotype-cordia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiaz.ttf - -filename.-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipag.otf -filename.-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipam.otf -filename.-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/hanyang/h2gtrm.ttf -filename.-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/arphic/uming.ttf -filename.-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol=/usr/share/fonts/TrueType/core/symbol.ttf -filename.-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific=/usr/share/fonts/TrueType/core/wingdings.ttf -filename.-misc-lohit_bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Bengali.ttf -filename.-misc-lohit_gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Gujarati.ttf -filename.-misc-lohit_hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Hindi.ttf -filename.-misc-lohit_kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Kannada.ttf -filename.-misc-lohit_malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Malayalam.ttf -filename.-misc-lohit_marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Marathi.ttf -filename.-misc-lohit_tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Tamil.ttf -filename.-misc-lohit_telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Telugu.ttf -filename.-misc-dejavu_sans-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/dejavu/DejaVuSans.ttf - -# AWT X11 font paths -awtfontpath.latin-1=/usr/share/fonts/TrueType/core -awtfontpath.latin-2=/usr/share/fonts/TrueType/core -awtfontpath.latin-5=/usr/share/fonts/TrueType/core -awtfontpath.latin-7=/usr/share/fonts/TrueType/core -awtfontpath.latin-9=/usr/share/fonts/TrueType/core -awtfontpath.hebrew=/usr/share/fonts/TrueType/core -awtfontpath.arabic=/usr/share/fonts/TrueType/core -awtfontpath.thai=/usr/share/fonts/TrueType/core -awtfontpath.greek=/usr/share/fonts/TrueType/core -awtfontpath.cyrillic-iso8859-5=/usr/share/fonts/TrueType/core -awtfontpath.cyrillic-cp1251=/usr/share/fonts/TrueType/core -awtfontpath.cyrillic-koi8-r=/usr/share/fonts/TrueType/core -awtfontpath.korean=/usr/share/fonts/TrueType/hanyang -awtfontpath.korean-johab=/usr/share/fonts/TrueType/hanyang -awtfontpath.japanese-x0201=/usr/share/fonts/TrueType/ipafont -awtfontpath.japanese-x0208=/usr/share/fonts/TrueType/ipafont -awtfontpath.japanese-x0212=/usr/share/fonts/TrueType/ipafont -awtfontpath.chinese-gbk=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-cns11643-1=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-cns11643-2=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-cns11643-3=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-big5=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-gb2312=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-gb18030-0=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-gb18030-1=/usr/share/fonts/TrueType/arphic -awtfontpath.chinese-hkscs=/usr/share/fonts/TrueType/arphic -awtfontpath.bengali=/usr/share/fonts/TrueType/lohit -awtfontpath.gujarati=/usr/share/fonts/TrueType/lohit -awtfontpath.hindi=/usr/share/fonts/TrueType/lohit -awtfontpath.kannada=/usr/share/fonts/TrueType/lohit -awtfontpath.malayalam=/usr/share/fonts/TrueType/lohit -awtfontpath.marathi=/usr/share/fonts/TrueType/lohit -awtfontpath.tamil=/usr/share/fonts/TrueType/lohit -awtfontpath.telugu=/usr/share/fonts/TrueType/lohit -awtfontpath.dejavusans=/usr/share/fonts/TrueType/dejavu - -# Appended Font Path - --- old/make/hotspot/lib/CompileDtraceLibraries.gmk 2020-05-20 18:08:16.611609088 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,52 +0,0 @@ -# -# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -ifeq ($(call check-jvm-feature, dtrace), true) - ifeq ($(call isTargetOs, solaris), true) - JNI_INCLUDE_FLAGS := \ - -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ - -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \ - # - - ############################################################################ - # Build the stand-alone dtrace libraries. - - # Note that libjvm_db.c has tests for COMPILER2, but this was never set by - # the old build. - LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db - $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \ - NAME := jvm_db, \ - OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ - SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \ - CFLAGS := -I$(DTRACE_GENSRC_DIR) $(JNI_INCLUDE_FLAGS) -m64 -G -fPIC -fvisibility=hidden, \ - LDFLAGS := -m64 $(SHARED_LIBRARY_FLAGS), \ - OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \ - )) - - # Skip libjvm_db, as it doesn't currently build - # TARGETS += $(BUILD_LIBJVM_DB) - - endif -endif --- old/make/hotspot/lib/JvmDtraceObjects.gmk 2020-05-20 18:08:17.355623374 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,124 +0,0 @@ -# -# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -ifeq ($(call check-jvm-feature, dtrace), true) - ifeq ($(call isTargetOs, solaris), true) - - ############################################################################ - # Integrate with libjvm. Here we generate two object files which are - # linked with libjvm.so. This step is complicated from a dependency - # perspective. We add these two files to the linking of libjvm using - # EXTRA_OBJECT_FILES, but they need to be created outside the call to - # SetupNativeCompilation. Also, one of the files is dependent on compiled - # object files from the libjvm compilation, so this generation must happen - # as a part of the libjvm compilation. - - DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o - DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o - - # Skip DTRACE_JHELPER_OBJ as that won't currently build - # DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ) - DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) - - ############################################################################ - # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of - # object files from the compilation. - - # Concatenate all *.d files into a single file - DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \ - hotspot_jni.d \ - hotspot.d \ - hs_private.d \ - ) - - # *.d in the objs dir is used for generated make dependency files, so use - # *.dt for dtrace files to avoid clashes. - $(JVM_OUTPUTDIR)/objs/dtrace.dt: $(DTRACE_SOURCE_FILES) - $(call LogInfo, Generating $(@F)) - $(call MakeDir, $(@D)) - $(CAT) $^ > $@ - - DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \ - ciEnv.o \ - classLoadingService.o \ - compileBroker.o \ - gcVMOperations.o \ - instanceKlass.o \ - java.o \ - javaThread.o \ - jni.o \ - jvm.o \ - memoryManager.o \ - nmethod.o \ - objectMonitor.o \ - runtimeService.o \ - sharedRuntime.o \ - synchronizer.o \ - threads.o \ - unsafe.o \ - vmThread.o \ - ) - - ifeq ($(call check-jvm-feature, parallelgc), true) - DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \ - psVMOperations.o \ - ) - endif - - DTRACE_FLAGS := -64 -G - DTRACE_CPP_FLAGS := -D_LP64 -x c - - # Make sure we run our selected compiler for preprocessing instead of letting - # the dtrace tool pick it on it's own. - $(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.dt $(DTRACE_INSTRUMENTED_OBJS) - $(call LogInfo, Generating $(@F) from $( $(DTRACE_SUPPORT_DIR)/$(@F).dt)) - $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \ - -s $(DTRACE_SUPPORT_DIR)/$(@F).dt $(sort $(DTRACE_INSTRUMENTED_OBJS))) - - ############################################################################ - # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so. - - JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d - - # jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step. - DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles - JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h - - # Make sure we run our selected compiler for preprocessing instead of letting - # the dtrace tool pick it on it's own. - $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H) - $(call LogInfo, Running dtrace for $( $(DTRACE_SUPPORT_DIR)/$(@F).dt)) - $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \ - -s $(DTRACE_SUPPORT_DIR)/$(@F).dt) - - endif -endif --- old/make/hotspot/src/native/dtrace/generateJvmOffsets.cpp 2020-05-20 18:08:18.051636738 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,316 +0,0 @@ -/* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/* - * This is to provide sanity check in jhelper.d which compares SCCS - * versions of generateJvmOffsets.cpp used to create and extract - * contents of __JvmOffsets[] table. - * The __JvmOffsets[] table is located in generated JvmOffsets.cpp. - * - * GENOFFS_SCCS_VER 34 - */ - -#include -#include - -/* A workaround for private and protected fields */ -#define private public -#define protected public - -#include -#include "gc/shared/collectedHeap.hpp" -#include "memory/heap.hpp" -#include "oops/compressedOops.hpp" -#include "runtime/vmStructs.hpp" - -typedef enum GEN_variant { - GEN_OFFSET = 0, - GEN_INDEX = 1, - GEN_TABLE = 2 -} GEN_variant; - -#ifdef COMPILER1 -#ifdef ASSERT - -/* - * To avoid the most part of potential link errors - * we link this program with -z nodefs . - * - * But for 'debug1' and 'fastdebug1' we still have to provide - * a particular workaround for the following symbols below. - * It will be good to find out a generic way in the future. - */ - -#pragma weak tty - -#if defined(i386) || defined(__i386) || defined(__amd64) -#pragma weak noreg -#endif /* i386 */ - -LIR_Opr LIR_OprFact::illegalOpr = (LIR_Opr) 0; - -address StubRoutines::_call_stub_return_address = NULL; - -StubQueue* AbstractInterpreter::_code = NULL; - -#endif /* ASSERT */ -#endif /* COMPILER1 */ - -#define GEN_OFFS_NAME(Type,Name,OutputType) \ - switch(gen_variant) { \ - case GEN_OFFSET: \ - printf("#define OFFSET_%-33s %ld\n", \ - #OutputType #Name, offset_of(Type, Name)); \ - break; \ - case GEN_INDEX: \ - printf("#define IDX_OFFSET_%-33s %d\n", \ - #OutputType #Name, index++); \ - break; \ - case GEN_TABLE: \ - printf("\tOFFSET_%s,\n", #OutputType #Name); \ - break; \ - } - -#define GEN_OFFS(Type,Name) \ - GEN_OFFS_NAME(Type,Name,Type) - -#define GEN_SIZE(Type) \ - switch(gen_variant) { \ - case GEN_OFFSET: \ - printf("#define SIZE_%-35s %ld\n", \ - #Type, sizeof(Type)); \ - break; \ - case GEN_INDEX: \ - printf("#define IDX_SIZE_%-35s %d\n", \ - #Type, index++); \ - break; \ - case GEN_TABLE: \ - printf("\tSIZE_%s,\n", #Type); \ - break; \ - } - -#define GEN_VALUE(String,Value) \ - switch(gen_variant) { \ - case GEN_OFFSET: \ - printf("#define %-40s %d\n", #String, Value); \ - break; \ - case GEN_INDEX: \ - printf("#define IDX_%-40s %d\n", #String, index++); \ - break; \ - case GEN_TABLE: \ - printf("\t" #String ",\n"); \ - break; \ - } - -void gen_prologue(GEN_variant gen_variant) { - const char *suffix = "Undefined-Suffix"; - - switch(gen_variant) { - case GEN_OFFSET: suffix = ".h"; break; - case GEN_INDEX: suffix = "Index.h"; break; - case GEN_TABLE: suffix = ".cpp"; break; - } - - printf("/*\n"); - printf(" * JvmOffsets%s !!!DO NOT EDIT!!! \n", suffix); - printf(" * The generateJvmOffsets program generates this file!\n"); - printf(" */\n\n"); - switch(gen_variant) { - - case GEN_OFFSET: - case GEN_INDEX: - break; - - case GEN_TABLE: - printf("#include \"JvmOffsets.h\"\n"); - printf("\n"); - printf("int __JvmOffsets[] = {\n"); - break; - } -} - -void gen_epilogue(GEN_variant gen_variant) { - if (gen_variant != GEN_TABLE) { - return; - } - printf("};\n\n"); - return; -} - -int generateJvmOffsets(GEN_variant gen_variant) { - int index = 0; /* It is used to generate JvmOffsetsIndex.h */ - int pointer_size = sizeof(void *); - int data_model = (pointer_size == 4) ? PR_MODEL_ILP32 : PR_MODEL_LP64; - - gen_prologue(gen_variant); - - GEN_VALUE(DATA_MODEL, data_model); - GEN_VALUE(POINTER_SIZE, pointer_size); -#if COMPILER1_AND_COMPILER2 - GEN_VALUE(COMPILER, 3); -#elif COMPILER1 - GEN_VALUE(COMPILER, 1); -#elif COMPILER2 - GEN_VALUE(COMPILER, 2); -#else - GEN_VALUE(COMPILER, 0); -#endif // COMPILER1 && COMPILER2 - printf("\n"); - - GEN_OFFS(CollectedHeap, _reserved); - GEN_OFFS(MemRegion, _start); - GEN_OFFS(MemRegion, _word_size); - GEN_SIZE(HeapWord); - printf("\n"); - - GEN_OFFS(VMStructEntry, typeName); - GEN_OFFS(VMStructEntry, fieldName); - GEN_OFFS(VMStructEntry, address); - GEN_SIZE(VMStructEntry); - printf("\n"); - - GEN_VALUE(MAX_METHOD_CODE_SIZE, max_method_code_size); -#if defined(i386) || defined(__i386) || defined(__amd64) - GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size); - GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size); - GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, -7 * pointer_size); -#endif - - GEN_OFFS(Klass, _name); - GEN_OFFS(ConstantPool, _pool_holder); - printf("\n"); - - GEN_VALUE(OFFSET_HeapBlockHeader_used, (int) offset_of(HeapBlock::Header, _used)); - GEN_OFFS(oopDesc, _metadata); - printf("\n"); - - GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE); - GEN_VALUE(ConstMethod_has_linenumber_table, ConstMethod::_has_linenumber_table); - GEN_OFFS(AccessFlags, _flags); - GEN_OFFS(Symbol, _length); - GEN_OFFS(Symbol, _body); - printf("\n"); - - GEN_OFFS(Method, _constMethod); - GEN_OFFS(Method, _access_flags); - printf("\n"); - - GEN_OFFS(ConstMethod, _constants); - GEN_OFFS(ConstMethod, _flags); - GEN_OFFS(ConstMethod, _code_size); - GEN_OFFS(ConstMethod, _name_index); - GEN_OFFS(ConstMethod, _signature_index); - printf("\n"); - - GEN_OFFS(CodeHeap, _memory); - GEN_OFFS(CodeHeap, _segmap); - GEN_OFFS(CodeHeap, _log2_segment_size); - printf("\n"); - - GEN_OFFS(VirtualSpace, _low_boundary); - GEN_OFFS(VirtualSpace, _high_boundary); - GEN_OFFS(VirtualSpace, _low); - GEN_OFFS(VirtualSpace, _high); - printf("\n"); - - /* We need to use different names here because of the template parameter */ - GEN_OFFS_NAME(GrowableArray, _data, GrowableArray_CodeHeap); - GEN_OFFS_NAME(GrowableArray, _len, GrowableArray_CodeHeap); - printf("\n"); - - GEN_OFFS(CodeBlob, _name); - GEN_OFFS(CodeBlob, _header_size); - GEN_OFFS(CodeBlob, _content_begin); - GEN_OFFS(CodeBlob, _code_begin); - GEN_OFFS(CodeBlob, _code_end); - GEN_OFFS(CodeBlob, _data_offset); - GEN_OFFS(CodeBlob, _frame_size); - printf("\n"); - - GEN_OFFS(nmethod, _method); - GEN_OFFS(nmethod, _dependencies_offset); - GEN_OFFS(nmethod, _metadata_offset); - GEN_OFFS(nmethod, _scopes_data_begin); - GEN_OFFS(nmethod, _scopes_pcs_offset); - GEN_OFFS(nmethod, _handler_table_offset); - GEN_OFFS(nmethod, _deopt_handler_begin); - GEN_OFFS(nmethod, _orig_pc_offset); - - GEN_OFFS(PcDesc, _pc_offset); - GEN_OFFS(PcDesc, _scope_decode_offset); - - printf("\n"); - - GEN_OFFS(NarrowPtrStruct, _base); - GEN_OFFS(NarrowPtrStruct, _shift); - printf("\n"); - - GEN_VALUE(SIZE_HeapBlockHeader, (int) sizeof(HeapBlock::Header)); - GEN_SIZE(oopDesc); - GEN_SIZE(ConstantPool); - printf("\n"); - - GEN_SIZE(PcDesc); - GEN_SIZE(Method); - GEN_SIZE(ConstMethod); - GEN_SIZE(nmethod); - GEN_SIZE(CodeBlob); - GEN_SIZE(BufferBlob); - GEN_SIZE(SingletonBlob); - GEN_SIZE(RuntimeStub); - GEN_SIZE(SafepointBlob); - - gen_epilogue(gen_variant); - printf("\n"); - - fflush(stdout); - return 0; -} - -const char *HELP = - "HELP: generateJvmOffsets {-header | -index | -table} \n"; - -int main(int argc, const char *argv[]) { - GEN_variant gen_var; - - if (argc != 2) { - printf("%s", HELP); - return 1; - } - - if (0 == strcmp(argv[1], "-header")) { - gen_var = GEN_OFFSET; - } - else if (0 == strcmp(argv[1], "-index")) { - gen_var = GEN_INDEX; - } - else if (0 == strcmp(argv[1], "-table")) { - gen_var = GEN_TABLE; - } - else { - printf("%s", HELP); - return 1; - } - return generateJvmOffsets(gen_var); -} --- old/make/modules/jdk.crypto.cryptoki/Copy.gmk 2020-05-20 18:08:20.931692037 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -include CopyCommon.gmk - -################################################################################ - -ifeq ($(call isTargetOs, solaris), true) - - SUNPKCS11_CFG_SRC := \ - $(TOPDIR)/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg - SUNPKCS11_CFG_DST := $(CONF_DST_DIR)/security/sunpkcs11-solaris.cfg - - $(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC) - $(call install-file) - - SECURITY_PKCS11_CONF_FILES += $(SUNPKCS11_CFG_DST) - - TARGETS := $(SUNPKCS11_CFG_DST) - -endif - -################################################################################ --- old/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java 2020-05-20 18:10:11.253810182 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.nio.channels.spi.AsynchronousChannelProvider; - -/** - * Creates this platform's default AsynchronousChannelProvider - */ - -public class DefaultAsynchronousChannelProvider { - - /** - * Prevent instantiation. - */ - private DefaultAsynchronousChannelProvider() { } - - /** - * Returns the default AsynchronousChannelProvider. - */ - public static AsynchronousChannelProvider create() { - return new SolarisAsynchronousChannelProvider(); - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java 2020-05-20 18:10:11.945823468 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -/** - * Creates this platform's default SelectorProvider - */ - -public class DefaultSelectorProvider { - private static final SelectorProviderImpl INSTANCE = new DevPollSelectorProvider(); - - /** - * Prevent instantiation. - */ - private DefaultSelectorProvider() { } - - /** - * Returns the default SelectorProvider implementation. - */ - public static SelectorProviderImpl get() { - return INSTANCE; - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java 2020-05-20 18:10:12.657837138 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.io.IOException; - -/** - * Manipulates a native array of pollfd structs on Solaris: - * - * typedef struct pollfd { - * int fd; - * short events; - * short revents; - * } pollfd_t; - * - * @author Mike McCloskey - * @since 1.4 - */ - -class DevPollArrayWrapper { - - // special event to remove a file descriptor from the driver - static final short POLLREMOVE = 0x0800; - - // struct pollfd constants - static final short SIZE_POLLFD = 8; - static final short FD_OFFSET = 0; - static final short EVENT_OFFSET = 4; - static final short REVENT_OFFSET = 6; - - // maximum number of pollfd structure to poll or update at a time - // dpwrite/ioctl(DP_POLL) allows up to file descriptor limit minus 1 - static final int NUM_POLLFDS = Math.min(IOUtil.fdLimit()-1, 1024); - - // The pollfd array for results from devpoll driver - private final AllocatedNativeObject pollArray; - - // Base address of the native pollArray - private final long pollArrayAddress; - - // The fd of the devpoll driver - private int wfd; - - DevPollArrayWrapper() throws IOException { - this.wfd = init(); - - int allocationSize = NUM_POLLFDS * SIZE_POLLFD; - this.pollArray = new AllocatedNativeObject(allocationSize, true); - this.pollArrayAddress = pollArray.address(); - } - - void close() throws IOException { - FileDispatcherImpl.closeIntFD(wfd); - pollArray.free(); - } - - void register(int fd, int ops) throws IOException { - register(wfd, fd, ops); - } - - void registerMultiple(int numfds) throws IOException { - registerMultiple(wfd, pollArrayAddress, numfds); - } - - int poll(long timeout) throws IOException { - return poll0(pollArrayAddress, NUM_POLLFDS, timeout, wfd); - } - - int getDescriptor(int i) { - int offset = SIZE_POLLFD * i + FD_OFFSET; - return pollArray.getInt(offset); - } - - short getEventOps(int i) { - int offset = SIZE_POLLFD * i + EVENT_OFFSET; - return pollArray.getShort(offset); - } - - short getReventOps(int i) { - int offset = SIZE_POLLFD * i + REVENT_OFFSET; - return pollArray.getShort(offset); - } - - /** - * Updates the pollfd structure at the given index - */ - void putPollFD(int index, int fd, short event) { - int structIndex = SIZE_POLLFD * index; - pollArray.putInt(structIndex + FD_OFFSET, fd); - pollArray.putShort(structIndex + EVENT_OFFSET, event); - pollArray.putShort(structIndex + REVENT_OFFSET, (short)0); - } - - private native int init() throws IOException; - private native void register(int wfd, int fd, int mask) throws IOException; - private native void registerMultiple(int wfd, long address, int len) - throws IOException; - private native int poll0(long pollAddress, int numfds, long timeout, int wfd) - throws IOException; - - static { - IOUtil.load(); - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java 2020-05-20 18:10:13.409851575 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.io.IOException; -import java.nio.channels.ClosedSelectorException; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.spi.SelectorProvider; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; - -import static sun.nio.ch.DevPollArrayWrapper.NUM_POLLFDS; -import static sun.nio.ch.DevPollArrayWrapper.POLLREMOVE; - -/** - * Solaris /dev/poll based Selector implementation - */ - -class DevPollSelectorImpl - extends SelectorImpl -{ - // provides access to /dev/poll driver - private final DevPollArrayWrapper pollWrapper; - - // file descriptors used for interrupt - private final int fd0; - private final int fd1; - - // maps file descriptor to selection key, synchronize on selector - private final Map fdToKey = new HashMap<>(); - - // pending new registrations/updates, queued by setEventOps - private final Object updateLock = new Object(); - private final Deque updateKeys = new ArrayDeque<>(); - - // interrupt triggering and clearing - private final Object interruptLock = new Object(); - private boolean interruptTriggered; - - DevPollSelectorImpl(SelectorProvider sp) throws IOException { - super(sp); - this.pollWrapper = new DevPollArrayWrapper(); - try { - long fds = IOUtil.makePipe(false); - this.fd0 = (int) (fds >>> 32); - this.fd1 = (int) fds; - } catch (IOException ioe) { - pollWrapper.close(); - throw ioe; - } - - // register one end of the socket pair for wakeups - pollWrapper.register(fd0, Net.POLLIN); - } - - private void ensureOpen() { - if (!isOpen()) - throw new ClosedSelectorException(); - } - - @Override - protected int doSelect(Consumer action, long timeout) - throws IOException - { - assert Thread.holdsLock(this); - - long to = timeout; - boolean blocking = (to != 0); - boolean timedPoll = (to > 0); - - int numEntries; - processUpdateQueue(); - processDeregisterQueue(); - try { - begin(blocking); - - do { - long startTime = timedPoll ? System.nanoTime() : 0; - numEntries = pollWrapper.poll(to); - if (numEntries == IOStatus.INTERRUPTED && timedPoll) { - // timed poll interrupted so need to adjust timeout - long adjust = System.nanoTime() - startTime; - to -= TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS); - if (to <= 0) { - // timeout expired so no retry - numEntries = 0; - } - } - } while (numEntries == IOStatus.INTERRUPTED); - assert IOStatus.check(numEntries); - - } finally { - end(blocking); - } - processDeregisterQueue(); - return processEvents(numEntries, action); - } - - /** - * Process changes to the interest ops. - */ - private void processUpdateQueue() throws IOException { - assert Thread.holdsLock(this); - - synchronized (updateLock) { - SelectionKeyImpl ski; - - // Translate the queued updates to changes to the set of monitored - // file descriptors. The changes are written to the /dev/poll driver - // in bulk. - int index = 0; - while ((ski = updateKeys.pollFirst()) != null) { - if (ski.isValid()) { - int fd = ski.getFDVal(); - // add to fdToKey if needed - SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski); - assert (previous == null) || (previous == ski); - - int newEvents = ski.translateInterestOps(); - int registeredEvents = ski.registeredEvents(); - if (newEvents != registeredEvents) { - if (registeredEvents != 0) - pollWrapper.putPollFD(index++, fd, POLLREMOVE); - if (newEvents != 0) - pollWrapper.putPollFD(index++, fd, (short)newEvents); - ski.registeredEvents(newEvents); - - // write to /dev/poll - if (index > (NUM_POLLFDS-2)) { - pollWrapper.registerMultiple(index); - index = 0; - } - } - } - } - - // write any remaining changes - if (index > 0) - pollWrapper.registerMultiple(index); - } - } - - /** - * Process the polled events. - * If the interrupt fd has been selected, drain it and clear the interrupt. - */ - private int processEvents(int numEntries, Consumer action) - throws IOException - { - assert Thread.holdsLock(this); - - boolean interrupted = false; - int numKeysUpdated = 0; - for (int i=0; i fdToKey = new HashMap<>(); - - // the last update operation, incremented by processUpdateQueue - private int lastUpdate; - - // pending new registrations/updates, queued by setEventOps and - // updateSelectedKeys - private final Object updateLock = new Object(); - private final Deque updateKeys = new ArrayDeque<>(); - - // interrupt triggering and clearing - private final Object interruptLock = new Object(); - private boolean interruptTriggered; - - EventPortSelectorImpl(SelectorProvider sp) throws IOException { - super(sp); - - this.pfd = port_create(); - - int allocationSize = MAX_EVENTS * SIZEOF_PORT_EVENT; - this.pollArray = new AllocatedNativeObject(allocationSize, false); - this.pollArrayAddress = pollArray.address(); - } - - private void ensureOpen() { - if (!isOpen()) - throw new ClosedSelectorException(); - } - - @Override - protected int doSelect(Consumer action, long timeout) - throws IOException - { - assert Thread.holdsLock(this); - - long to = timeout; - boolean blocking = (to != 0); - boolean timedPoll = (to > 0); - - int numEvents; - processUpdateQueue(); - processDeregisterQueue(); - try { - begin(blocking); - - do { - long startTime = timedPoll ? System.nanoTime() : 0; - numEvents = port_getn(pfd, pollArrayAddress, MAX_EVENTS, to); - if (numEvents == IOStatus.INTERRUPTED && timedPoll) { - // timed poll interrupted so need to adjust timeout - long adjust = System.nanoTime() - startTime; - to -= TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS); - if (to <= 0) { - // timeout also expired so no retry - numEvents = 0; - } - } - } while (numEvents == IOStatus.INTERRUPTED); - assert IOStatus.check(numEvents); - - } finally { - end(blocking); - } - processDeregisterQueue(); - return processPortEvents(numEvents, action); - } - - /** - * Process new registrations and changes to the interest ops. - */ - private void processUpdateQueue() throws IOException { - assert Thread.holdsLock(this); - - // bump lastUpdate to ensure that the interest ops are changed at most - // once per bulk update - lastUpdate++; - - synchronized (updateLock) { - SelectionKeyImpl ski; - while ((ski = updateKeys.pollFirst()) != null) { - if (ski.isValid()) { - int fd = ski.getFDVal(); - // add to fdToKey if needed - SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski); - assert (previous == null) || (previous == ski); - - int newEvents = ski.translateInterestOps(); - if (newEvents != ski.registeredEvents()) { - if (newEvents == 0) { - port_dissociate(pfd, PORT_SOURCE_FD, fd); - } else { - port_associate(pfd, PORT_SOURCE_FD, fd, newEvents); - } - ski.registeredEvents(newEvents); - } - } - } - } - } - - /** - * Process the polled events and re-queue the selected keys so the file - * descriptors are re-associated at the next select operation. - */ - private int processPortEvents(int numEvents, Consumer action) - throws IOException - { - assert Thread.holdsLock(this); - - int numKeysUpdated = 0; - boolean interrupted = false; - - // Process the polled events while holding the update lock. This allows - // keys to be queued for ready file descriptors so they can be - // re-associated at the next select. The selected-key can be updated - // in this pass. - synchronized (updateLock) { - for (int i = 0; i < numEvents; i++) { - short source = getSource(i); - if (source == PORT_SOURCE_FD) { - int fd = getDescriptor(i); - SelectionKeyImpl ski = fdToKey.get(fd); - if (ski != null) { - ski.registeredEvents(0); - updateKeys.addLast(ski); - - // update selected-key set if no action specified - if (action == null) { - int rOps = getEventOps(i); - numKeysUpdated += processReadyEvents(rOps, ski, null); - } - - } - } else if (source == PORT_SOURCE_USER) { - interrupted = true; - } else { - assert false; - } - } - } - - // if an action specified then iterate over the polled events again so - // that the action is performed without holding the update lock. - if (action != null) { - for (int i = 0; i < numEvents; i++) { - short source = getSource(i); - if (source == PORT_SOURCE_FD) { - int fd = getDescriptor(i); - SelectionKeyImpl ski = fdToKey.get(fd); - if (ski != null) { - int rOps = getEventOps(i); - numKeysUpdated += processReadyEvents(rOps, ski, action); - } - } - } - } - - if (interrupted) { - clearInterrupt(); - } - return numKeysUpdated; - } - - @Override - protected void implClose() throws IOException { - assert !isOpen(); - assert Thread.holdsLock(this); - - // prevent further wakeup - synchronized (interruptLock) { - interruptTriggered = true; - } - - port_close(pfd); - pollArray.free(); - } - - @Override - protected void implDereg(SelectionKeyImpl ski) throws IOException { - assert !ski.isValid(); - assert Thread.holdsLock(this); - - int fd = ski.getFDVal(); - if (fdToKey.remove(fd) != null) { - if (ski.registeredEvents() != 0) { - port_dissociate(pfd, PORT_SOURCE_FD, fd); - ski.registeredEvents(0); - } - } else { - assert ski.registeredEvents() == 0; - } - } - - @Override - public void setEventOps(SelectionKeyImpl ski) { - ensureOpen(); - synchronized (updateLock) { - updateKeys.addLast(ski); - } - } - - @Override - public Selector wakeup() { - synchronized (interruptLock) { - if (!interruptTriggered) { - try { - port_send(pfd, 0); - } catch (IOException ioe) { - throw new InternalError(ioe); - } - interruptTriggered = true; - } - } - return this; - } - - private void clearInterrupt() throws IOException { - synchronized (interruptLock) { - interruptTriggered = false; - } - } - - private short getSource(int i) { - int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_SOURCE; - return pollArray.getShort(offset); - } - - private int getEventOps(int i) { - int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_EVENTS; - return pollArray.getInt(offset); - } - - private int getDescriptor(int i) { - //assert Unsafe.getUnsafe().addressSize() == 8; - int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_OBJECT; - return (int) pollArray.getLong(offset); - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorProvider.java 2020-05-20 18:10:15.545892585 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.io.IOException; -import java.nio.channels.*; -import java.nio.channels.spi.*; - -public class EventPortSelectorProvider - extends SelectorProviderImpl -{ - public AbstractSelector openSelector() throws IOException { - return new EventPortSelectorImpl(this); - } - - public Channel inheritedChannel() throws IOException { - return InheritedChannel.getChannel(); - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java 2020-05-20 18:10:16.241905948 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.nio.channels.*; -import java.nio.channels.spi.AsynchronousChannelProvider; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadFactory; -import java.io.IOException; - -public class SolarisAsynchronousChannelProvider - extends AsynchronousChannelProvider -{ - private static volatile SolarisEventPort defaultEventPort; - - private SolarisEventPort defaultEventPort() throws IOException { - if (defaultEventPort == null) { - synchronized (SolarisAsynchronousChannelProvider.class) { - if (defaultEventPort == null) { - defaultEventPort = - new SolarisEventPort(this, ThreadPool.getDefault()).start(); - } - } - } - return defaultEventPort; - } - - public SolarisAsynchronousChannelProvider() { - } - - @Override - public AsynchronousChannelGroup openAsynchronousChannelGroup(int nThreads, ThreadFactory factory) - throws IOException - { - return new SolarisEventPort(this, ThreadPool.create(nThreads, factory)).start(); - } - - @Override - public AsynchronousChannelGroup openAsynchronousChannelGroup(ExecutorService executor, int initialSize) - throws IOException - { - return new SolarisEventPort(this, ThreadPool.wrap(executor, initialSize)).start(); - } - - private SolarisEventPort toEventPort(AsynchronousChannelGroup group) - throws IOException - { - if (group == null) { - return defaultEventPort(); - } else { - if (!(group instanceof SolarisEventPort)) - throw new IllegalChannelGroupException(); - return (SolarisEventPort)group; - } - } - - @Override - public AsynchronousServerSocketChannel openAsynchronousServerSocketChannel(AsynchronousChannelGroup group) - throws IOException - { - return new UnixAsynchronousServerSocketChannelImpl(toEventPort(group)); - } - - @Override - public AsynchronousSocketChannel openAsynchronousSocketChannel(AsynchronousChannelGroup group) - throws IOException - { - return new UnixAsynchronousSocketChannelImpl(toEventPort(group)); - } -} --- old/src/java.base/solaris/classes/sun/nio/ch/SolarisEventPort.java 2020-05-20 18:10:16.985920232 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.ch; - -import java.nio.channels.spi.AsynchronousChannelProvider; -import java.util.concurrent.RejectedExecutionException; -import java.io.IOException; -import jdk.internal.misc.Unsafe; - -/** - * Provides an AsynchronousChannelGroup implementation based on the Solaris 10 - * event port framework and also provides direct access to that framework. - */ - -class SolarisEventPort - extends Port -{ - private static final Unsafe unsafe = Unsafe.getUnsafe(); - private static final int addressSize = unsafe.addressSize(); - - private static int dependsArch(int value32, int value64) { - return (addressSize == 4) ? value32 : value64; - } - - /* - * typedef struct port_event { - * int portev_events; - * ushort_t portev_source; - * ushort_t portev_pad; - * uintptr_t portev_object; - * void *portev_user; - * } port_event_t; - */ - static final int SIZEOF_PORT_EVENT = dependsArch(16, 24); - static final int OFFSETOF_EVENTS = 0; - static final int OFFSETOF_SOURCE = 4; - static final int OFFSETOF_OBJECT = 8; - - // port sources - static final short PORT_SOURCE_USER = 3; - static final short PORT_SOURCE_FD = 4; - - // events (sys/poll.h) - static final int POLLIN = 0x0001; - static final int POLLOUT = 0x0004; - - // file descriptor to event port. - private final int port; - - // true when port is closed - private boolean closed; - - SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool) - throws IOException - { - super(provider, pool); - - // create event port - this.port = port_create(); - } - - SolarisEventPort start() { - startThreads(new EventHandlerTask()); - return this; - } - - // releass resources - private void implClose() { - synchronized (this) { - if (closed) - return; - closed = true; - } - port_close(port); - } - - private void wakeup() { - try { - port_send(port, 0); - } catch (IOException x) { - throw new AssertionError(x); - } - } - - @Override - void executeOnHandlerTask(Runnable task) { - synchronized (this) { - if (closed) - throw new RejectedExecutionException(); - offerTask(task); - wakeup(); - } - } - - @Override - void shutdownHandlerTasks() { - /* - * If no tasks are running then just release resources; otherwise - * write to the one end of the socketpair to wakeup any polling threads.. - */ - int nThreads = threadCount(); - if (nThreads == 0) { - implClose(); - } else { - // send user event to wakeup each thread - while (nThreads-- > 0) { - try { - port_send(port, 0); - } catch (IOException x) { - throw new AssertionError(x); - } - } - } - } - - @Override - void startPoll(int fd, int events) { - // (re-)associate file descriptor - // no need to translate events - try { - port_associate(port, PORT_SOURCE_FD, fd, events); - } catch (IOException x) { - throw new AssertionError(); // should not happen - } - } - - /* - * Task to read a single event from the port and dispatch it to the - * channel's onEvent handler. - */ - private class EventHandlerTask implements Runnable { - public void run() { - Invoker.GroupAndInvokeCount myGroupAndInvokeCount = - Invoker.getGroupAndInvokeCount(); - final boolean isPooledThread = (myGroupAndInvokeCount != null); - boolean replaceMe = false; - long address = unsafe.allocateMemory(SIZEOF_PORT_EVENT); - try { - for (;;) { - // reset invoke count - if (isPooledThread) - myGroupAndInvokeCount.resetInvokeCount(); - - // wait for I/O completion event - // A error here is fatal (thread will not be replaced) - replaceMe = false; - try { - int n; - do { - n = port_get(port, address); - } while (n == IOStatus.INTERRUPTED); - } catch (IOException x) { - x.printStackTrace(); - return; - } - - // event source - short source = unsafe.getShort(address + OFFSETOF_SOURCE); - if (source != PORT_SOURCE_FD) { - // user event is trigger to invoke task or shutdown - if (source == PORT_SOURCE_USER) { - Runnable task = pollTask(); - if (task == null) { - // shutdown request - return; - } - // run task (may throw error/exception) - replaceMe = true; - task.run(); - } - // ignore - continue; - } - - // pe->portev_object is file descriptor - int fd = (int)unsafe.getAddress(address + OFFSETOF_OBJECT); - // pe->portev_events - int events = unsafe.getInt(address + OFFSETOF_EVENTS); - - // lookup channel - PollableChannel ch; - fdToChannelLock.readLock().lock(); - try { - ch = fdToChannel.get(fd); - } finally { - fdToChannelLock.readLock().unlock(); - } - - // notify channel - if (ch != null) { - replaceMe = true; - // no need to translate events - ch.onEvent(events, isPooledThread); - } - } - } finally { - // free per-thread resources - unsafe.freeMemory(address); - // last task to exit when shutdown release resources - int remaining = threadExit(this, replaceMe); - if (remaining == 0 && isShutdown()) - implClose(); - } - } - } - - /** - * Creates an event port - */ - static native int port_create() throws IOException; - - /** - * Associates specific events of a given object with a port - */ - static native boolean port_associate(int port, int source, long object, int events) - throws IOException; - - /** - * Removes the association of an object with a port. - */ - static native boolean port_dissociate(int port, int source, long object) - throws IOException; - - /** - * Retrieves a single event from a port - */ - static native int port_get(int port, long address) throws IOException; - - /** - * Retrieves at most {@code max} events from a port. A time-out of {@code < 0} means - * never time-out. - */ - static native int port_getn(int port, long address, int max, long timeout) - throws IOException; - - /** - * Sends a user-defined eventto a specified port. - */ - static native void port_send(int port, int events) throws IOException; - - /** - * Closes a port. - */ - static native void port_close(int port); - - - static { - IOUtil.load(); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java 2020-05-20 18:10:17.693933825 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.FileSystem; - -/** - * Creates this platform's default FileSystemProvider. - */ - -public class DefaultFileSystemProvider { - private static final SolarisFileSystemProvider INSTANCE - = new SolarisFileSystemProvider(); - - private DefaultFileSystemProvider() { } - - /** - * Returns the platform's default file system provider. - */ - public static SolarisFileSystemProvider instance() { - return INSTANCE; - } - - /** - * Returns the platform's default file system. - */ - public static FileSystem theFileSystem() { - return INSTANCE.theFileSystem(); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java 2020-05-20 18:10:18.445948263 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,386 +0,0 @@ -/* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.*; -import java.nio.file.attribute.*; -import java.util.*; -import java.io.IOException; -import jdk.internal.misc.Unsafe; - -import static sun.nio.fs.UnixConstants.*; -import static sun.nio.fs.SolarisConstants.*; -import static sun.nio.fs.SolarisNativeDispatcher.*; - - -/** - * Solaris implementation of AclFileAttributeView with native support for - * NFSv4 ACLs on ZFS. - */ - -class SolarisAclFileAttributeView - extends AbstractAclFileAttributeView -{ - private static final Unsafe unsafe = Unsafe.getUnsafe(); - - // Maximum number of entries allowed in an ACL - private static final int MAX_ACL_ENTRIES = 1024; - - /** - * typedef struct ace { - * uid_t a_who; - * uint32_t a_access_mask; - * uint16_t a_flags; - * uint16_t a_type; - * } ace_t; - */ - private static final short SIZEOF_ACE_T = 12; - private static final short OFFSETOF_UID = 0; - private static final short OFFSETOF_MASK = 4; - private static final short OFFSETOF_FLAGS = 8; - private static final short OFFSETOF_TYPE = 10; - - private final UnixPath file; - private final boolean followLinks; - - SolarisAclFileAttributeView(UnixPath file, boolean followLinks) { - this.file = file; - this.followLinks = followLinks; - } - - /** - * Encode the ACL to the given buffer - */ - private static void encode(List acl, long address) { - long offset = address; - for (AclEntry ace: acl) { - int flags = 0; - - // map UserPrincipal to uid and flags - UserPrincipal who = ace.principal(); - if (!(who instanceof UnixUserPrincipals.User)) - throw new ProviderMismatchException(); - UnixUserPrincipals.User user = (UnixUserPrincipals.User)who; - int uid; - if (user.isSpecial()) { - uid = -1; - if (who == UnixUserPrincipals.SPECIAL_OWNER) - flags |= ACE_OWNER; - else if (who == UnixUserPrincipals.SPECIAL_GROUP) - flags |= (ACE_GROUP | ACE_IDENTIFIER_GROUP); - else if (who == UnixUserPrincipals.SPECIAL_EVERYONE) - flags |= ACE_EVERYONE; - else - throw new AssertionError("Unable to map special identifier"); - } else { - if (user instanceof UnixUserPrincipals.Group) { - uid = user.gid(); - flags |= ACE_IDENTIFIER_GROUP; - } else { - uid = user.uid(); - } - } - - // map ACE type - int type; - switch (ace.type()) { - case ALLOW: - type = ACE_ACCESS_ALLOWED_ACE_TYPE; - break; - case DENY: - type = ACE_ACCESS_DENIED_ACE_TYPE; - break; - case AUDIT: - type = ACE_SYSTEM_AUDIT_ACE_TYPE; - break; - case ALARM: - type = ACE_SYSTEM_ALARM_ACE_TYPE; - break; - default: - throw new AssertionError("Unable to map ACE type"); - } - - // map permissions - Set aceMask = ace.permissions(); - int mask = 0; - if (aceMask.contains(AclEntryPermission.READ_DATA)) - mask |= ACE_READ_DATA; - if (aceMask.contains(AclEntryPermission.WRITE_DATA)) - mask |= ACE_WRITE_DATA; - if (aceMask.contains(AclEntryPermission.APPEND_DATA)) - mask |= ACE_APPEND_DATA; - if (aceMask.contains(AclEntryPermission.READ_NAMED_ATTRS)) - mask |= ACE_READ_NAMED_ATTRS; - if (aceMask.contains(AclEntryPermission.WRITE_NAMED_ATTRS)) - mask |= ACE_WRITE_NAMED_ATTRS; - if (aceMask.contains(AclEntryPermission.EXECUTE)) - mask |= ACE_EXECUTE; - if (aceMask.contains(AclEntryPermission.DELETE_CHILD)) - mask |= ACE_DELETE_CHILD; - if (aceMask.contains(AclEntryPermission.READ_ATTRIBUTES)) - mask |= ACE_READ_ATTRIBUTES; - if (aceMask.contains(AclEntryPermission.WRITE_ATTRIBUTES)) - mask |= ACE_WRITE_ATTRIBUTES; - if (aceMask.contains(AclEntryPermission.DELETE)) - mask |= ACE_DELETE; - if (aceMask.contains(AclEntryPermission.READ_ACL)) - mask |= ACE_READ_ACL; - if (aceMask.contains(AclEntryPermission.WRITE_ACL)) - mask |= ACE_WRITE_ACL; - if (aceMask.contains(AclEntryPermission.WRITE_OWNER)) - mask |= ACE_WRITE_OWNER; - if (aceMask.contains(AclEntryPermission.SYNCHRONIZE)) - mask |= ACE_SYNCHRONIZE; - - // FIXME - it would be desirable to know here if the file is a - // directory or not. Solaris returns EINVAL if an ACE has a directory - // -only flag and the file is not a directory. - Set aceFlags = ace.flags(); - if (aceFlags.contains(AclEntryFlag.FILE_INHERIT)) - flags |= ACE_FILE_INHERIT_ACE; - if (aceFlags.contains(AclEntryFlag.DIRECTORY_INHERIT)) - flags |= ACE_DIRECTORY_INHERIT_ACE; - if (aceFlags.contains(AclEntryFlag.NO_PROPAGATE_INHERIT)) - flags |= ACE_NO_PROPAGATE_INHERIT_ACE; - if (aceFlags.contains(AclEntryFlag.INHERIT_ONLY)) - flags |= ACE_INHERIT_ONLY_ACE; - - unsafe.putInt(offset + OFFSETOF_UID, uid); - unsafe.putInt(offset + OFFSETOF_MASK, mask); - unsafe.putShort(offset + OFFSETOF_FLAGS, (short)flags); - unsafe.putShort(offset + OFFSETOF_TYPE, (short)type); - - offset += SIZEOF_ACE_T; - } - } - - /** - * Decode the buffer, returning an ACL - */ - private static List decode(long address, int n) { - ArrayList acl = new ArrayList<>(n); - for (int i=0; i 0) { - who = UnixUserPrincipals.SPECIAL_OWNER; - } else if ((flags & ACE_GROUP) > 0) { - who = UnixUserPrincipals.SPECIAL_GROUP; - } else if ((flags & ACE_EVERYONE) > 0) { - who = UnixUserPrincipals.SPECIAL_EVERYONE; - } else if ((flags & ACE_IDENTIFIER_GROUP) > 0) { - who = UnixUserPrincipals.fromGid(uid); - } else { - who = UnixUserPrincipals.fromUid(uid); - } - - AclEntryType aceType = null; - switch (type) { - case ACE_ACCESS_ALLOWED_ACE_TYPE: - aceType = AclEntryType.ALLOW; - break; - case ACE_ACCESS_DENIED_ACE_TYPE: - aceType = AclEntryType.DENY; - break; - case ACE_SYSTEM_AUDIT_ACE_TYPE: - aceType = AclEntryType.AUDIT; - break; - case ACE_SYSTEM_ALARM_ACE_TYPE: - aceType = AclEntryType.ALARM; - break; - default: - assert false; - } - - Set aceMask = EnumSet.noneOf(AclEntryPermission.class); - if ((mask & ACE_READ_DATA) > 0) - aceMask.add(AclEntryPermission.READ_DATA); - if ((mask & ACE_WRITE_DATA) > 0) - aceMask.add(AclEntryPermission.WRITE_DATA); - if ((mask & ACE_APPEND_DATA ) > 0) - aceMask.add(AclEntryPermission.APPEND_DATA); - if ((mask & ACE_READ_NAMED_ATTRS) > 0) - aceMask.add(AclEntryPermission.READ_NAMED_ATTRS); - if ((mask & ACE_WRITE_NAMED_ATTRS) > 0) - aceMask.add(AclEntryPermission.WRITE_NAMED_ATTRS); - if ((mask & ACE_EXECUTE) > 0) - aceMask.add(AclEntryPermission.EXECUTE); - if ((mask & ACE_DELETE_CHILD ) > 0) - aceMask.add(AclEntryPermission.DELETE_CHILD); - if ((mask & ACE_READ_ATTRIBUTES) > 0) - aceMask.add(AclEntryPermission.READ_ATTRIBUTES); - if ((mask & ACE_WRITE_ATTRIBUTES) > 0) - aceMask.add(AclEntryPermission.WRITE_ATTRIBUTES); - if ((mask & ACE_DELETE) > 0) - aceMask.add(AclEntryPermission.DELETE); - if ((mask & ACE_READ_ACL) > 0) - aceMask.add(AclEntryPermission.READ_ACL); - if ((mask & ACE_WRITE_ACL) > 0) - aceMask.add(AclEntryPermission.WRITE_ACL); - if ((mask & ACE_WRITE_OWNER) > 0) - aceMask.add(AclEntryPermission.WRITE_OWNER); - if ((mask & ACE_SYNCHRONIZE) > 0) - aceMask.add(AclEntryPermission.SYNCHRONIZE); - - Set aceFlags = EnumSet.noneOf(AclEntryFlag.class); - if ((flags & ACE_FILE_INHERIT_ACE) > 0) - aceFlags.add(AclEntryFlag.FILE_INHERIT); - if ((flags & ACE_DIRECTORY_INHERIT_ACE) > 0) - aceFlags.add(AclEntryFlag.DIRECTORY_INHERIT); - if ((flags & ACE_NO_PROPAGATE_INHERIT_ACE) > 0) - aceFlags.add(AclEntryFlag.NO_PROPAGATE_INHERIT); - if ((flags & ACE_INHERIT_ONLY_ACE) > 0) - aceFlags.add(AclEntryFlag.INHERIT_ONLY); - - // build the ACL entry and add it to the list - AclEntry ace = AclEntry.newBuilder() - .setType(aceType) - .setPrincipal(who) - .setPermissions(aceMask).setFlags(aceFlags).build(); - acl.add(ace); - } - - return acl; - } - - // Returns true if NFSv4 ACLs not enabled on file system - private static boolean isAclsEnabled(int fd) { - try { - long enabled = fpathconf(fd, _PC_ACL_ENABLED); - if (enabled == _ACL_ACE_ENABLED) - return true; - } catch (UnixException x) { - } - return false; - } - - @Override - public List getAcl() - throws IOException - { - // open file (will fail if file is a link and not following links) - int fd = -1; - try { - fd = file.openForAttributeAccess(followLinks); - } catch (UnixException x) { - x.rethrowAsIOException(file); - } - try { - long address = unsafe.allocateMemory(SIZEOF_ACE_T * MAX_ACL_ENTRIES); - try { - // read ACL and decode it - int n = facl(fd, ACE_GETACL, MAX_ACL_ENTRIES, address); - assert n >= 0; - return decode(address, n); - } catch (UnixException x) { - if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) { - throw new FileSystemException(file.getPathForExceptionMessage(), - null, x.getMessage() + " (file system does not support NFSv4 ACLs)"); - } - x.rethrowAsIOException(file); - return null; // keep compiler happy - } finally { - unsafe.freeMemory(address); - } - } finally { - close(fd, e -> null); - } - } - - @Override - public void setAcl(List acl) throws IOException { - // open file (will fail if file is a link and not following links) - int fd = -1; - try { - fd = file.openForAttributeAccess(followLinks); - } catch (UnixException x) { - x.rethrowAsIOException(file); - } - try { - // SECURITY: need to copy list as can change during processing - acl = new ArrayList(acl); - int n = acl.size(); - - long address = unsafe.allocateMemory(SIZEOF_ACE_T * n); - try { - encode(acl, address); - facl(fd, ACE_SETACL, n, address); - } catch (UnixException x) { - if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) { - throw new FileSystemException(file.getPathForExceptionMessage(), - null, x.getMessage() + " (file system does not support NFSv4 ACLs)"); - } - if (x.errno() == EINVAL && (n < 3)) - throw new IOException("ACL must contain at least 3 entries"); - x.rethrowAsIOException(file); - } finally { - unsafe.freeMemory(address); - } - } finally { - close(fd, e -> null); - } - } - - @Override - public UserPrincipal getOwner() - throws IOException - { - try { - UnixFileAttributes attrs = - UnixFileAttributes.get(file, followLinks); - return UnixUserPrincipals.fromUid(attrs.uid()); - } catch (UnixException x) { - x.rethrowAsIOException(file); - return null; // keep compile happy - } - } - - @Override - public void setOwner(UserPrincipal owner) throws IOException { - if (!(owner instanceof UnixUserPrincipals.User)) - throw new ProviderMismatchException(); - if (owner instanceof UnixUserPrincipals.Group) - throw new IOException("'owner' parameter is a group"); - int uid = ((UnixUserPrincipals.User)owner).uid(); - - try { - if (followLinks) { - lchown(file, uid, -1); - } else { - chown(file, uid, -1); - } - } catch (UnixException x) { - x.rethrowAsIOException(file); - } - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template 2020-05-20 18:10:19.181962393 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -@@END_COPYRIGHT@@ - -#include -#include -#include -#include -#include -#include - -/* On Solaris, "sun" is defined as a macro. Undefine to make package - declaration valid */ -#undef sun - -/* To be able to name the Java constants the same as the C constants without - having the preprocessor rewrite those identifiers, add PREFIX_ to all - identifiers matching a C constant. The PREFIX_ is filtered out in the - makefile. */ - -@@START_HERE@@ - -package sun.nio.fs; -class SolarisConstants { - - private SolarisConstants() { } - - static final int PREFIX_O_XATTR = O_XATTR; - static final int PREFIX__PC_XATTR_ENABLED = _PC_XATTR_ENABLED; - static final int PREFIX__PC_ACL_ENABLED = _PC_ACL_ENABLED; - static final int PREFIX__ACL_ACE_ENABLED = _ACL_ACE_ENABLED; - static final int PREFIX_ACE_GETACL = ACE_GETACL; - static final int PREFIX_ACE_SETACL = ACE_SETACL; - static final int PREFIX_ACE_ACCESS_ALLOWED_ACE_TYPE = ACE_ACCESS_ALLOWED_ACE_TYPE; - static final int PREFIX_ACE_ACCESS_DENIED_ACE_TYPE = ACE_ACCESS_DENIED_ACE_TYPE; - static final int PREFIX_ACE_SYSTEM_AUDIT_ACE_TYPE = ACE_SYSTEM_AUDIT_ACE_TYPE; - static final int PREFIX_ACE_SYSTEM_ALARM_ACE_TYPE = ACE_SYSTEM_ALARM_ACE_TYPE; - static final int PREFIX_ACE_READ_DATA = ACE_READ_DATA; - static final int PREFIX_ACE_LIST_DIRECTORY = ACE_LIST_DIRECTORY; - static final int PREFIX_ACE_WRITE_DATA = ACE_WRITE_DATA; - static final int PREFIX_ACE_ADD_FILE = ACE_ADD_FILE; - static final int PREFIX_ACE_APPEND_DATA = ACE_APPEND_DATA; - static final int PREFIX_ACE_ADD_SUBDIRECTORY = ACE_ADD_SUBDIRECTORY; - static final int PREFIX_ACE_READ_NAMED_ATTRS = ACE_READ_NAMED_ATTRS; - static final int PREFIX_ACE_WRITE_NAMED_ATTRS = ACE_WRITE_NAMED_ATTRS; - static final int PREFIX_ACE_EXECUTE = ACE_EXECUTE; - static final int PREFIX_ACE_DELETE_CHILD = ACE_DELETE_CHILD; - static final int PREFIX_ACE_READ_ATTRIBUTES = ACE_READ_ATTRIBUTES; - static final int PREFIX_ACE_WRITE_ATTRIBUTES = ACE_WRITE_ATTRIBUTES; - static final int PREFIX_ACE_DELETE = ACE_DELETE; - static final int PREFIX_ACE_READ_ACL = ACE_READ_ACL; - static final int PREFIX_ACE_WRITE_ACL = ACE_WRITE_ACL; - static final int PREFIX_ACE_WRITE_OWNER = ACE_WRITE_OWNER; - static final int PREFIX_ACE_SYNCHRONIZE = ACE_SYNCHRONIZE; - static final int PREFIX_ACE_FILE_INHERIT_ACE = ACE_FILE_INHERIT_ACE; - static final int PREFIX_ACE_DIRECTORY_INHERIT_ACE = ACE_DIRECTORY_INHERIT_ACE; - static final int PREFIX_ACE_NO_PROPAGATE_INHERIT_ACE = ACE_NO_PROPAGATE_INHERIT_ACE; - static final int PREFIX_ACE_INHERIT_ONLY_ACE = ACE_INHERIT_ONLY_ACE; - static final int PREFIX_ACE_SUCCESSFUL_ACCESS_ACE_FLAG = ACE_SUCCESSFUL_ACCESS_ACE_FLAG; - static final int PREFIX_ACE_FAILED_ACCESS_ACE_FLAG = ACE_FAILED_ACCESS_ACE_FLAG; - static final int PREFIX_ACE_IDENTIFIER_GROUP = ACE_IDENTIFIER_GROUP; - static final int PREFIX_ACE_OWNER = ACE_OWNER; - static final int PREFIX_ACE_GROUP = ACE_GROUP; - static final int PREFIX_ACE_EVERYONE = ACE_EVERYONE; -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisFileStore.java 2020-05-20 18:10:19.873975679 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.attribute.*; -import java.io.IOException; - -import static sun.nio.fs.UnixNativeDispatcher.*; -import static sun.nio.fs.SolarisConstants.*; - -/** - * Solaris implementation of FileStore - */ - -class SolarisFileStore - extends UnixFileStore -{ - private final boolean xattrEnabled; - - SolarisFileStore(UnixPath file) throws IOException { - super(file); - this.xattrEnabled = xattrEnabled(); - } - - SolarisFileStore(UnixFileSystem fs, UnixMountEntry entry) throws IOException { - super(fs, entry); - this.xattrEnabled = xattrEnabled(); - } - - // returns true if extended attributes enabled - private boolean xattrEnabled() { - long res = 0L; - try { - res = pathconf(file(), _PC_XATTR_ENABLED); - } catch (UnixException x) { - // ignore - } - return (res != 0L); - } - - @Override - UnixMountEntry findMountEntry() throws IOException { - // On Solaris iterate over the entries in the mount table to find device - for (UnixMountEntry entry: file().getFileSystem().getMountEntries()) { - if (entry.dev() == dev()) { - return entry; - } - } - throw new IOException("Device not found in mnttab"); - } - - @Override - public boolean supportsFileAttributeView(Class type) { - if (type == AclFileAttributeView.class) { - // lookup fstypes.properties - FeatureStatus status = checkIfFeaturePresent("nfsv4acl"); - switch (status) { - case PRESENT : return true; - case NOT_PRESENT : return false; - default : - // AclFileAttributeView available on ZFS - return (type().equals("zfs")); - } - } - if (type == UserDefinedFileAttributeView.class) { - // lookup fstypes.properties - FeatureStatus status = checkIfFeaturePresent("xattr"); - switch (status) { - case PRESENT : return true; - case NOT_PRESENT : return false; - default : - // UserDefinedFileAttributeView available if extended - // attributes supported - return xattrEnabled; - } - } - return super.supportsFileAttributeView(type); - } - - @Override - public boolean supportsFileAttributeView(String name) { - if (name.equals("acl")) - return supportsFileAttributeView(AclFileAttributeView.class); - if (name.equals("user")) - return supportsFileAttributeView(UserDefinedFileAttributeView.class); - return super.supportsFileAttributeView(name); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java 2020-05-20 18:10:20.625990118 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.*; -import java.io.IOException; -import java.util.*; -import static sun.nio.fs.SolarisNativeDispatcher.*; - -/** - * Solaris implementation of FileSystem - */ - -class SolarisFileSystem extends UnixFileSystem { - - SolarisFileSystem(UnixFileSystemProvider provider, String dir) { - super(provider, dir); - } - - @Override - public WatchService newWatchService() - throws IOException - { - return new SolarisWatchService(this); - } - - - // lazy initialization of the list of supported attribute views - private static class SupportedFileFileAttributeViewsHolder { - static final Set supportedFileAttributeViews = - supportedFileAttributeViews(); - private static Set supportedFileAttributeViews() { - Set result = new HashSet<>(); - result.addAll(standardFileAttributeViews()); - // additional Solaris-specific views - result.add("acl"); - result.add("user"); - return Collections.unmodifiableSet(result); - } - } - - @Override - public Set supportedFileAttributeViews() { - return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews; - } - - @Override - void copyNonPosixAttributes(int ofd, int nfd) { - SolarisUserDefinedFileAttributeView.copyExtendedAttributes(ofd, nfd); - // TDB: copy ACL from source to target - } - - /** - * Returns object to iterate over entries in /etc/mnttab - */ - @Override - Iterable getMountEntries() { - ArrayList entries = new ArrayList<>(); - try { - UnixPath mnttab = new UnixPath(this, "/etc/mnttab"); - long fp = fopen(mnttab, "r"); - try { - for (;;) { - UnixMountEntry entry = new UnixMountEntry(); - int res = getextmntent(fp, entry); - if (res < 0) - break; - entries.add(entry); - } - } finally { - fclose(fp); - } - } catch (UnixException x) { - // nothing we can do - } - return entries; - } - - @Override - FileStore getFileStore(UnixMountEntry entry) throws IOException { - return new SolarisFileStore(this, entry); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java 2020-05-20 18:10:21.314003326 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.*; -import java.nio.file.attribute.*; -import java.nio.file.spi.FileTypeDetector; -import java.io.IOException; -import jdk.internal.util.StaticProperty; - -/** - * Solaris implementation of FileSystemProvider - */ - -class SolarisFileSystemProvider extends UnixFileSystemProvider { - public SolarisFileSystemProvider() { - super(); - } - - @Override - SolarisFileSystem newFileSystem(String dir) { - return new SolarisFileSystem(this, dir); - } - - @Override - SolarisFileStore getFileStore(UnixPath path) throws IOException { - return new SolarisFileStore(path); - } - - - @Override - @SuppressWarnings("unchecked") - public V getFileAttributeView(Path obj, - Class type, - LinkOption... options) - { - if (type == AclFileAttributeView.class) { - return (V) new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj), - Util.followLinks(options)); - } - if (type == UserDefinedFileAttributeView.class) { - return(V) new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - Util.followLinks(options)); - } - return super.getFileAttributeView(obj, type, options); - } - - @Override - public DynamicFileAttributeView getFileAttributeView(Path obj, - String name, - LinkOption... options) - { - if (name.equals("acl")) - return new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj), - Util.followLinks(options)); - if (name.equals("user")) - return new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - Util.followLinks(options)); - return super.getFileAttributeView(obj, name, options); - } - - @Override - FileTypeDetector getFileTypeDetector() { - Path userMimeTypes = Path.of(StaticProperty.userHome(), ".mime.types"); - Path etcMimeTypes = Path.of("/etc/mime.types"); - - return chain(new MimeTypesFileTypeDetector(userMimeTypes), - new MimeTypesFileTypeDetector(etcMimeTypes)); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java 2020-05-20 18:10:22.002016535 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -/** - * Solaris specific system calls. - */ - -class SolarisNativeDispatcher extends UnixNativeDispatcher { - private SolarisNativeDispatcher() { } - - /** - * int getextmntent(FILE *fp, struct extmnttab *mp, int len); - */ - static native int getextmntent(long fp, UnixMountEntry entry) - throws UnixException; - - /** - * int facl(int filedes, int cmd, int nentries, void aclbufp) - */ - static native int facl(int fd, int cmd, int nentries, long aclbufp) - throws UnixException; - - - // initialize - private static native void init(); - - static { - jdk.internal.loader.BootLoader.loadLibrary("nio"); - init(); - } -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java 2020-05-20 18:10:22.750030897 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -class SolarisUserDefinedFileAttributeView - extends UnixUserDefinedFileAttributeView -{ - - SolarisUserDefinedFileAttributeView(UnixPath file, boolean followLinks) { - super(file, followLinks); - } - - @Override - protected int maxNameLength() { - return 255; - } - -} --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java 2020-05-20 18:10:23.522045718 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,821 +0,0 @@ -/* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.*; -import java.util.*; -import java.io.IOException; -import jdk.internal.misc.Unsafe; - -import static sun.nio.fs.UnixConstants.*; - -/** - * Solaris implementation of WatchService based on file events notification - * facility. - */ - -class SolarisWatchService - extends AbstractWatchService -{ - private static final Unsafe unsafe = Unsafe.getUnsafe(); - private static int addressSize = unsafe.addressSize(); - - private static int dependsArch(int value32, int value64) { - return (addressSize == 4) ? value32 : value64; - } - - /* - * typedef struct port_event { - * int portev_events; - * ushort_t portev_source; - * ushort_t portev_pad; - * uintptr_t portev_object; - * void *portev_user; - * } port_event_t; - */ - private static final int SIZEOF_PORT_EVENT = dependsArch(16, 24); - private static final int OFFSETOF_EVENTS = 0; - private static final int OFFSETOF_SOURCE = 4; - private static final int OFFSETOF_OBJECT = 8; - - /* - * typedef struct file_obj { - * timestruc_t fo_atime; - * timestruc_t fo_mtime; - * timestruc_t fo_ctime; - * uintptr_t fo_pad[3]; - * char *fo_name; - * } file_obj_t; - */ - private static final int SIZEOF_FILEOBJ = dependsArch(40, 80); - private static final int OFFSET_FO_NAME = dependsArch(36, 72); - - // port sources - private static final short PORT_SOURCE_USER = 3; - private static final short PORT_SOURCE_FILE = 7; - - // user-watchable events - private static final int FILE_MODIFIED = 0x00000002; - private static final int FILE_ATTRIB = 0x00000004; - private static final int FILE_NOFOLLOW = 0x10000000; - - // exception events - private static final int FILE_DELETE = 0x00000010; - private static final int FILE_RENAME_TO = 0x00000020; - private static final int FILE_RENAME_FROM = 0x00000040; - private static final int UNMOUNTED = 0x20000000; - private static final int MOUNTEDOVER = 0x40000000; - - // background thread to read change events - private final Poller poller; - - SolarisWatchService(UnixFileSystem fs) throws IOException { - int port = -1; - try { - port = portCreate(); - } catch (UnixException x) { - throw new IOException(x.errorString()); - } - - this.poller = new Poller(fs, this, port); - this.poller.start(); - } - - @Override - WatchKey register(Path dir, - WatchEvent.Kind[] events, - WatchEvent.Modifier... modifiers) - throws IOException - { - // delegate to poller - return poller.register(dir, events, modifiers); - } - - @Override - void implClose() throws IOException { - // delegate to poller - poller.close(); - } - - /** - * WatchKey implementation - */ - private class SolarisWatchKey extends AbstractWatchKey - implements DirectoryNode - { - private final UnixFileKey fileKey; - - // pointer to native file_obj object - private final long object; - - // events (may be changed). set to null when watch key is invalid - private volatile Set> events; - - // map of entries in directory; created lazily; accessed only by - // poller thread. - private Map children = new HashMap<>(); - - SolarisWatchKey(SolarisWatchService watcher, - UnixPath dir, - UnixFileKey fileKey, - long object, - Set> events) - { - super(dir, watcher); - this.fileKey = fileKey; - this.object = object; - this.events = events; - } - - UnixPath getDirectory() { - return (UnixPath)watchable(); - } - - UnixFileKey getFileKey() { - return fileKey; - } - - @Override - public long object() { - return object; - } - - void invalidate() { - events = null; - } - - Set> events() { - return events; - } - - void setEvents(Set> events) { - this.events = events; - } - - Map children() { - return children; - } - - @Override - public boolean isValid() { - return events != null; - } - - @Override - public void cancel() { - if (isValid()) { - // delegate to poller - poller.cancel(this); - } - } - - @Override - public void addChild(Path name, EntryNode node) { - children.put(name, node); - } - - @Override - public void removeChild(Path name) { - children.remove(name); - } - - @Override - public EntryNode getChild(Path name) { - return children.get(name); - } - } - - /** - * Background thread to read from port - */ - private class Poller extends AbstractPoller { - - // maximum number of events to read per call to port_getn - private static final int MAX_EVENT_COUNT = 128; - - // events that map to ENTRY_DELETE - private static final int FILE_REMOVED = - (FILE_DELETE|FILE_RENAME_TO|FILE_RENAME_FROM); - - // events that tell us not to re-associate the object - private static final int FILE_EXCEPTION = - (FILE_REMOVED|UNMOUNTED|MOUNTEDOVER); - - // address of event buffers (used to receive events with port_getn) - private final long bufferAddress; - - private final SolarisWatchService watcher; - - // the I/O port - private final int port; - - // maps file key (dev/inode) to WatchKey - private final Map fileKey2WatchKey; - - // maps file_obj object to Node - private final Map object2Node; - - /** - * Create a new instance - */ - Poller(UnixFileSystem fs, SolarisWatchService watcher, int port) { - this.watcher = watcher; - this.port = port; - this.bufferAddress = - unsafe.allocateMemory(SIZEOF_PORT_EVENT * MAX_EVENT_COUNT); - this.fileKey2WatchKey = new HashMap(); - this.object2Node = new HashMap(); - } - - @Override - void wakeup() throws IOException { - // write to port to wakeup polling thread - try { - portSend(port, 0); - } catch (UnixException x) { - throw new IOException(x.errorString()); - } - } - - @Override - Object implRegister(Path obj, - Set> events, - WatchEvent.Modifier... modifiers) - { - // no modifiers supported at this time - if (modifiers.length > 0) { - for (WatchEvent.Modifier modifier: modifiers) { - if (modifier == null) - return new NullPointerException(); - if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) && - !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) && - !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) { - return new UnsupportedOperationException("Modifier not supported"); - } - } - } - - UnixPath dir = (UnixPath)obj; - - // check file is directory - UnixFileAttributes attrs = null; - try { - attrs = UnixFileAttributes.get(dir, true); - } catch (UnixException x) { - return x.asIOException(dir); - } - if (!attrs.isDirectory()) { - return new NotDirectoryException(dir.getPathForExceptionMessage()); - } - - // if already registered then update the events and return existing key - UnixFileKey fileKey = attrs.fileKey(); - SolarisWatchKey watchKey = fileKey2WatchKey.get(fileKey); - if (watchKey != null) { - try { - updateEvents(watchKey, events); - } catch (UnixException x) { - return x.asIOException(dir); - } - return watchKey; - } - - // register directory - long object = 0L; - try { - object = registerImpl(dir, (FILE_MODIFIED | FILE_ATTRIB)); - } catch (UnixException x) { - return x.asIOException(dir); - } - - // create watch key and insert it into maps - watchKey = new SolarisWatchKey(watcher, dir, fileKey, object, events); - object2Node.put(object, watchKey); - fileKey2WatchKey.put(fileKey, watchKey); - - // register all entries in directory - registerChildren(dir, watchKey, false, false); - - return watchKey; - } - - // release resources for single entry - void releaseChild(EntryNode node) { - long object = node.object(); - if (object != 0L) { - object2Node.remove(object); - releaseObject(object, true); - node.setObject(0L); - } - } - - // release resources for entries in directory - void releaseChildren(SolarisWatchKey key) { - for (EntryNode node: key.children().values()) { - releaseChild(node); - } - } - - // cancel single key - @Override - void implCancelKey(WatchKey obj) { - SolarisWatchKey key = (SolarisWatchKey)obj; - if (key.isValid()) { - fileKey2WatchKey.remove(key.getFileKey()); - - // release resources for entries - releaseChildren(key); - - // release resources for directory - long object = key.object(); - object2Node.remove(object); - releaseObject(object, true); - - // and finally invalidate the key - key.invalidate(); - } - } - - // close watch service - @Override - void implCloseAll() { - // release all native resources - for (Long object: object2Node.keySet()) { - releaseObject(object, true); - } - - // invalidate all keys - for (Map.Entry entry: fileKey2WatchKey.entrySet()) { - entry.getValue().invalidate(); - } - - // clean-up - object2Node.clear(); - fileKey2WatchKey.clear(); - - // free global resources - unsafe.freeMemory(bufferAddress); - UnixNativeDispatcher.close(port, e -> null); - } - - /** - * Poller main loop. Blocks on port_getn waiting for events and then - * processes them. - */ - @Override - public void run() { - try { - for (;;) { - int n = portGetn(port, bufferAddress, MAX_EVENT_COUNT); - assert n > 0; - - long address = bufferAddress; - for (int i=0; iportev_source - short source = unsafe.getShort(address + OFFSETOF_SOURCE); - // pe->portev_object - long object = unsafe.getAddress(address + OFFSETOF_OBJECT); - // pe->portev_events - int events = unsafe.getInt(address + OFFSETOF_EVENTS); - - // user event is trigger to process pending requests - if (source != PORT_SOURCE_FILE) { - if (source == PORT_SOURCE_USER) { - // process any pending requests - boolean shutdown = processRequests(); - if (shutdown) - return true; - } - return false; - } - - // lookup object to get Node - Node node = object2Node.get(object); - if (node == null) { - // should not happen - return false; - } - - // As a workaround for 6642290 and 6636438/6636412 we don't use - // FILE_EXCEPTION events to tell use not to register the file. - // boolean reregister = (events & FILE_EXCEPTION) == 0; - boolean reregister = true; - - // If node is EntryNode then event relates to entry in directory - // If node is a SolarisWatchKey (DirectoryNode) then event relates - // to a watched directory. - boolean isDirectory = (node instanceof SolarisWatchKey); - if (isDirectory) { - processDirectoryEvents((SolarisWatchKey)node, events); - } else { - boolean ignore = processEntryEvents((EntryNode)node, events); - if (ignore) - reregister = false; - } - - // need to re-associate to get further events - if (reregister) { - try { - events = FILE_MODIFIED | FILE_ATTRIB; - if (!isDirectory) events |= FILE_NOFOLLOW; - portAssociate(port, - PORT_SOURCE_FILE, - object, - events); - } catch (UnixException x) { - // unable to re-register - reregister = false; - } - } - - // object is not re-registered so release resources. If - // object is a watched directory then signal key - if (!reregister) { - // release resources - object2Node.remove(object); - releaseObject(object, false); - - // if watch key then signal it - if (isDirectory) { - SolarisWatchKey key = (SolarisWatchKey)node; - fileKey2WatchKey.remove( key.getFileKey() ); - key.invalidate(); - key.signal(); - } else { - // if entry then remove it from parent - EntryNode entry = (EntryNode)node; - SolarisWatchKey key = (SolarisWatchKey)entry.parent(); - key.removeChild(entry.name()); - } - } - - return false; - } - - /** - * Process directory events. If directory is modified then re-scan - * directory to register any new entries - */ - void processDirectoryEvents(SolarisWatchKey key, int mask) { - if ((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) { - registerChildren(key.getDirectory(), key, - key.events().contains(StandardWatchEventKinds.ENTRY_CREATE), - key.events().contains(StandardWatchEventKinds.ENTRY_DELETE)); - } - } - - /** - * Process events for entries in registered directories. Returns {@code - * true} if events are ignored because the watch key has been cancelled. - */ - boolean processEntryEvents(EntryNode node, int mask) { - SolarisWatchKey key = (SolarisWatchKey)node.parent(); - Set> events = key.events(); - if (events == null) { - // key has been cancelled so ignore event - return true; - } - - // entry modified - if (((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) && - events.contains(StandardWatchEventKinds.ENTRY_MODIFY)) - { - key.signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, node.name()); - } - - - return false; - } - - /** - * Registers all entries in the given directory - * - * The {@code sendCreateEvents} and {@code sendDeleteEvents} parameters - * indicates if ENTRY_CREATE and ENTRY_DELETE events should be queued - * when new entries are found. When initially registering a directory - * they will always be false. When re-scanning a directory then it - * depends on if the events are enabled or not. - */ - void registerChildren(UnixPath dir, - SolarisWatchKey parent, - boolean sendCreateEvents, - boolean sendDeleteEvents) - { - boolean isModifyEnabled = - parent.events().contains(StandardWatchEventKinds.ENTRY_MODIFY) ; - - // reset visited flag on entries so that we can detect file deletes - for (EntryNode node: parent.children().values()) { - node.setVisited(false); - } - - try (DirectoryStream stream = Files.newDirectoryStream(dir)) { - for (Path entry: stream) { - Path name = entry.getFileName(); - - // skip entry if already registered - EntryNode node = parent.getChild(name); - if (node != null) { - node.setVisited(true); - continue; - } - - // new entry found - - long object = 0L; - int errno = 0; - boolean addNode = false; - - // if ENTRY_MODIFY enabled then we register the entry for events - if (isModifyEnabled) { - try { - UnixPath path = (UnixPath)entry; - int events = (FILE_NOFOLLOW | FILE_MODIFIED | FILE_ATTRIB); - object = registerImpl(path, events); - addNode = true; - } catch (UnixException x) { - errno = x.errno(); - } - } else { - addNode = true; - } - - if (addNode) { - // create node - node = new EntryNode(object, (UnixPath)entry.getFileName(), parent); - node.setVisited(true); - // tell the parent about it - parent.addChild(entry.getFileName(), node); - if (object != 0L) - object2Node.put(object, node); - } - - // send ENTRY_CREATE event for the new file - // send ENTRY_DELETE event for files that were deleted immediately - boolean deleted = (errno == ENOENT); - if (sendCreateEvents && (addNode || deleted)) - parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name); - if (sendDeleteEvents && deleted) - parent.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, name); - - } - } catch (DirectoryIteratorException | IOException x) { - // queue OVERFLOW event so that user knows to re-scan directory - parent.signalEvent(StandardWatchEventKinds.OVERFLOW, null); - return; - } - - // clean-up and send ENTRY_DELETE events for any entries that were - // not found - Iterator> iterator = - parent.children().entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - EntryNode node = entry.getValue(); - if (!node.isVisited()) { - long object = node.object(); - if (object != 0L) { - object2Node.remove(object); - releaseObject(object, true); - } - if (sendDeleteEvents) - parent.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, node.name()); - iterator.remove(); - } - } - } - - /** - * Update watch key's events. If ENTRY_MODIFY changes to be enabled - * then register each file in the directory; If ENTRY_MODIFY changed to - * be disabled then unregister each file. - */ - void updateEvents(SolarisWatchKey key, Set> events) - throws UnixException - { - - // update events, remembering if ENTRY_MODIFY was previously - // enabled or disabled. - boolean oldModifyEnabled = key.events() - .contains(StandardWatchEventKinds.ENTRY_MODIFY); - key.setEvents(events); - - // check if ENTRY_MODIFY has changed - boolean newModifyEnabled = events - .contains(StandardWatchEventKinds.ENTRY_MODIFY); - if (newModifyEnabled != oldModifyEnabled) { - UnixException ex = null; - for (EntryNode node: key.children().values()) { - if (newModifyEnabled) { - // register - UnixPath path = key.getDirectory().resolve(node.name()); - int ev = (FILE_NOFOLLOW | FILE_MODIFIED | FILE_ATTRIB); - try { - long object = registerImpl(path, ev); - object2Node.put(object, node); - node.setObject(object); - } catch (UnixException x) { - // if file has been deleted then it will be detected - // as a FILE_MODIFIED event on the directory - if (x.errno() != ENOENT) { - ex = x; - break; - } - } - } else { - // unregister - releaseChild(node); - } - } - - // an error occurred - if (ex != null) { - releaseChildren(key); - throw ex; - } - } - } - - /** - * Calls port_associate to register the given path. - * Returns pointer to fileobj structure that is allocated for - * the registration. - */ - long registerImpl(UnixPath dir, int events) - throws UnixException - { - // allocate memory for the path (file_obj->fo_name field) - byte[] path = dir.getByteArrayForSysCalls(); - int len = path.length; - long name = unsafe.allocateMemory(len+1); - unsafe.copyMemory(path, Unsafe.ARRAY_BYTE_BASE_OFFSET, null, - name, (long)len); - unsafe.putByte(name + len, (byte)0); - - // allocate memory for filedatanode structure - this is the object - // to port_associate - long object = unsafe.allocateMemory(SIZEOF_FILEOBJ); - unsafe.setMemory(null, object, SIZEOF_FILEOBJ, (byte)0); - unsafe.putAddress(object + OFFSET_FO_NAME, name); - - // associate the object with the port - try { - portAssociate(port, - PORT_SOURCE_FILE, - object, - events); - } catch (UnixException x) { - // debugging - if (x.errno() == EAGAIN) { - System.err.println("The maximum number of objects associated "+ - "with the port has been reached"); - } - - unsafe.freeMemory(name); - unsafe.freeMemory(object); - throw x; - } - return object; - } - - /** - * Frees all resources for an file_obj object; optionally remove - * association from port - */ - void releaseObject(long object, boolean dissociate) { - // remove association - if (dissociate) { - try { - portDissociate(port, PORT_SOURCE_FILE, object); - } catch (UnixException x) { - // ignore - } - } - - // free native memory - long name = unsafe.getAddress(object + OFFSET_FO_NAME); - unsafe.freeMemory(name); - unsafe.freeMemory(object); - } - } - - /** - * A node with native (file_obj) resources - */ - private static interface Node { - long object(); - } - - /** - * A directory node with a map of the entries in the directory - */ - private static interface DirectoryNode extends Node { - void addChild(Path name, EntryNode node); - void removeChild(Path name); - EntryNode getChild(Path name); - } - - /** - * An implementation of a node that is an entry in a directory. - */ - private static class EntryNode implements Node { - private long object; - private final UnixPath name; - private final DirectoryNode parent; - private boolean visited; - - EntryNode(long object, UnixPath name, DirectoryNode parent) { - this.object = object; - this.name = name; - this.parent = parent; - } - - @Override - public long object() { - return object; - } - - void setObject(long ptr) { - this.object = ptr; - } - - UnixPath name() { - return name; - } - - DirectoryNode parent() { - return parent; - } - - boolean isVisited() { - return visited; - } - - void setVisited(boolean v) { - this.visited = v; - } - } - - // -- native methods -- - - private static native void init(); - - private static native int portCreate() throws UnixException; - - private static native void portAssociate(int port, int source, long object, int events) - throws UnixException; - - private static native void portDissociate(int port, int source, long object) - throws UnixException; - - private static native void portSend(int port, int events) - throws UnixException; - - private static native int portGetn(int port, long address, int max) - throws UnixException; - - static { - jdk.internal.loader.BootLoader.loadLibrary("nio"); - init(); - } -} --- old/src/java.base/solaris/native/libjava/ProcessHandleImpl_solaris.c 2020-05-20 18:10:25.002074133 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" -#include "jni_util.h" - -#include "ProcessHandleImpl_unix.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Implementation of native ProcessHandleImpl functions for Solaris. - * See ProcessHandleImpl_unix.c for more details. - */ - -void os_initNative(JNIEnv *env, jclass clazz) {} - -/* - * Return pids of active processes, and optionally parent pids and - * start times for each process. - * For a specific non-zero pid, only the direct children are returned. - * If the pid is zero, all active processes are returned. - * Reads /proc and accumulates any process following the rules above. - * The resulting pids are stored into an array of longs named jarray. - * The number of pids is returned if they all fit. - * If the parentArray is non-null, store also the parent pid. - * In this case the parentArray must have the same length as the result pid array. - * Of course in the case of a given non-zero pid all entries in the parentArray - * will contain this pid, so this array does only make sense in the case of a given - * zero pid. - * If the jstimesArray is non-null, store also the start time of the pid. - * In this case the jstimesArray must have the same length as the result pid array. - * If the array(s) (is|are) too short, excess pids are not stored and - * the desired length is returned. - */ -jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray, - jlongArray jparentArray, jlongArray jstimesArray) { - DIR* dir; - struct dirent* ptr; - pid_t pid = (pid_t) jpid; - jlong* pids = NULL; - jlong* ppids = NULL; - jlong* stimes = NULL; - jsize parentArraySize = 0; - jsize arraySize = 0; - jsize stimesSize = 0; - jsize count = 0; - - arraySize = (*env)->GetArrayLength(env, jarray); - JNU_CHECK_EXCEPTION_RETURN(env, -1); - if (jparentArray != NULL) { - parentArraySize = (*env)->GetArrayLength(env, jparentArray); - JNU_CHECK_EXCEPTION_RETURN(env, -1); - - if (arraySize != parentArraySize) { - JNU_ThrowIllegalArgumentException(env, "array sizes not equal"); - return 0; - } - } - if (jstimesArray != NULL) { - stimesSize = (*env)->GetArrayLength(env, jstimesArray); - JNU_CHECK_EXCEPTION_RETURN(env, -1); - - if (arraySize != stimesSize) { - JNU_ThrowIllegalArgumentException(env, "array sizes not equal"); - return 0; - } - } - - /* - * To locate the children we scan /proc looking for files that have a - * position integer as a filename. - */ - if ((dir = opendir("/proc")) == NULL) { - JNU_ThrowByNameWithMessageAndLastError(env, - "java/lang/RuntimeException", "Unable to open /proc"); - return -1; - } - - do { // Block to break out of on Exception - pids = (*env)->GetLongArrayElements(env, jarray, NULL); - if (pids == NULL) { - break; - } - if (jparentArray != NULL) { - ppids = (*env)->GetLongArrayElements(env, jparentArray, NULL); - if (ppids == NULL) { - break; - } - } - if (jstimesArray != NULL) { - stimes = (*env)->GetLongArrayElements(env, jstimesArray, NULL); - if (stimes == NULL) { - break; - } - } - - while ((ptr = readdir(dir)) != NULL) { - pid_t ppid = 0; - jlong totalTime = 0L; - jlong startTime = 0L; - - /* skip files that aren't numbers */ - pid_t childpid = (pid_t) atoi(ptr->d_name); - if ((int) childpid <= 0) { - continue; - } - - // Get the parent pid, and start time - ppid = os_getParentPidAndTimings(env, childpid, &totalTime, &startTime); - if (ppid >= 0 && (pid == 0 || ppid == pid)) { - if (count < arraySize) { - // Only store if it fits - pids[count] = (jlong) childpid; - - if (ppids != NULL) { - // Store the parentPid - ppids[count] = (jlong) ppid; - } - if (stimes != NULL) { - // Store the process start time - stimes[count] = startTime; - } - } - count++; // Count to tabulate size needed - } - } - } while (0); - - if (pids != NULL) { - (*env)->ReleaseLongArrayElements(env, jarray, pids, 0); - } - if (ppids != NULL) { - (*env)->ReleaseLongArrayElements(env, jparentArray, ppids, 0); - } - if (stimes != NULL) { - (*env)->ReleaseLongArrayElements(env, jstimesArray, stimes, 0); - } - - closedir(dir); - // If more pids than array had size for; count will be greater than array size - return count; -} - -/** - * Helper function to get the 'psinfo_t' data from "/proc/%d/psinfo". - * Returns 0 on success and -1 on error. - */ -static int getPsinfo(pid_t pid, psinfo_t *psinfo) { - FILE* fp; - char fn[32]; - size_t ret; - - /* - * Try to open /proc/%d/psinfo - */ - snprintf(fn, sizeof fn, "/proc/%d/psinfo", pid); - fp = fopen(fn, "r"); - if (fp == NULL) { - return -1; - } - - ret = fread(psinfo, 1, sizeof(psinfo_t), fp); - fclose(fp); - if (ret < sizeof(psinfo_t)) { - return -1; - } - return 0; -} - -pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid, jlong *totalTime, jlong *startTime) { - psinfo_t psinfo; - - if (getPsinfo(pid, &psinfo) < 0) { - return -1; - } - - // Validate the pid before returning the info - if (kill(pid, 0) < 0) { - return -1; - } - - *totalTime = psinfo.pr_time.tv_sec * 1000000000L + psinfo.pr_time.tv_nsec; - - *startTime = psinfo.pr_start.tv_sec * (jlong)1000 + - psinfo.pr_start.tv_nsec / 1000000; - - return (pid_t) psinfo.pr_ppid; -} - -void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) { - psinfo_t psinfo; - char fn[32]; - char exePath[PATH_MAX]; - char prargs[PRARGSZ + 1]; - jstring cmdexe = NULL; - int ret; - - /* - * The full path to the executable command is the link in - * /proc//paths/a.out. But it is only readable for processes we own. - */ - snprintf(fn, sizeof fn, "/proc/%d/path/a.out", pid); - if ((ret = readlink(fn, exePath, PATH_MAX - 1)) > 0) { - // null terminate and create String to store for command - exePath[ret] = '\0'; - CHECK_NULL(cmdexe = JNU_NewStringPlatform(env, exePath)); - } - - /* - * Now try to open /proc/%d/psinfo - */ - if (getPsinfo(pid, &psinfo) < 0) { - unix_fillArgArray(env, jinfo, 0, NULL, NULL, cmdexe, NULL); - return; - } - - unix_getUserInfo(env, jinfo, psinfo.pr_uid); - - /* - * Now read psinfo.pr_psargs which contains the first PRARGSZ characters of the - * argument list (i.e. arg[0] arg[1] ...). Unfortunately, PRARGSZ is usually set - * to 80 characters only. Nevertheless it's better than nothing :) - */ - strncpy(prargs, psinfo.pr_psargs, PRARGSZ); - prargs[PRARGSZ] = '\0'; - if (prargs[0] == '\0') { - /* If psinfo.pr_psargs didn't contain any strings, use psinfo.pr_fname - * (which only contains the last component of exec()ed pathname) as a - * last resort. - */ - strncpy(prargs, psinfo.pr_fname, PRARGSZ); - prargs[PRARGSZ] = '\0'; - } - unix_fillArgArray(env, jinfo, 0, NULL, NULL, cmdexe, - prargs[0] == '\0' ? NULL : prargs); -} - --- old/src/java.base/solaris/native/libjvm_db/libjvm_db.c 2020-05-20 18:10:25.750088494 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,1552 +0,0 @@ -/* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include -#include -#include -#include -#include - -#include "libjvm_db.h" -#include "JvmOffsets.h" - -#define LIBJVM_SO "libjvm.so" - -#if defined(i386) || defined(__i386) || defined(__amd64) -#ifdef COMPILER2 -#define X86_COMPILER2 -#endif /* COMPILER2 */ -#endif /* i386 */ - -typedef struct { - short vf_cnt; /* number of recognized java vframes */ - short bci; /* current frame method byte code index */ - int line; /* current frame method source line */ - uint64_t new_fp; /* fp for the next frame */ - uint64_t new_pc; /* pc for the next frame */ - uint64_t new_sp; /* "raw" sp for the next frame (includes extension by interpreter/adapter */ - char locinf; /* indicates there is valid location info */ -} Jframe_t; - -int Jlookup_by_regs(jvm_agent_t* J, const prgregset_t regs, char *name, - size_t size, Jframe_t *jframe); - -int main(int arg) { return arg; } - -static int debug = 0; - -static void failed(int err, const char * file, int line) { - if (debug) { - fprintf(stderr, "failed %d at %s:%d\n", err, file, line); - } -} - -static void warn(const char * file, int line, const char * msg) { - if (debug) { - fprintf(stderr, "warning: %s at %s:%d\n", msg, file, line); - } -} - -static void warn1(const char * file, int line, const char * msg, intptr_t arg1) { - if (debug) { - fprintf(stderr, "warning: "); - fprintf(stderr, msg, arg1); - fprintf(stderr, " at %s:%d\n", file, line); - } -} - -#define CHECK_FAIL(err) \ - if (err != PS_OK) { failed(err, __FILE__, __LINE__); goto fail; } -#define WARN(msg) warn(__FILE__, __LINE__, msg) -#define WARN1(msg, arg1) warn1(__FILE__, __LINE__, msg, arg1) - -typedef struct VMStructEntry { - const char * typeName; /* The type name containing the given field (example: "Klass") */ - const char * fieldName; /* The field name within the type (example: "_name") */ - uint64_t address; /* Address of field; only used for static fields */ - /* ("offset" can not be reused because of apparent solstudio compiler bug */ - /* in generation of initializer data) */ -} VMStructEntry; - -/* Prototyping inlined methods */ - -int sprintf(char *s, const char *format, ...); - -#define SZ16 sizeof(int16_t) -#define SZ32 sizeof(int32_t) - -#define COMP_METHOD_SIGN '*' - -#define MAX_VFRAMES_CNT 256 - -typedef struct vframe { - uint64_t method; - int32_t sender_decode_offset; - int32_t methodIdx; - int32_t bci; - int32_t line; -} Vframe_t; - -typedef struct frame { - uintptr_t fp; - uintptr_t pc; - uintptr_t sp; - uintptr_t sender_sp; // The unextended sp of the caller -} Frame_t; - -typedef struct Nmethod_t { - struct jvm_agent* J; - Jframe_t *jframe; - - uint64_t nm; /* _nmethod */ - uint64_t pc; - uint64_t pc_desc; - - int32_t orig_pc_offset; /* _orig_pc_offset */ - uint64_t instrs_beg; /* _code_offset */ - uint64_t instrs_end; - uint64_t deopt_beg; /* _deoptimize_offset */ - uint64_t scopes_data_beg; /* _scopes_data_begin */ - int32_t scopes_data_end; - int32_t metadata_beg; /* _metadata_offset */ - int32_t metadata_end; - int32_t scopes_pcs_beg; /* _scopes_pcs_offset */ - int32_t scopes_pcs_end; - - int vf_cnt; - Vframe_t vframes[MAX_VFRAMES_CNT]; -} Nmethod_t; - -struct jvm_agent { - struct ps_prochandle* P; - - uint64_t nmethod_vtbl; - uint64_t CodeBlob_vtbl; - uint64_t BufferBlob_vtbl; - uint64_t RuntimeStub_vtbl; - uint64_t Method_vtbl; - - uint64_t Use_Compressed_Oops_address; - uint64_t Universe_narrow_oop_base_address; - uint64_t Universe_narrow_oop_shift_address; - uint64_t CodeCache_heaps_address; - - /* Volatiles */ - uint8_t Use_Compressed_Oops; - uint64_t Universe_narrow_oop_base; - uint32_t Universe_narrow_oop_shift; - // Code cache heaps - int32_t Number_of_heaps; - uint64_t* Heap_low; - uint64_t* Heap_high; - uint64_t* Heap_segmap_low; - uint64_t* Heap_segmap_high; - - int32_t SIZE_CodeCache_log2_segment; - - uint64_t methodPtr; - uint64_t bcp; - - Nmethod_t *N; /*Inlined methods support */ - Frame_t prev_fr; - Frame_t curr_fr; -}; - -static int -read_string(struct ps_prochandle *P, - char *buf, /* caller's buffer */ - size_t size, /* upper limit on bytes to read */ - uintptr_t addr) /* address in process */ -{ - int err = PS_OK; - while (size-- > 1 && err == PS_OK) { - err = ps_pread(P, addr, buf, 1); - if (*buf == '\0') { - return PS_OK; - } - addr += 1; - buf += 1; - } - return -1; -} - -static int read_compressed_pointer(jvm_agent_t* J, uint64_t base, uint32_t *ptr) { - int err = -1; - uint32_t ptr32; - err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t)); - *ptr = ptr32; - return err; -} - -static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) { - int err = -1; - uint32_t ptr32; - - switch (DATA_MODEL) { - case PR_MODEL_LP64: - err = ps_pread(J->P, base, ptr, sizeof(uint64_t)); - break; - case PR_MODEL_ILP32: - err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t)); - *ptr = ptr32; - break; - } - - return err; -} - -static int read_string_pointer(jvm_agent_t* J, uint64_t base, const char ** stringp) { - uint64_t ptr; - int err; - char buffer[1024]; - - *stringp = NULL; - err = read_pointer(J, base, &ptr); - CHECK_FAIL(err); - if (ptr != 0) { - err = read_string(J->P, buffer, sizeof(buffer), ptr); - CHECK_FAIL(err); - *stringp = strdup(buffer); - } - return PS_OK; - - fail: - return err; -} - -static int parse_vmstruct_entry(jvm_agent_t* J, uint64_t base, VMStructEntry* vmp) { - uint64_t ptr; - int err; - - err = read_string_pointer(J, base + OFFSET_VMStructEntrytypeName, &vmp->typeName); - CHECK_FAIL(err); - err = read_string_pointer(J, base + OFFSET_VMStructEntryfieldName, &vmp->fieldName); - CHECK_FAIL(err); - err = read_pointer(J, base + OFFSET_VMStructEntryaddress, &vmp->address); - CHECK_FAIL(err); - - return PS_OK; - - fail: - if (vmp->typeName != NULL) free((void*)vmp->typeName); - if (vmp->fieldName != NULL) free((void*)vmp->fieldName); - return err; -} - -static int parse_vmstructs(jvm_agent_t* J) { - VMStructEntry vmVar; - VMStructEntry* vmp = &vmVar; - uint64_t gHotSpotVMStructs; - psaddr_t sym_addr; - uint64_t base; - int err; - - /* Clear *vmp now in case we jump to fail: */ - memset(vmp, 0, sizeof(VMStructEntry)); - - err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr); - CHECK_FAIL(err); - err = read_pointer(J, sym_addr, &gHotSpotVMStructs); - CHECK_FAIL(err); - base = gHotSpotVMStructs; - - err = PS_OK; - while (err == PS_OK) { - memset(vmp, 0, sizeof(VMStructEntry)); - err = parse_vmstruct_entry(J, base, vmp); - if (err != PS_OK || vmp->typeName == NULL) { - break; - } - - if (vmp->typeName[0] == 'C' && strcmp("CodeCache", vmp->typeName) == 0) { - /* Read _heaps field of type GrowableArray* */ - if (strcmp("_heaps", vmp->fieldName) == 0) { - err = read_pointer(J, vmp->address, &J->CodeCache_heaps_address); - } - } else if (vmp->typeName[0] == 'U' && strcmp("Universe", vmp->typeName) == 0) { - if (strcmp("_narrow_oop._base", vmp->fieldName) == 0) { - J->Universe_narrow_oop_base_address = vmp->address; - } - if (strcmp("_narrow_oop._shift", vmp->fieldName) == 0) { - J->Universe_narrow_oop_shift_address = vmp->address; - } - } - CHECK_FAIL(err); - - base += SIZE_VMStructEntry; - if (vmp->typeName != NULL) free((void*)vmp->typeName); - if (vmp->fieldName != NULL) free((void*)vmp->fieldName); - } - - return PS_OK; - - fail: - if (vmp->typeName != NULL) free((void*)vmp->typeName); - if (vmp->fieldName != NULL) free((void*)vmp->fieldName); - return -1; -} - -static int find_symbol(jvm_agent_t* J, const char *name, uint64_t* valuep) { - psaddr_t sym_addr; - int err; - - err = ps_pglobal_lookup(J->P, LIBJVM_SO, name, &sym_addr); - if (err != PS_OK) goto fail; - *valuep = sym_addr; - return PS_OK; - - fail: - return err; -} - -static int read_volatiles(jvm_agent_t* J) { - int i; - uint64_t array_data; - uint64_t code_heap_address; - int err; - - err = find_symbol(J, "UseCompressedOops", &J->Use_Compressed_Oops_address); - if (err == PS_OK) { - err = ps_pread(J->P, J->Use_Compressed_Oops_address, &J->Use_Compressed_Oops, sizeof(uint8_t)); - CHECK_FAIL(err); - } else { - J->Use_Compressed_Oops = 0; - } - - err = read_pointer(J, J->Universe_narrow_oop_base_address, &J->Universe_narrow_oop_base); - CHECK_FAIL(err); - err = ps_pread(J->P, J->Universe_narrow_oop_shift_address, &J->Universe_narrow_oop_shift, sizeof(uint32_t)); - CHECK_FAIL(err); - - /* CodeCache_heaps_address points to GrowableArray, read _data field - pointing to the first entry of type CodeCache* in the array */ - err = read_pointer(J, J->CodeCache_heaps_address + OFFSET_GrowableArray_CodeHeap_data, &array_data); - /* Read _len field containing the number of code heaps */ - err = ps_pread(J->P, J->CodeCache_heaps_address + OFFSET_GrowableArray_CodeHeap_len, - &J->Number_of_heaps, sizeof(J->Number_of_heaps)); - - /* Allocate memory for heap configurations */ - J->Heap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - - /* Read code heap configurations */ - for (i = 0; i < J->Number_of_heaps; ++i) { - /* Read address of heap */ - err = read_pointer(J, array_data, &code_heap_address); - CHECK_FAIL(err); - - err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_memory + - OFFSET_VirtualSpace_low, &J->Heap_low[i]); - CHECK_FAIL(err); - err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_memory + - OFFSET_VirtualSpace_high, &J->Heap_high[i]); - CHECK_FAIL(err); - err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_segmap + - OFFSET_VirtualSpace_low, &J->Heap_segmap_low[i]); - CHECK_FAIL(err); - err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_segmap + - OFFSET_VirtualSpace_high, &J->Heap_segmap_high[i]); - CHECK_FAIL(err); - - /* Increment pointer to next entry */ - array_data = array_data + POINTER_SIZE; - } - - err = ps_pread(J->P, code_heap_address + OFFSET_CodeHeap_log2_segment_size, - &J->SIZE_CodeCache_log2_segment, sizeof(J->SIZE_CodeCache_log2_segment)); - CHECK_FAIL(err); - - return PS_OK; - - fail: - return err; -} - -static int codeheap_contains(int heap_num, jvm_agent_t* J, uint64_t ptr) { - return (J->Heap_low[heap_num] <= ptr && ptr < J->Heap_high[heap_num]); -} - -static int codecache_contains(jvm_agent_t* J, uint64_t ptr) { - int i; - for (i = 0; i < J->Number_of_heaps; ++i) { - if (codeheap_contains(i, J, ptr)) { - return 1; - } - } - return 0; -} - -static uint64_t segment_for(int heap_num, jvm_agent_t* J, uint64_t p) { - return (p - J->Heap_low[heap_num]) >> J->SIZE_CodeCache_log2_segment; -} - -static uint64_t block_at(int heap_num, jvm_agent_t* J, int i) { - return J->Heap_low[heap_num] + (i << J->SIZE_CodeCache_log2_segment); -} - -static int find_start(jvm_agent_t* J, uint64_t ptr, uint64_t *startp) { - int err; - int i; - - for (i = 0; i < J->Number_of_heaps; ++i) { - *startp = 0; - if (codeheap_contains(i, J, ptr)) { - int32_t used; - uint64_t segment = segment_for(i, J, ptr); - uint64_t block = J->Heap_segmap_low[i]; - uint8_t tag; - err = ps_pread(J->P, block + segment, &tag, sizeof(tag)); - CHECK_FAIL(err); - if (tag == 0xff) - return PS_OK; - while (tag > 0) { - err = ps_pread(J->P, block + segment, &tag, sizeof(tag)); - CHECK_FAIL(err); - segment -= tag; - } - block = block_at(i, J, segment); - err = ps_pread(J->P, block + OFFSET_HeapBlockHeader_used, &used, sizeof(used)); - CHECK_FAIL(err); - if (used) { - *startp = block + SIZE_HeapBlockHeader; - } - } - return PS_OK; - } - - fail: - return -1; -} - -static int find_jlong_constant(jvm_agent_t* J, const char *name, uint64_t* valuep) { - psaddr_t sym_addr; - int err = ps_pglobal_lookup(J->P, LIBJVM_SO, name, &sym_addr); - if (err == PS_OK) { - err = ps_pread(J->P, sym_addr, valuep, sizeof(uint64_t)); - return err; - } - *valuep = -1; - return -1; -} - -jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers) { - jvm_agent_t* J; - int err; - - if (vers != JVM_DB_VERSION) { - errno = ENOTSUP; - return NULL; - } - - J = (jvm_agent_t*)calloc(sizeof(struct jvm_agent), 1); - - debug = getenv("LIBJVMDB_DEBUG") != NULL; - if (debug) debug = 3; - - if (debug) { - fprintf(stderr, "Jagent_create: debug=%d\n", debug); -#ifdef X86_COMPILER2 - fprintf(stderr, "Jagent_create: R_SP=%d, R_FP=%d, POINTER_SIZE=%d\n", R_SP, R_FP, POINTER_SIZE); -#endif /* X86_COMPILER2 */ - } - - J->P = P; - - // Initialize the initial previous frame - - J->prev_fr.fp = 0; - J->prev_fr.pc = 0; - J->prev_fr.sp = 0; - J->prev_fr.sender_sp = 0; - - err = find_symbol(J, "__1cHnmethodG__vtbl_", &J->nmethod_vtbl); - CHECK_FAIL(err); - err = find_symbol(J, "__1cKBufferBlobG__vtbl_", &J->BufferBlob_vtbl); - if (err != PS_OK) J->BufferBlob_vtbl = 0; - err = find_symbol(J, "__1cICodeBlobG__vtbl_", &J->CodeBlob_vtbl); - CHECK_FAIL(err); - err = find_symbol(J, "__1cLRuntimeStubG__vtbl_", &J->RuntimeStub_vtbl); - CHECK_FAIL(err); - err = find_symbol(J, "__1cGMethodG__vtbl_", &J->Method_vtbl); - CHECK_FAIL(err); - - err = parse_vmstructs(J); - CHECK_FAIL(err); - err = read_volatiles(J); - CHECK_FAIL(err); - - return J; - - fail: - Jagent_destroy(J); - return NULL; -} - -void Jagent_destroy(jvm_agent_t *J) { - if (J != NULL) { - free(J); - } -} - -static int is_method(jvm_agent_t* J, uint64_t methodPtr) { - uint64_t klass; - int err = read_pointer(J, methodPtr, &klass); - if (err != PS_OK) goto fail; - return klass == J->Method_vtbl; - - fail: - return 0; -} - -static int -name_for_methodPtr(jvm_agent_t* J, uint64_t methodPtr, char * result, size_t size) -{ - short nameIndex; - short signatureIndex; - uint64_t constantPool; - uint64_t constMethod; - uint64_t nameSymbol; - uint64_t signatureSymbol; - uint64_t klassPtr; - uint64_t klassSymbol; - short klassSymbolLength; - short nameSymbolLength; - short signatureSymbolLength; - char * nameString = NULL; - char * klassString = NULL; - char * signatureString = NULL; - int err; - - err = read_pointer(J, methodPtr + OFFSET_Method_constMethod, &constMethod); - CHECK_FAIL(err); - err = read_pointer(J, constMethod + OFFSET_ConstMethod_constants, &constantPool); - CHECK_FAIL(err); - - /* To get name string */ - err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_name_index, &nameIndex, 2); - CHECK_FAIL(err); - err = read_pointer(J, constantPool + nameIndex * POINTER_SIZE + SIZE_ConstantPool, &nameSymbol); - CHECK_FAIL(err); - // The symbol is a CPSlot and has lower bit set to indicate metadata - nameSymbol &= (~1); // remove metadata lsb - err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_length, &nameSymbolLength, 2); - CHECK_FAIL(err); - nameString = (char*)calloc(nameSymbolLength + 1, 1); - err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_body, nameString, nameSymbolLength); - CHECK_FAIL(err); - - /* To get signature string */ - err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_signature_index, &signatureIndex, 2); - CHECK_FAIL(err); - err = read_pointer(J, constantPool + signatureIndex * POINTER_SIZE + SIZE_ConstantPool, &signatureSymbol); - CHECK_FAIL(err); - signatureSymbol &= (~1); // remove metadata lsb - err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_length, &signatureSymbolLength, 2); - CHECK_FAIL(err); - signatureString = (char*)calloc(signatureSymbolLength + 1, 1); - err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_body, signatureString, signatureSymbolLength); - CHECK_FAIL(err); - - /* To get klass string */ - err = read_pointer(J, constantPool + OFFSET_ConstantPool_pool_holder, &klassPtr); - CHECK_FAIL(err); - err = read_pointer(J, klassPtr + OFFSET_Klass_name, &klassSymbol); - CHECK_FAIL(err); - err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_length, &klassSymbolLength, 2); - CHECK_FAIL(err); - klassString = (char*)calloc(klassSymbolLength + 1, 1); - err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_body, klassString, klassSymbolLength); - CHECK_FAIL(err); - - result[0] = '\0'; - if (snprintf(result, size, - "%s.%s%s", - klassString, - nameString, - signatureString) >= size) { - // truncation - goto fail; - } - - if (nameString != NULL) free(nameString); - if (klassString != NULL) free(klassString); - if (signatureString != NULL) free(signatureString); - - return PS_OK; - - fail: - if (debug) { - fprintf(stderr, "name_for_methodPtr: FAIL \n\n"); - } - if (nameString != NULL) free(nameString); - if (klassString != NULL) free(klassString); - if (signatureString != NULL) free(signatureString); - return -1; -} - -static int nmethod_info(Nmethod_t *N) -{ - jvm_agent_t *J = N->J; - uint64_t nm = N->nm; - int32_t err; - - if (debug > 2 ) - fprintf(stderr, "\t nmethod_info: BEGIN \n"); - - /* Instructions */ - err = read_pointer(J, nm + OFFSET_CodeBlob_code_begin, &N->instrs_beg); - CHECK_FAIL(err); - err = read_pointer(J, nm + OFFSET_CodeBlob_code_end, &N->instrs_end); - CHECK_FAIL(err); - err = read_pointer(J, nm + OFFSET_nmethod_deopt_handler_begin, &N->deopt_beg); - CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_orig_pc_offset, &N->orig_pc_offset, SZ32); - CHECK_FAIL(err); - - /* Metadata */ - err = ps_pread(J->P, nm + OFFSET_nmethod_metadata_offset, &N->metadata_beg, SZ32); - CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->metadata_end, SZ32); - CHECK_FAIL(err); - - /* scopes_pcs */ - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32); - CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32); - CHECK_FAIL(err); - - /* scopes_data */ - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->scopes_data_beg, POINTER_SIZE); - CHECK_FAIL(err); - - if (debug > 2 ) { - N->scopes_data_end = N->scopes_pcs_beg; - - fprintf(stderr, "\t nmethod_info: instrs_beg: %#x, instrs_end: %#x\n", - N->instrs_beg, N->instrs_end); - - fprintf(stderr, "\t nmethod_info: deopt_beg: %#x \n", - N->deopt_beg); - - fprintf(stderr, "\t nmethod_info: orig_pc_offset: %#x \n", - N->orig_pc_offset); - - fprintf(stderr, "\t nmethod_info: metadata_beg: %#x, metadata_end: %#x\n", - N->metadata_beg, N->metadata_end); - - fprintf(stderr, "\t nmethod_info: scopes_data_beg: %#x, scopes_data_end: %#x\n", - N->scopes_data_beg, N->scopes_data_end); - - fprintf(stderr, "\t nmethod_info: scopes_pcs_beg: %#x, scopes_pcs_end: %#x\n", - N->scopes_pcs_beg, N->scopes_pcs_end); - - fprintf(stderr, "\t nmethod_info: END \n\n"); - } - return PS_OK; - - fail: - return err; -} - -static int -raw_read_int(jvm_agent_t* J, uint64_t *buffer, int32_t *val) -{ - int shift = 0; - int value = 0; - uint8_t ch = 0; - int32_t err; - int32_t sum; - // Constants for UNSIGNED5 coding of Pack200 - // see compressedStream.hpp - enum { - lg_H = 6, - H = 1<P, (*buffer)++, &ch, sizeof(uint8_t)); - CHECK_FAIL(err); - if (debug > 2) - fprintf(stderr, "\t\t\t raw_read_int: *buffer: %#llx, ch: %#x\n", *buffer, ch); - - sum = ch; - if ( sum >= L ) { - int32_t lg_H_i = lg_H; - // Read maximum of 5 total bytes (we've already read 1). - // See CompressedReadStream::read_int_mb - for ( i = 0; i < 4; i++) { - err = ps_pread(J->P, (*buffer)++, &ch, sizeof(uint8_t)); - CHECK_FAIL(err); - sum += ch << lg_H_i; - if (ch < L ) { - *val = sum; - return PS_OK; - } - lg_H_i += lg_H; - } - } - *val = sum; - return PS_OK; - - fail: - return err; -} - -static int -read_pair(jvm_agent_t* J, uint64_t *buffer, int32_t *bci, int32_t *line) -{ - uint8_t next = 0; - int32_t bci_delta; - int32_t line_delta; - int32_t err; - - if (debug > 2) - fprintf(stderr, "\t\t read_pair: BEGIN\n"); - - err = ps_pread(J->P, (*buffer)++, &next, sizeof(uint8_t)); - CHECK_FAIL(err); - - if (next == 0) { - if (debug > 2) - fprintf(stderr, "\t\t read_pair: END: next == 0\n"); - return 1; /* stream terminated */ - } - if (next == 0xFF) { - if (debug > 2) - fprintf(stderr, "\t\t read_pair: END: next == 0xFF\n"); - - /* Escape character, regular compression used */ - - err = raw_read_int(J, buffer, &bci_delta); - CHECK_FAIL(err); - - err = raw_read_int(J, buffer, &line_delta); - CHECK_FAIL(err); - - *bci += bci_delta; - *line += line_delta; - - if (debug > 2) { - fprintf(stderr, "\t\t read_pair: delta = (line %d: %d)\n", - line_delta, bci_delta); - fprintf(stderr, "\t\t read_pair: unpack= (line %d: %d)\n", - *line, *bci); - } - } else { - /* Single byte compression used */ - *bci += next >> 3; - *line += next & 0x7; - if (debug > 2) { - fprintf(stderr, "\t\t read_pair: delta = (line %d: %d)\n", - next & 0x7, next >> 3); - fprintf(stderr, "\t\t read_pair: unpack= (line %d: %d)\n", - *line, *bci); - } - } - if (debug > 2) - fprintf(stderr, "\t\t read_pair: END\n"); - return PS_OK; - - fail: - if (debug) - fprintf(stderr, "\t\t read_pair: FAIL\n"); - return err; -} - -static int -line_number_from_bci(jvm_agent_t* J, Vframe_t *vf) -{ - uint64_t buffer; - uint16_t code_size; - uint64_t code_end_delta; - uint64_t constMethod; - int8_t access_flags; - int32_t best_bci = 0; - int32_t stream_bci = 0; - int32_t stream_line = 0; - int32_t err; - - if (debug > 2) { - char name[256]; - err = name_for_methodPtr(J, vf->method, name, 256); - CHECK_FAIL(err); - fprintf(stderr, "\t line_number_from_bci: BEGIN, method name: %s, targ bci: %d\n", - name, vf->bci); - } - - err = read_pointer(J, vf->method + OFFSET_Method_constMethod, &constMethod); - CHECK_FAIL(err); - - vf->line = 0; - err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_flags, &access_flags, sizeof(int8_t)); - CHECK_FAIL(err); - - if (!(access_flags & ConstMethod_has_linenumber_table)) { - if (debug > 2) - fprintf(stderr, "\t line_number_from_bci: END: !HAS_LINE_NUMBER_TABLE \n\n"); - return PS_OK; - } - - /* The line numbers are a short array of 2-tuples [start_pc, line_number]. - * Not necessarily sorted and not necessarily one-to-one. - */ - - err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_code_size, &code_size, SZ16); - CHECK_FAIL(err); - - /* inlined_table_start() */ - code_end_delta = (uint64_t) (access_flags & AccessFlags_NATIVE) ? 2*POINTER_SIZE : 0; - buffer = constMethod + (uint64_t) SIZE_ConstMethod + (uint64_t) code_size + code_end_delta; - - if (debug > 2) { - fprintf(stderr, "\t\t line_number_from_bci: method: %#llx, native: %d\n", - vf->method, (access_flags & AccessFlags_NATIVE)); - fprintf(stderr, "\t\t line_number_from_bci: buffer: %#llx, code_size: %d\n", - buffer, (int) code_size); - } - - while (read_pair(J, &buffer, &stream_bci, &stream_line) == 0) { - if (stream_bci == vf->bci) { - /* perfect match */ - if (debug > 2) - fprintf(stderr, "\t line_number_from_bci: END: exact line: %d \n\n", vf->line); - vf->line = stream_line; - return PS_OK; - } else { - /* update best_bci/line */ - if (stream_bci < vf->bci && stream_bci >= best_bci) { - best_bci = stream_bci; - vf->line = stream_line; - if (debug > 2) { - fprintf(stderr, "\t line_number_from_bci: best_bci: %d, best_line: %d\n", - best_bci, vf->line); - } - } - } - } - if (debug > 2) - fprintf(stderr, "\t line_number_from_bci: END: line: %d \n\n", vf->line); - return PS_OK; - - fail: - if (debug) - fprintf(stderr, "\t line_number_from_bci: FAIL\n"); - return err; -} - -static int -get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc) -{ - int32_t pc_offset; - int32_t err; - - err = ps_pread(N->J->P, pc_desc + OFFSET_PcDesc_pc_offset, &pc_offset, SZ32); - CHECK_FAIL(err); - - *real_pc = N->instrs_beg + pc_offset; - if (debug > 2) { - fprintf(stderr, "\t\t get_real_pc: pc_offset: %lx, real_pc: %llx\n", - pc_offset, *real_pc); - } - return PS_OK; - - fail: - return err; -} - -/* Finds a PcDesc with real-pc equal to N->pc */ -static int pc_desc_at(Nmethod_t *N) -{ - uint64_t pc_diff = 999; - int32_t offs; - int32_t err; - - if (debug > 2) - fprintf(stderr, "\t pc_desc_at: BEGIN\n"); - - N->vf_cnt = 0; - N->pc_desc = 0; - - for (offs = N->scopes_pcs_beg; offs < N->scopes_pcs_end; offs += SIZE_PcDesc) { - uint64_t pd; - uint64_t best_pc_diff = 16; /* some approximation */ - uint64_t real_pc = 0; - - pd = N->nm + offs; - err = get_real_pc(N, pd, &real_pc); - CHECK_FAIL(err); - - pc_diff = real_pc - N->pc; - - /* In general, this fragment should work */ - if (pc_diff == 0) { - N->pc_desc = pd; - if (debug) { - fprintf(stderr, "\t pc_desc_at: END: pc_desc: FOUND: %#lx \n\n", pd); - } - return PS_OK; - } - /* This fragment is to be able to find out an appropriate - * pc_desc entry even if pc_desc info is inaccurate. - */ - if (best_pc_diff > pc_diff && pc_diff > 0) { - best_pc_diff = pc_diff; - N->pc_desc = pd; - } - } - if (debug) { - fprintf(stderr, "\t pc_desc_at: END: pc_desc NOT FOUND"); - if (pc_diff < 20) - fprintf(stderr, ", best pc_diff: %d\n\n", pc_diff); - else - fprintf(stderr, "\n\n"); - } - return PS_OK; - - fail: - return err; -} - -static int -scope_desc_at(Nmethod_t *N, int32_t decode_offset, Vframe_t *vf) -{ - uint64_t buffer; - int32_t err; - - if (debug > 2) { - fprintf(stderr, "\t\t scope_desc_at: BEGIN \n"); - } - - buffer = N->scopes_data_beg + decode_offset; - - err = raw_read_int(N->J, &buffer, &vf->sender_decode_offset); - CHECK_FAIL(err); - - err = raw_read_int(N->J, &buffer, &vf->methodIdx); - CHECK_FAIL(err); - - err = raw_read_int(N->J, &buffer, &vf->bci); - CHECK_FAIL(err); - - if (debug > 2) { - fprintf(stderr, "\t\t scope_desc_at: sender_decode_offset: %#x\n", - vf->sender_decode_offset); - fprintf(stderr, "\t\t scope_desc_at: methodIdx: %d\n", vf->methodIdx); - fprintf(stderr, "\t\t scope_desc_at: bci: %d\n", vf->bci); - - fprintf(stderr, "\t\t scope_desc_at: END \n\n"); - } - return PS_OK; - - fail: - return err; -} - -static int scopeDesc_chain(Nmethod_t *N) { - int32_t decode_offset = 0; - int32_t err; - - if (debug > 2) { - fprintf(stderr, "\t scopeDesc_chain: BEGIN\n"); - } - - err = ps_pread(N->J->P, N->pc_desc + OFFSET_PcDesc_scope_decode_offset, - &decode_offset, SZ32); - CHECK_FAIL(err); - - while (decode_offset > 0) { - Vframe_t *vf = &N->vframes[N->vf_cnt]; - - if (debug > 2) { - fprintf(stderr, "\t scopeDesc_chain: decode_offset: %#x\n", decode_offset); - } - - err = scope_desc_at(N, decode_offset, vf); - CHECK_FAIL(err); - - if (vf->methodIdx > ((N->metadata_end - N->metadata_beg) / POINTER_SIZE)) { - fprintf(stderr, "\t scopeDesc_chain: (methodIdx > metadata length) !\n"); - return -1; - } - err = read_pointer(N->J, N->nm + N->metadata_beg + (vf->methodIdx-1)*POINTER_SIZE, - &vf->method); - CHECK_FAIL(err); - - if (vf->method) { - N->vf_cnt++; - err = line_number_from_bci(N->J, vf); - CHECK_FAIL(err); - if (debug > 2) { - fprintf(stderr, "\t scopeDesc_chain: method: %#8llx, line: %d\n", - vf->method, vf->line); - } - } - decode_offset = vf->sender_decode_offset; - } - if (debug > 2) { - fprintf(stderr, "\t scopeDesc_chain: END \n\n"); - } - return PS_OK; - - fail: - if (debug) { - fprintf(stderr, "\t scopeDesc_chain: FAIL \n\n"); - } - return err; -} - - -static int -name_for_nmethod(jvm_agent_t* J, - uint64_t nm, - uint64_t pc, - uint64_t method, - char *result, - size_t size, - Jframe_t *jframe -) { - Nmethod_t *N; - Vframe_t *vf; - int32_t err; - int deoptimized = 0; - - if (debug) { - fprintf(stderr, "name_for_nmethod: BEGIN: nmethod: %#llx, pc: %#llx\n", nm, pc); - } - if (J->N == NULL) { - J->N = (Nmethod_t *) malloc(sizeof(Nmethod_t)); - } - memset(J->N, 0, sizeof(Nmethod_t)); /* Initial stat: all values are zeros */ - N = J->N; - N->J = J; - N->nm = nm; - N->pc = pc; - N->jframe = jframe; - - err = nmethod_info(N); - CHECK_FAIL(err); - if (debug) { - fprintf(stderr, "name_for_nmethod: pc: %#llx, deopt_pc: %#llx\n", - pc, N->deopt_beg); - } - - /* check for a deoptimized frame */ - if ( pc == N->deopt_beg) { - uint64_t base; - if (debug) { - fprintf(stderr, "name_for_nmethod: found deoptimized frame\n"); - } - if (J->prev_fr.sender_sp != 0) { - base = J->prev_fr.sender_sp + N->orig_pc_offset; - } else { - base = J->curr_fr.sp + N->orig_pc_offset; - } - err = read_pointer(J, base, &N->pc); - CHECK_FAIL(err); - if (debug) { - fprintf(stderr, "name_for_nmethod: found deoptimized frame converting pc from %#8llx to %#8llx\n", - pc, N->pc); - } - deoptimized = 1; - } - - err = pc_desc_at(N); - CHECK_FAIL(err); - - if (N->pc_desc > 0) { - jframe->locinf = 1; - err = scopeDesc_chain(N); - CHECK_FAIL(err); - } - result[0] = COMP_METHOD_SIGN; - vf = &N->vframes[0]; - if (N->vf_cnt > 0) { - jframe->vf_cnt = N->vf_cnt; - jframe->bci = vf->bci; - jframe->line = vf->line; - err = name_for_methodPtr(J, N->vframes[0].method, result+1, size-1); - CHECK_FAIL(err); - } else { - err = name_for_methodPtr(J, method, result+1, size-1); - CHECK_FAIL(err); - } - if (deoptimized) { - strncat(result, " [deoptimized frame]; ", size - strlen(result) - 1); - } else { - strncat(result, " [compiled] ", size - strlen(result) - 1); - } - if (debug) - fprintf(stderr, "name_for_nmethod: END: method name: %s, vf_cnt: %d\n\n", - result, N->vf_cnt); - return PS_OK; - - fail: - if (debug) - fprintf(stderr, "name_for_nmethod: FAIL \n\n"); - return err; -} - -static int -name_for_imethod(jvm_agent_t* J, - uint64_t bcp, - uint64_t method, - char *result, - size_t size, - Jframe_t *jframe -) { - uint64_t bci; - uint64_t constMethod; - Vframe_t vframe = {0}; - Vframe_t *vf = &vframe; - int32_t err; - - err = read_pointer(J, method + OFFSET_Method_constMethod, &constMethod); - CHECK_FAIL(err); - - bci = bcp - (constMethod + (uint64_t) SIZE_ConstMethod); - - if (debug) - fprintf(stderr, "\t name_for_imethod: BEGIN: method: %#llx\n", method); - - err = name_for_methodPtr(J, method, result, size); - CHECK_FAIL(err); - if (debug) - fprintf(stderr, "\t name_for_imethod: method name: %s\n", result); - - if (bci > 0) { - vf->method = method; - vf->bci = bci; - err = line_number_from_bci(J, vf); - CHECK_FAIL(err); - } - jframe->bci = vf->bci; - jframe->line = vf->line; - jframe->locinf = 1; - - if (debug) { - fprintf(stderr, "\t name_for_imethod: END: bci: %d, line: %d\n\n", - vf->bci, vf->line); - } - return PS_OK; - - fail: - if (debug) - fprintf(stderr, "\t name_for_imethod: FAIL\n"); - return err; -} - -static int -name_for_codecache(jvm_agent_t* J, uint64_t fp, uint64_t pc, char * result, - size_t size, Jframe_t *jframe, int* is_interpreted) -{ - uint64_t start; - uint64_t vtbl; - int32_t err; - *is_interpreted = 0; - - result[0] = '\0'; - - err = find_start(J, pc, &start); - CHECK_FAIL(err); - - err = read_pointer(J, start, &vtbl); - CHECK_FAIL(err); - - if (vtbl == J->nmethod_vtbl) { - uint64_t method; - - err = read_pointer(J, start + OFFSET_nmethod_method, &method); - CHECK_FAIL(err); - - if (debug) { - fprintf(stderr, "name_for_codecache: start: %#8llx, pc: %#8llx, method: %#8llx \n", - start, pc, method); - } - err = name_for_nmethod(J, start, pc, method, result, size, jframe); - CHECK_FAIL(err); - } else if (vtbl == J->BufferBlob_vtbl) { - const char * name; - - err = read_string_pointer(J, start + OFFSET_CodeBlob_name, &name); - - /* - * Temporary usage of string "Interpreter". - * We need some other way to distinguish "StubRoutines" - * and regular interpreted frames. - */ - if (err == PS_OK && strncmp(name, "Interpreter", 11) == 0) { - *is_interpreted = 1; - if (is_method(J, J->methodPtr)) { - return name_for_imethod(J, J->bcp, J->methodPtr, result, size, jframe); - } - } - - if (err == PS_OK) { - strncpy(result, name, size); - free((void*)name); - } else { - strncpy(result, "", size); - } - /* return PS_OK; */ - } else { - const char * name; - - err = read_string_pointer(J, start + OFFSET_CodeBlob_name, &name); - if (err == PS_OK) { - strncpy(result, name, size); - free((void*)name); - } else { - strncpy(result, "", size); - WARN1("unknown CodeBlob: vtbl = 0x%x", vtbl); - } - } - result[size-1] = '\0'; - -#ifdef X86_COMPILER2 - if (vtbl != J->RuntimeStub_vtbl) { - uint64_t trial_pc; - int frame_size; - err = ps_pread(J->P, start + OFFSET_CodeBlob_frame_size, - &frame_size, SZ32); - CHECK_FAIL(err); - - // frame_size is in words, we want bytes. - frame_size *= POINTER_SIZE; /* word => byte conversion */ - - /* - Because c2 doesn't use FP as a framepointer the value of sp/fp we receive - in the initial entry to a set of stack frames containing server frames - will pretty much be nonsense. We can detect that nonsense by looking to - see if the PC we received is correct if we look at the expected storage - location in relation to the FP (ie. POINTER_SIZE(FP) ) - */ - - err = read_pointer(J, fp + POINTER_SIZE , &trial_pc); - if ( (err != PS_OK || trial_pc != pc) && frame_size > 0 ) { - // Either we couldn't even read at the "fp" or the pc didn't match - // both are sure clues that the fp is bogus. We no search the stack - // for a reasonable number of words trying to find the bogus fp - // and the current pc in adjacent words. The we will be able to - // deduce an approximation of the frame pointer and actually get - // the correct stack pointer. Which we can then unwind for the - // next frame. - int i; - uint64_t check; - uint64_t base = J->curr_fr.sp; - uint64_t prev_fp = 0; - for ( i = 0; i < frame_size * 5 ; i++, base += POINTER_SIZE ) { - err = read_pointer(J, base , &check); - CHECK_FAIL(err); - if (check == fp) { - base += POINTER_SIZE; - err = read_pointer(J, base , &check); - CHECK_FAIL(err); - if (check == pc) { - if (debug) { - fprintf(stderr, "name_for_codecache: found matching fp/pc combo at 0x%llx\n", base - POINTER_SIZE); - } - prev_fp = base - 2 * POINTER_SIZE; - break; - } - } - } - if ( prev_fp != 0 ) { - // real_sp is the sp we should have received for this frame - uint64_t real_sp = prev_fp + 2 * POINTER_SIZE; - // +POINTER_SIZE because callee owns the return address so caller's sp is +1 word - jframe->new_sp = real_sp + frame_size + POINTER_SIZE; - err = read_pointer(J, jframe->new_sp - POINTER_SIZE , &jframe->new_pc); - CHECK_FAIL(err); - err = read_pointer(J, jframe->new_sp - 2*POINTER_SIZE, &jframe->new_fp); - CHECK_FAIL(err); - return PS_OK; - } - } - - /* A prototype to workaround FP absence */ - /* - * frame_size can be 0 for StubRoutines (1) frame. - * In this case it should work with fp as usual. - */ - if (frame_size > 0) { - jframe->new_fp = J->prev_fr.fp + frame_size; - jframe->new_sp = jframe->new_fp + 2 * POINTER_SIZE; - } else { - memset(&J->curr_fr, 0, sizeof(Frame_t)); - err = read_pointer(J, fp, &jframe->new_fp); - CHECK_FAIL(err); - - err = read_pointer(J, jframe->new_fp + POINTER_SIZE, &jframe->new_pc); - CHECK_FAIL(err); - } - if (debug) { - fprintf(stderr, "name_for_codecache: %s, frame_size=%#lx\n", - result, frame_size); - fprintf(stderr, "name_for_codecache: prev_fr.fp=%#lx, fp=%#lx\n", - J->prev_fr.fp, jframe->new_fp); - } - } -#endif /* X86_COMPILER2 */ - - return PS_OK; - - fail: - return err; -} - -int Jget_vframe(jvm_agent_t* J, int vframe_no, - char *name, size_t size, Jframe_t *jframe) -{ - Nmethod_t *N = J->N; - Vframe_t *vf; - int32_t err; - - if (vframe_no >= N->vf_cnt) { - (void) sprintf(name, "Wrong inlinedMethod%1d()", vframe_no); - return -1; - } - vf = N->vframes + vframe_no; - name[0] = COMP_METHOD_SIGN; - err = name_for_methodPtr(J, vf->method, name + 1, size); - CHECK_FAIL(err); - - jframe->bci = vf->bci; - jframe->line = vf->line; - if (debug) { - fprintf(stderr, "\t Jget_vframe: method name: %s, line: %d\n", - name, vf->line); - } - return PS_OK; - - fail: - if (debug) { - fprintf(stderr, "\t Jget_vframe: FAIL\n"); - } - return err; -} - -#define MAX_SYM_SIZE 256 - -int Jlookup_by_regs(jvm_agent_t* J, const prgregset_t regs, char *name, - size_t size, Jframe_t *jframe) { - uintptr_t fp; - uintptr_t pc; - /* arguments given to read_pointer need to be worst case sized */ - uint64_t methodPtr = 0; - uint64_t sender_sp; - uint64_t bcp = 0; - int is_interpreted = 0; - int result = PS_OK; - int err = PS_OK; - - if (J == NULL) { - return -1; - } - - jframe->vf_cnt = 1; - jframe->new_fp = 0; - jframe->new_pc = 0; - jframe->line = 0; - jframe->bci = 0; - jframe->locinf = 0; - - read_volatiles(J); - pc = (uintptr_t) regs[R_PC]; - J->curr_fr.pc = pc; - J->curr_fr.fp = regs[R_FP]; - J->curr_fr.sp = regs[R_SP]; - - if (debug) - fprintf(stderr, "Jlookup_by_regs: BEGINs: fp=%#lx, pc=%#lx\n", regs[R_FP], pc); - -#if defined(i386) || defined(__i386) || defined(__amd64) - - fp = (uintptr_t) regs[R_FP]; - if (J->prev_fr.fp == 0) { -#ifdef X86_COMPILER2 - /* A workaround for top java frames */ - J->prev_fr.fp = (uintptr_t)(regs[R_SP] - 2 * POINTER_SIZE); -#else - J->prev_fr.fp = (uintptr_t)(regs[R_SP] - POINTER_SIZE); -#endif /* COMPILER2 */ - } - if (debug > 2) { - printf("Jlookup_by_regs: J->prev_fr.fp = %#lx\n", J->prev_fr.fp); - } - - if (read_pointer(J, fp + OFFSET_interpreter_frame_method, &methodPtr) != PS_OK) { - methodPtr = 0; - } - if (read_pointer(J, fp + OFFSET_interpreter_frame_sender_sp, &sender_sp) != PS_OK) { - sender_sp = 0; - } - if (read_pointer(J, fp + OFFSET_interpreter_frame_bcp_offset, &bcp) != PS_OK) { - bcp = 0; - } -#endif /* i386 */ - - J->methodPtr = methodPtr; - J->bcp = bcp; - - /* On x86 with C2 JVM: native frame may have wrong regs[R_FP] - * For example: JVM_SuspendThread frame points to the top interpreted frame. - * If we call is_method(J, methodPtr) before codecache_contains(J, pc) - * then we go over and omit both: nmethod and I2CAdapter frames. - * Note, that regs[R_PC] is always correct if frame defined correctly. - * So it is better to call codecache_contains(J, pc) from the beginning. - */ -#ifndef X86_COMPILER2 - if (is_method(J, J->methodPtr)) { - result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe); - /* If the methodPtr is a method then this is highly likely to be - an interpreter frame */ - if (result >= 0) { - is_interpreted = 1; - } - } else -#endif /* ! X86_COMPILER2 */ - - if (codecache_contains(J, pc)) { - result = name_for_codecache(J, fp, pc, name, size, jframe, &is_interpreted); - } -#ifdef X86_COMPILER2 - else if (is_method(J, J->methodPtr)) { - result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe); - /* If the methodPtr is a method then this is highly likely to be - an interpreter frame */ - if (result >= 0) { - is_interpreted = 1; - } - } -#endif /* X86_COMPILER2 */ - else { - if (debug) { - fprintf(stderr, "Jlookup_by_regs: END with -1\n\n"); - } - result = -1; - } - if (!is_interpreted) { - sender_sp = 0; - } - J->curr_fr.sender_sp = sender_sp; - -#ifdef X86_COMPILER2 - if (!J->curr_fr.fp) { - J->curr_fr.fp = (jframe->new_fp) ? jframe->new_fp : (uintptr_t)regs[R_FP]; - } - if (!jframe->new_pc && jframe->new_fp) { - // This seems dubious - read_pointer(J, jframe->new_fp + POINTER_SIZE, &jframe->new_pc); - CHECK_FAIL(err); - if (debug > 2) { - printf("Jlookup_by_regs: (update pc) jframe->new_fp: %#llx, jframe->new_pc: %#llx\n", - jframe->new_fp, jframe->new_pc); - } - } - -#endif /* X86_COMPILER2 */ - J->prev_fr = J->curr_fr; - - if (debug) - fprintf(stderr, "Jlookup_by_regs: END\n\n"); - - return result; - - fail: - return err; -} - -void update_gregs(prgregset_t gregs, Jframe_t jframe) { -#ifdef X86_COMPILER2 - if (debug > 0) { - fprintf(stderr, "update_gregs: before update sp = 0x%llx, fp = 0x%llx, pc = 0x%llx\n", gregs[R_SP], gregs[R_FP], gregs[R_PC]); - } - /* - * A workaround for java C2 frames with unconventional FP. - * may have to modify regset with new values for FP/PC/SP when needed. - */ - if (jframe.new_sp) { - *((uintptr_t *) &gregs[R_SP]) = (uintptr_t) jframe.new_sp; - } else { - // *((uintptr_t *) &gregs[R_SP]) = (uintptr_t) gregs[R_FP] + 2 * POINTER_SIZE; - } - - if (jframe.new_fp) { - *((uintptr_t *) &gregs[R_FP]) = (uintptr_t) jframe.new_fp; - } - if (jframe.new_pc) { - *((uintptr_t *) &gregs[R_PC]) = (uintptr_t) jframe.new_pc; - } - if (debug > 0) { - fprintf(stderr, "update_gregs: after update sp = 0x%llx, fp = 0x%llx, pc = 0x%llx\n", gregs[R_SP], gregs[R_FP], gregs[R_PC]); - } -#endif /* X86_COMPILER2 */ -} - -/* - * Iterates over java frames at current location given by 'gregs'. - * - * Returns -1 if no java frames are present or if an error is encountered. - * Returns the result of calling 'func' if the return value is non-zero. - * Returns 0 otherwise. - */ -int Jframe_iter(jvm_agent_t *J, prgregset_t gregs, java_stack_f *func, void* cld) { - char buf[MAX_SYM_SIZE + 1]; - Jframe_t jframe; - int i = 0, res; -#ifdef X86_COMPILER2 - if (debug > 0) { - fprintf(stderr, "Jframe_iter: Entry sp = 0x%llx, fp = 0x%llx, pc = 0x%llx\n", gregs[R_SP], gregs[R_FP], gregs[R_PC]); - } -#endif /* X86_COMPILER2 */ - - memset(&jframe, 0, sizeof(Jframe_t)); - memset(buf, 0, sizeof(buf)); - res = Jlookup_by_regs(J, gregs, buf, sizeof(buf), &jframe); - if (res != PS_OK) - return (-1); - - - res = func(cld, gregs, buf, (jframe.locinf)? jframe.bci : -1, - jframe.line, NULL); - if (res != 0) { - update_gregs(gregs, jframe); - return (res); - } - for (i = 1; i < jframe.vf_cnt; i++) { - Jget_vframe(J, i, buf, sizeof(buf), &jframe); - res = func(cld, gregs, buf, (jframe.locinf)? jframe.bci : -1, - jframe.line, NULL); - if (res != 0) { - update_gregs(gregs, jframe); - return (res); - } - } - update_gregs(gregs, jframe); - return (0); -} --- old/src/java.base/solaris/native/libjvm_db/libjvm_db.h 2020-05-20 18:10:26.438101703 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef OS_SOLARIS_DTRACE_LIBJVM_DB_H -#define OS_SOLARIS_DTRACE_LIBJVM_DB_H - -#include -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct jvm_agent jvm_agent_t; - -#define JVM_DB_VERSION 1 - -JNIEXPORT jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers); - -/* - * Called from Jframe_iter() for each java frame. If it returns 0, then - * Jframe_iter() proceeds to the next frame. Otherwise, the return value is - * immediately returned to the caller of Jframe_iter(). - * - * Parameters: - * 'cld' is client supplied data (to maintain iterator state, if any). - * 'name' is java method name. - * 'bci' is byte code index. it will be -1 if not available. - * 'line' is java source line number. it will be 0 if not available. - * 'handle' is an abstract client handle, reserved for future expansions - */ - -typedef int java_stack_f(void *cld, const prgregset_t regs, const char* name, int bci, int line, void *handle); - -/* - * Iterates over the java frames at the current location. Returns -1 if no java - * frames were found, or if there was some unrecoverable error. Otherwise, - * returns the last value returned from 'func'. - */ -JNIEXPORT int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld); - -JNIEXPORT void Jagent_destroy(jvm_agent_t *J); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif // OS_SOLARIS_DTRACE_LIBJVM_DB_H --- old/src/java.base/solaris/native/libnet/solaris_close.c 2020-05-20 18:10:28.690144940 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include -#include "jvm.h" -#include "net_util.h" - -/* Support for restartable system calls on Solaris. */ - -#define RESTARTABLE_RETURN_INT(_cmd) do { \ - int _result; \ - if (1) { \ - do { \ - _result = _cmd; \ - } while((_result == -1) && (errno == EINTR)); \ - return _result; \ - } \ -} while(0) - -int NET_Read(int s, void* buf, size_t len) { - RESTARTABLE_RETURN_INT(recv(s, buf, len, 0)); -} - -int NET_NonBlockingRead(int s, void* buf, size_t len) { - RESTARTABLE_RETURN_INT(recv(s, buf, len, MSG_DONTWAIT)); -} - -int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, - struct sockaddr *from, socklen_t *fromlen) { - RESTARTABLE_RETURN_INT(recvfrom(s, buf, len, flags, from, fromlen)); -} - -int NET_Send(int s, void *msg, int len, unsigned int flags) { - RESTARTABLE_RETURN_INT(send(s, msg, len, flags)); -} - -int NET_SendTo(int s, const void *msg, int len, unsigned int flags, - const struct sockaddr *to, int tolen) { - RESTARTABLE_RETURN_INT(sendto(s, msg, len, flags, to, tolen)); -} - -int NET_Connect(int s, struct sockaddr *addr, int addrlen) { - RESTARTABLE_RETURN_INT(connect(s, addr, addrlen)); -} - -int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) { - RESTARTABLE_RETURN_INT(accept(s, addr, addrlen)); -} - -int NET_SocketClose(int fd) { - return close(fd); -} - -int NET_Dup2(int fd, int fd2) { - return dup2(fd, fd2); -} - -int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - RESTARTABLE_RETURN_INT(poll(ufds, nfds, timeout)); -} - -int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) { - int result; - jlong prevNanoTime = nanoTimeStamp; - jlong nanoTimeout = (jlong) timeout * NET_NSEC_PER_MSEC; - struct pollfd pfd; - pfd.fd = s; - pfd.events = POLLIN; - - for(;;) { - result = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC); - if (result < 0 && errno == EINTR) { - jlong newNanoTime = JVM_NanoTime(env, 0); - nanoTimeout -= newNanoTime - prevNanoTime; - if (nanoTimeout < NET_NSEC_PER_MSEC) - return 0; - prevNanoTime = newNanoTime; - } else { - return result; - } - } -} --- old/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c 2020-05-20 18:10:29.450159532 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include -#include - -#include "jni.h" -#include "jni_util.h" -#include "jvm.h" -#include "jlong.h" -#include "nio.h" -#include "nio_util.h" - -#include "sun_nio_ch_DevPollArrayWrapper.h" - -JNIEXPORT jint JNICALL -Java_sun_nio_ch_DevPollArrayWrapper_init(JNIEnv *env, jobject this) -{ - int wfd = open("/dev/poll", O_RDWR); - if (wfd < 0) { - JNU_ThrowIOExceptionWithLastError(env, "Error opening driver"); - return -1; - } - return wfd; -} - -JNIEXPORT void JNICALL -Java_sun_nio_ch_DevPollArrayWrapper_register(JNIEnv *env, jobject this, - jint wfd, jint fd, jint mask) -{ - struct pollfd a[1]; - int n; - - a[0].fd = fd; - a[0].events = mask; - a[0].revents = 0; - - n = write(wfd, &a[0], sizeof(a)); - if (n != sizeof(a)) { - if (n < 0) { - JNU_ThrowIOExceptionWithLastError(env, "Error writing pollfds"); - } else { - JNU_ThrowIOException(env, "Unexpected number of bytes written"); - } - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple(JNIEnv *env, jobject this, - jint wfd, jlong address, - jint len) -{ - unsigned char *pollBytes = (unsigned char *)jlong_to_ptr(address); - unsigned char *pollEnd = pollBytes + sizeof(struct pollfd) * len; - while (pollBytes < pollEnd) { - int bytesWritten = write(wfd, pollBytes, (int)(pollEnd - pollBytes)); - if (bytesWritten < 0) { - JNU_ThrowIOExceptionWithLastError(env, "Error writing pollfds"); - return; - } - pollBytes += bytesWritten; - } -} - -JNIEXPORT jint JNICALL -Java_sun_nio_ch_DevPollArrayWrapper_poll0(JNIEnv *env, jobject this, - jlong address, jint numfds, - jlong timeout, jint wfd) -{ - struct dvpoll a; - void *pfd = (void *) jlong_to_ptr(address); - int result; - - a.dp_fds = pfd; - a.dp_nfds = numfds; - a.dp_timeout = (int)timeout; - result = ioctl(wfd, DP_POLL, &a); - if (result < 0) { - if (errno == EINTR) { - return IOS_INTERRUPTED; - } else { - JNU_ThrowIOExceptionWithLastError(env, "Error reading driver"); - return IOS_THROWN; - } - } - return result; -} --- old/src/java.base/solaris/native/libnio/ch/SolarisEventPort.c 2020-05-20 18:10:30.154173048 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include - -#include "jni.h" -#include "jni_util.h" -#include "jvm.h" -#include "jlong.h" -#include "nio.h" -#include "nio_util.h" - -#include "sun_nio_ch_SolarisEventPort.h" - -JNIEXPORT jint JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1create - (JNIEnv* env, jclass clazz) -{ - int port = port_create(); - if (port == -1) { - JNU_ThrowIOExceptionWithLastError(env, "port_create"); - } - return (jint)port; -} - -JNIEXPORT void JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1close - (JNIEnv* env, jclass clazz, jint port) -{ - int res = close(port); - if (res < 0 && res != EINTR) { - JNU_ThrowIOExceptionWithLastError(env, "close failed"); - } -} - -JNIEXPORT jboolean JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1associate - (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress, jint events) -{ - uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress); - if (port_associate((int)port, (int)source, object, (int)events, NULL) == 0) { - return JNI_TRUE; - } else { - if (errno != EBADFD) - JNU_ThrowIOExceptionWithLastError(env, "port_associate"); - return JNI_FALSE; - } -} - -JNIEXPORT jboolean JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1dissociate - (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress) -{ - uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress); - - if (port_dissociate((int)port, (int)source, object) == 0) { - return JNI_TRUE; - } else { - if (errno != ENOENT) - JNU_ThrowIOExceptionWithLastError(env, "port_dissociate"); - return JNI_FALSE; - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1send(JNIEnv* env, jclass clazz, - jint port, jint events) -{ - if (port_send((int)port, (int)events, NULL) == -1) { - JNU_ThrowIOExceptionWithLastError(env, "port_send"); - } -} - -JNIEXPORT jint JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1get(JNIEnv* env, jclass clazz, - jint port, jlong eventAddress) -{ - int res; - port_event_t* ev = (port_event_t*)jlong_to_ptr(eventAddress); - - res = port_get((int)port, ev, NULL); - if (res == -1) { - if (errno == EINTR) { - return IOS_INTERRUPTED; - } else { - JNU_ThrowIOExceptionWithLastError(env, "port_get failed"); - return IOS_THROWN; - } - } - return res; -} - -JNIEXPORT jint JNICALL -Java_sun_nio_ch_SolarisEventPort_port_1getn(JNIEnv* env, jclass clazz, - jint port, jlong arrayAddress, jint max, jlong timeout) -{ - int res; - uint_t n = 1; - port_event_t* list = (port_event_t*)jlong_to_ptr(arrayAddress); - timespec_t ts; - timespec_t* tsp; - - if (timeout >= 0L) { - ts.tv_sec = timeout / 1000; - ts.tv_nsec = 1000000 * (timeout % 1000); - tsp = &ts; - } else { - tsp = NULL; - } - - res = port_getn((int)port, list, (uint_t)max, &n, tsp); - if (res == -1 && errno != ETIME) { - if (errno == EINTR) { - return IOS_INTERRUPTED; - } else { - JNU_ThrowIOExceptionWithLastError(env, "port_getn failed"); - return IOS_THROWN; - } - } - - return (jint)n; -} --- old/src/java.base/solaris/native/libnio/fs/SolarisNativeDispatcher.c 2020-05-20 18:10:30.850186411 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" -#include "jni_util.h" -#include "jvm.h" -#include "jlong.h" - -#include -#include -#include -#include -#include - -#include "jni.h" - -#include "sun_nio_fs_SolarisNativeDispatcher.h" - -static jfieldID entry_name; -static jfieldID entry_dir; -static jfieldID entry_fstype; -static jfieldID entry_options; -static jfieldID entry_dev; - -static void throwUnixException(JNIEnv* env, int errnum) { - jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException", - "(I)V", errnum); - if (x != NULL) { - (*env)->Throw(env, x); - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_fs_SolarisNativeDispatcher_init(JNIEnv *env, jclass clazz) { - clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry"); - CHECK_NULL(clazz); - entry_name = (*env)->GetFieldID(env, clazz, "name", "[B"); - CHECK_NULL(entry_name); - entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B"); - CHECK_NULL(entry_dir); - entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B"); - CHECK_NULL(entry_fstype); - entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B"); - CHECK_NULL(entry_options); - entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J"); - CHECK_NULL(entry_dev); -} - -JNIEXPORT jint JNICALL -Java_sun_nio_fs_SolarisNativeDispatcher_facl(JNIEnv* env, jclass this, jint fd, - jint cmd, jint nentries, jlong address) -{ - void* aclbufp = jlong_to_ptr(address); - int n = -1; - - n = facl((int)fd, (int)cmd, (int)nentries, aclbufp); - if (n == -1) { - throwUnixException(env, errno); - } - return (jint)n; -} - -JNIEXPORT jint JNICALL -Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent(JNIEnv* env, jclass this, - jlong value, jobject entry) -{ - struct extmnttab ent; - FILE* fp = jlong_to_ptr(value); - jsize len; - jbyteArray bytes; - char* name; - char* dir; - char* fstype; - char* options; - dev_t dev; - - if (getextmntent(fp, &ent, 0)) - return -1; - name = ent.mnt_special; - dir = ent.mnt_mountp; - fstype = ent.mnt_fstype; - options = ent.mnt_mntopts; - dev = makedev(ent.mnt_major, ent.mnt_minor); - if (dev == NODEV) { - throwUnixException(env, errno); - return -1; - } - - len = strlen(name); - bytes = (*env)->NewByteArray(env, len); - if (bytes == NULL) - return -1; - (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name); - (*env)->SetObjectField(env, entry, entry_name, bytes); - - len = strlen(dir); - bytes = (*env)->NewByteArray(env, len); - if (bytes == NULL) - return -1; - (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir); - (*env)->SetObjectField(env, entry, entry_dir, bytes); - - len = strlen(fstype); - bytes = (*env)->NewByteArray(env, len); - if (bytes == NULL) - return -1; - (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype); - (*env)->SetObjectField(env, entry, entry_fstype, bytes); - - len = strlen(options); - bytes = (*env)->NewByteArray(env, len); - if (bytes == NULL) - return -1; - (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options); - (*env)->SetObjectField(env, entry, entry_options, bytes); - - if (dev != 0) - (*env)->SetLongField(env, entry, entry_dev, (jlong)dev); - - return 0; -} --- old/src/java.base/solaris/native/libnio/fs/SolarisWatchService.c 2020-05-20 18:10:31.586200541 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" -#include "jni_util.h" -#include "jvm.h" -#include "jlong.h" - -#include -#include -#include -#include // Solaris 10 - -#include "sun_nio_fs_SolarisWatchService.h" - -static void throwUnixException(JNIEnv* env, int errnum) { - jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException", - "(I)V", errnum); - if (x != NULL) { - (*env)->Throw(env, x); - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_fs_SolarisWatchService_init(JNIEnv *env, jclass clazz) -{ -} - -JNIEXPORT jint JNICALL -Java_sun_nio_fs_SolarisWatchService_portCreate - (JNIEnv* env, jclass clazz) -{ - int port = port_create(); - if (port == -1) { - throwUnixException(env, errno); - } - return (jint)port; -} - -JNIEXPORT void JNICALL -Java_sun_nio_fs_SolarisWatchService_portAssociate - (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress, jint events) -{ - uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress); - - if (port_associate((int)port, (int)source, object, (int)events, NULL) == -1) { - throwUnixException(env, errno); - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_fs_SolarisWatchService_portDissociate - (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress) -{ - uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress); - - if (port_dissociate((int)port, (int)source, object) == -1) { - throwUnixException(env, errno); - } -} - -JNIEXPORT void JNICALL -Java_sun_nio_fs_SolarisWatchService_portSend(JNIEnv* env, jclass clazz, - jint port, jint events) -{ - if (port_send((int)port, (int)events, NULL) == -1) { - throwUnixException(env, errno); - } -} - -JNIEXPORT jint JNICALL -Java_sun_nio_fs_SolarisWatchService_portGetn(JNIEnv* env, jclass clazz, - jint port, jlong arrayAddress, jint max) -{ - uint_t n = 1; - port_event_t* list = (port_event_t*)jlong_to_ptr(arrayAddress); - - if (port_getn((int)port, list, (uint_t)max, &n, NULL) == -1) { - throwUnixException(env, errno); - } - return (jint)n; -} --- old/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_PCM.c 2020-05-20 18:10:35.046266971 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,627 +0,0 @@ -/* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#define USE_ERROR -#define USE_TRACE - -#include "PLATFORM_API_SolarisOS_Utils.h" -#include "DirectAudio.h" - -#if USE_DAUDIO == TRUE - - -// The default buffer time -#define DEFAULT_PERIOD_TIME_MILLIS 50 - -///// implemented functions of DirectAudio.h - -INT32 DAUDIO_GetDirectAudioDeviceCount() { - return (INT32) getAudioDeviceCount(); -} - - -INT32 DAUDIO_GetDirectAudioDeviceDescription(INT32 mixerIndex, - DirectAudioDeviceDescription* description) { - AudioDeviceDescription desc; - - if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, TRUE)) { - description->maxSimulLines = desc.maxSimulLines; - strncpy(description->name, desc.name, DAUDIO_STRING_LENGTH-1); - description->name[DAUDIO_STRING_LENGTH-1] = 0; - strncpy(description->vendor, desc.vendor, DAUDIO_STRING_LENGTH-1); - description->vendor[DAUDIO_STRING_LENGTH-1] = 0; - strncpy(description->version, desc.version, DAUDIO_STRING_LENGTH-1); - description->version[DAUDIO_STRING_LENGTH-1] = 0; - /*strncpy(description->description, desc.description, DAUDIO_STRING_LENGTH-1);*/ - strncpy(description->description, "Solaris Mixer", DAUDIO_STRING_LENGTH-1); - description->description[DAUDIO_STRING_LENGTH-1] = 0; - return TRUE; - } - return FALSE; - -} - -#define MAX_SAMPLE_RATES 20 - -void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* creator) { - int fd = -1; - AudioDeviceDescription desc; - am_sample_rates_t *sr; - /* hardcoded bits and channels */ - int bits[] = {8, 16}; - int bitsCount = 2; - int channels[] = {1, 2}; - int channelsCount = 2; - /* for querying sample rates */ - int err; - int ch, b; - uint_t s; - - TRACE2("DAUDIO_GetFormats, mixer %d, isSource=%d\n", mixerIndex, isSource); - if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) { - fd = open(desc.pathctl, O_RDONLY); - } - if (fd < 0) { - ERROR1("Couldn't open audio device ctl for device %d!\n", mixerIndex); - return; - } - - /* get sample rates */ - sr = (am_sample_rates_t*) malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(MAX_SAMPLE_RATES)); - if (sr == NULL) { - ERROR1("DAUDIO_GetFormats: out of memory for mixer %d\n", (int) mixerIndex); - close(fd); - return; - } - - sr->num_samp_rates = MAX_SAMPLE_RATES; - sr->type = isSource?AUDIO_PLAY:AUDIO_RECORD; - sr->samp_rates[0] = -2; - err = ioctl(fd, AUDIO_MIXER_GET_SAMPLE_RATES, sr); - if (err < 0) { - ERROR1(" DAUDIO_GetFormats: AUDIO_MIXER_GET_SAMPLE_RATES failed for mixer %d!\n", - (int)mixerIndex); - ERROR2(" -> num_sample_rates=%d sample_rates[0] = %d\n", - (int) sr->num_samp_rates, - (int) sr->samp_rates[0]); - /* Some Solaris 8 drivers fail for get sample rates! - * Do as if we support all sample rates - */ - sr->flags = MIXER_SR_LIMITS; - } - if ((sr->flags & MIXER_SR_LIMITS) - || (sr->num_samp_rates > MAX_SAMPLE_RATES)) { -#ifdef USE_TRACE - if ((sr->flags & MIXER_SR_LIMITS)) { - TRACE1(" DAUDIO_GetFormats: floating sample rate allowed by mixer %d\n", - (int)mixerIndex); - } - if (sr->num_samp_rates > MAX_SAMPLE_RATES) { - TRACE2(" DAUDIO_GetFormats: more than %d formats. Use -1 for sample rates mixer %d\n", - MAX_SAMPLE_RATES, (int)mixerIndex); - } -#endif - /* - * Fake it to have only one sample rate: -1 - */ - sr->num_samp_rates = 1; - sr->samp_rates[0] = -1; - } - close(fd); - - for (ch = 0; ch < channelsCount; ch++) { - for (b = 0; b < bitsCount; b++) { - for (s = 0; s < sr->num_samp_rates; s++) { - DAUDIO_AddAudioFormat(creator, - bits[b], /* significant bits */ - 0, /* frameSize: let it be calculated */ - channels[ch], - (float) ((int) sr->samp_rates[s]), - DAUDIO_PCM, /* encoding - let's only do PCM */ - (bits[b] > 8)?TRUE:TRUE, /* isSigned */ -#ifdef _LITTLE_ENDIAN - FALSE /* little endian */ -#else - (bits[b] > 8)?TRUE:FALSE /* big endian */ -#endif - ); - } - } - } - free(sr); -} - - -typedef struct { - int fd; - audio_info_t info; - int bufferSizeInBytes; - int frameSize; /* storage size in Bytes */ - /* how many bytes were written or read */ - INT32 transferedBytes; - /* if transferedBytes exceed 32-bit boundary, - * it will be reset and positionOffset will receive - * the offset - */ - INT64 positionOffset; -} SolPcmInfo; - - -void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource, - int encoding, float sampleRate, int sampleSizeInBits, - int frameSize, int channels, - int isSigned, int isBigEndian, int bufferSizeInBytes) { - int err = 0; - int openMode; - AudioDeviceDescription desc; - SolPcmInfo* info; - - TRACE0("> DAUDIO_Open\n"); - if (encoding != DAUDIO_PCM) { - ERROR1(" DAUDIO_Open: invalid encoding %d\n", (int) encoding); - return NULL; - } - if (channels <= 0) { - ERROR1(" DAUDIO_Open: Invalid number of channels=%d!\n", channels); - return NULL; - } - - info = (SolPcmInfo*) malloc(sizeof(SolPcmInfo)); - if (!info) { - ERROR0("Out of memory\n"); - return NULL; - } - memset(info, 0, sizeof(SolPcmInfo)); - info->frameSize = frameSize; - info->fd = -1; - - if (isSource) { - openMode = O_WRONLY; - } else { - openMode = O_RDONLY; - } - -#ifndef __linux__ - /* blackdown does not use NONBLOCK */ - openMode |= O_NONBLOCK; -#endif - - if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) { - info->fd = open(desc.path, openMode); - } - if (info->fd < 0) { - ERROR1("Couldn't open audio device for mixer %d!\n", mixerIndex); - free(info); - return NULL; - } - /* set to multiple open */ - if (ioctl(info->fd, AUDIO_MIXER_MULTIPLE_OPEN, NULL) >= 0) { - TRACE1("DAUDIO_Open: %s set to multiple open\n", desc.path); - } else { - ERROR1("DAUDIO_Open: ioctl AUDIO_MIXER_MULTIPLE_OPEN failed on %s!\n", desc.path); - } - - AUDIO_INITINFO(&(info->info)); - /* need AUDIO_GETINFO ioctl to get this to work on solaris x86 */ - err = ioctl(info->fd, AUDIO_GETINFO, &(info->info)); - - /* not valid to call AUDIO_SETINFO ioctl with all the fields from AUDIO_GETINFO. */ - AUDIO_INITINFO(&(info->info)); - - if (isSource) { - info->info.play.sample_rate = sampleRate; - info->info.play.precision = sampleSizeInBits; - info->info.play.channels = channels; - info->info.play.encoding = AUDIO_ENCODING_LINEAR; - info->info.play.buffer_size = bufferSizeInBytes; - info->info.play.pause = 1; - } else { - info->info.record.sample_rate = sampleRate; - info->info.record.precision = sampleSizeInBits; - info->info.record.channels = channels; - info->info.record.encoding = AUDIO_ENCODING_LINEAR; - info->info.record.buffer_size = bufferSizeInBytes; - info->info.record.pause = 1; - } - err = ioctl(info->fd, AUDIO_SETINFO, &(info->info)); - if (err < 0) { - ERROR0("DAUDIO_Open: could not set info!\n"); - DAUDIO_Close((void*) info, isSource); - return NULL; - } - DAUDIO_Flush((void*) info, isSource); - - err = ioctl(info->fd, AUDIO_GETINFO, &(info->info)); - if (err >= 0) { - if (isSource) { - info->bufferSizeInBytes = info->info.play.buffer_size; - } else { - info->bufferSizeInBytes = info->info.record.buffer_size; - } - TRACE2("DAUDIO: buffersize in bytes: requested=%d, got %d\n", - (int) bufferSizeInBytes, - (int) info->bufferSizeInBytes); - } else { - ERROR0("DAUDIO_Open: cannot get info!\n"); - DAUDIO_Close((void*) info, isSource); - return NULL; - } - TRACE0("< DAUDIO_Open: Opened device successfully.\n"); - return (void*) info; -} - - -int DAUDIO_Start(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - int err, modified; - audio_info_t audioInfo; - - TRACE0("> DAUDIO_Start\n"); - - AUDIO_INITINFO(&audioInfo); - err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo); - if (err >= 0) { - // unpause - modified = FALSE; - if (isSource && audioInfo.play.pause) { - audioInfo.play.pause = 0; - modified = TRUE; - } - if (!isSource && audioInfo.record.pause) { - audioInfo.record.pause = 0; - modified = TRUE; - } - if (modified) { - err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo); - } - } - - TRACE1("< DAUDIO_Start %s\n", (err>=0)?"success":"error"); - return (err >= 0)?TRUE:FALSE; -} - -int DAUDIO_Stop(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - int err, modified; - audio_info_t audioInfo; - - TRACE0("> DAUDIO_Stop\n"); - - AUDIO_INITINFO(&audioInfo); - err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo); - if (err >= 0) { - // pause - modified = FALSE; - if (isSource && !audioInfo.play.pause) { - audioInfo.play.pause = 1; - modified = TRUE; - } - if (!isSource && !audioInfo.record.pause) { - audioInfo.record.pause = 1; - modified = TRUE; - } - if (modified) { - err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo); - } - } - - TRACE1("< DAUDIO_Stop %s\n", (err>=0)?"success":"error"); - return (err >= 0)?TRUE:FALSE; -} - -void DAUDIO_Close(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - - TRACE0("DAUDIO_Close\n"); - if (info != NULL) { - if (info->fd >= 0) { - DAUDIO_Flush(id, isSource); - close(info->fd); - } - free(info); - } -} - -#ifndef USE_TRACE -/* close to 2^31 */ -#define POSITION_MAX 2000000000 -#else -/* for testing */ -#define POSITION_MAX 1000000 -#endif - -void resetErrorFlagAndAdjustPosition(SolPcmInfo* info, int isSource, int count) { - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - int err; - int offset = -1; - int underrun = FALSE; - int devBytes = 0; - - if (count > 0) { - info->transferedBytes += count; - - if (isSource) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - AUDIO_INITINFO(&audioInfo); - err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo); - if (err >= 0) { - underrun = prinfo->error; - devBytes = prinfo->samples * info->frameSize; - } - AUDIO_INITINFO(&audioInfo); - if (underrun) { - /* if an underrun occurred, reset */ - ERROR1("DAUDIO_Write/Read: Underrun/overflow: adjusting positionOffset by %d:\n", - (devBytes - info->transferedBytes)); - ERROR1(" devBytes from %d to 0, ", devBytes); - ERROR2(" positionOffset from %d to %d ", - (int) info->positionOffset, - (int) (info->positionOffset + info->transferedBytes)); - ERROR1(" transferedBytes from %d to 0\n", - (int) info->transferedBytes); - prinfo->samples = 0; - info->positionOffset += info->transferedBytes; - info->transferedBytes = 0; - } - else if (info->transferedBytes > POSITION_MAX) { - /* we will reset transferedBytes and - * the samples field in prinfo - */ - offset = devBytes; - prinfo->samples = 0; - } - /* reset error flag */ - prinfo->error = 0; - - err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo); - if (err >= 0) { - if (offset > 0) { - /* upon exit of AUDIO_SETINFO, the samples parameter - * was set to the previous value. This is our - * offset. - */ - TRACE1("Adjust samplePos: offset=%d, ", (int) offset); - TRACE2("transferedBytes=%d -> %d, ", - (int) info->transferedBytes, - (int) (info->transferedBytes - offset)); - TRACE2("positionOffset=%d -> %d\n", - (int) (info->positionOffset), - (int) (((int) info->positionOffset) + offset)); - info->transferedBytes -= offset; - info->positionOffset += offset; - } - } else { - ERROR0("DAUDIO: resetErrorFlagAndAdjustPosition ioctl failed!\n"); - } - } -} - -// returns -1 on error -int DAUDIO_Write(void* id, char* data, int byteSize) { - SolPcmInfo* info = (SolPcmInfo*) id; - int ret = -1; - - TRACE1("> DAUDIO_Write %d bytes\n", byteSize); - if (info!=NULL) { - ret = write(info->fd, data, byteSize); - resetErrorFlagAndAdjustPosition(info, TRUE, ret); - /* sets ret to -1 if buffer full, no error! */ - if (ret < 0) { - ret = 0; - } - } - TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret); - return ret; -} - -// returns -1 on error -int DAUDIO_Read(void* id, char* data, int byteSize) { - SolPcmInfo* info = (SolPcmInfo*) id; - int ret = -1; - - TRACE1("> DAUDIO_Read %d bytes\n", byteSize); - if (info != NULL) { - ret = read(info->fd, data, byteSize); - resetErrorFlagAndAdjustPosition(info, TRUE, ret); - /* sets ret to -1 if buffer full, no error! */ - if (ret < 0) { - ret = 0; - } - } - TRACE1("< DAUDIO_Read: returning %d bytes.\n", ret); - return ret; -} - - -int DAUDIO_GetBufferSize(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - if (info) { - return info->bufferSizeInBytes; - } - return 0; -} - -int DAUDIO_StillDraining(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - int ret = FALSE; - - if (info!=NULL) { - if (isSource) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - /* check error flag */ - AUDIO_INITINFO(&audioInfo); - ioctl(info->fd, AUDIO_GETINFO, &audioInfo); - ret = (prinfo->error != 0)?FALSE:TRUE; - } - return ret; -} - - -int getDevicePosition(SolPcmInfo* info, int isSource) { - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - int err; - - if (isSource) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - AUDIO_INITINFO(&audioInfo); - err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo); - if (err >= 0) { - /*TRACE2("---> device paused: %d eof=%d\n", - prinfo->pause, prinfo->eof); - */ - return (int) (prinfo->samples * info->frameSize); - } - ERROR0("DAUDIO: getDevicePosition: ioctl failed!\n"); - return -1; -} - -int DAUDIO_Flush(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - int err = -1; - int pos; - - TRACE0("DAUDIO_Flush\n"); - if (info) { - if (isSource) { - err = ioctl(info->fd, I_FLUSH, FLUSHW); - } else { - err = ioctl(info->fd, I_FLUSH, FLUSHR); - } - if (err >= 0) { - /* resets the transferedBytes parameter to - * the current samples count of the device - */ - pos = getDevicePosition(info, isSource); - if (pos >= 0) { - info->transferedBytes = pos; - } - } - } - if (err < 0) { - ERROR0("ERROR in DAUDIO_Flush\n"); - } - return (err < 0)?FALSE:TRUE; -} - -int DAUDIO_GetAvailable(void* id, int isSource) { - SolPcmInfo* info = (SolPcmInfo*) id; - int ret = 0; - int pos; - - if (info) { - /* unfortunately, the STREAMS architecture - * seems to not have a method for querying - * the available bytes to read/write! - * estimate it... - */ - pos = getDevicePosition(info, isSource); - if (pos >= 0) { - if (isSource) { - /* we usually have written more bytes - * to the queue than the device position should be - */ - ret = (info->bufferSizeInBytes) - (info->transferedBytes - pos); - } else { - /* for record, the device stream should - * be usually ahead of our read actions - */ - ret = pos - info->transferedBytes; - } - if (ret > info->bufferSizeInBytes) { - ERROR2("DAUDIO_GetAvailable: available=%d, too big at bufferSize=%d!\n", - (int) ret, (int) info->bufferSizeInBytes); - ERROR2(" devicePos=%d, transferedBytes=%d\n", - (int) pos, (int) info->transferedBytes); - ret = info->bufferSizeInBytes; - } - else if (ret < 0) { - ERROR1("DAUDIO_GetAvailable: available=%d, in theory not possible!\n", - (int) ret); - ERROR2(" devicePos=%d, transferedBytes=%d\n", - (int) pos, (int) info->transferedBytes); - ret = 0; - } - } - } - - TRACE1("DAUDIO_GetAvailable returns %d bytes\n", ret); - return ret; -} - -INT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos) { - SolPcmInfo* info = (SolPcmInfo*) id; - int ret; - int pos; - INT64 result = javaBytePos; - - if (info) { - pos = getDevicePosition(info, isSource); - if (pos >= 0) { - result = info->positionOffset + pos; - } - } - - //printf("getbyteposition: javaBytePos=%d , return=%d\n", (int) javaBytePos, (int) result); - return result; -} - - -void DAUDIO_SetBytePosition(void* id, int isSource, INT64 javaBytePos) { - SolPcmInfo* info = (SolPcmInfo*) id; - int ret; - int pos; - - if (info) { - pos = getDevicePosition(info, isSource); - if (pos >= 0) { - info->positionOffset = javaBytePos - pos; - } - } -} - -int DAUDIO_RequiresServicing(void* id, int isSource) { - // never need servicing on Solaris - return FALSE; -} - -void DAUDIO_Service(void* id, int isSource) { - // never need servicing on Solaris -} - - -#endif // USE_DAUDIO --- old/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Ports.c 2020-05-20 18:10:35.750280487 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,579 +0,0 @@ -/* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#define USE_ERROR -//#define USE_TRACE - -#include "Ports.h" -#include "PLATFORM_API_SolarisOS_Utils.h" - -#if USE_PORTS == TRUE - -#define MONITOR_GAIN_STRING "Monitor Gain" - -#define ALL_TARGET_PORT_COUNT 6 - -// Solaris audio defines -static int targetPorts[ALL_TARGET_PORT_COUNT] = { - AUDIO_SPEAKER, - AUDIO_HEADPHONE, - AUDIO_LINE_OUT, - AUDIO_AUX1_OUT, - AUDIO_AUX2_OUT, - AUDIO_SPDIF_OUT -}; - -static char* targetPortNames[ALL_TARGET_PORT_COUNT] = { - "Speaker", - "Headphone", - "Line Out", - "AUX1 Out", - "AUX2 Out", - "SPDIF Out" -}; - -// defined in Ports.h -static int targetPortJavaSoundMapping[ALL_TARGET_PORT_COUNT] = { - PORT_DST_SPEAKER, - PORT_DST_HEADPHONE, - PORT_DST_LINE_OUT, - PORT_DST_UNKNOWN, - PORT_DST_UNKNOWN, - PORT_DST_UNKNOWN, -}; - -#define ALL_SOURCE_PORT_COUNT 7 - -// Solaris audio defines -static int sourcePorts[ALL_SOURCE_PORT_COUNT] = { - AUDIO_MICROPHONE, - AUDIO_LINE_IN, - AUDIO_CD, - AUDIO_AUX1_IN, - AUDIO_AUX2_IN, - AUDIO_SPDIF_IN, - AUDIO_CODEC_LOOPB_IN -}; - -static char* sourcePortNames[ALL_SOURCE_PORT_COUNT] = { - "Microphone In", - "Line In", - "Compact Disc In", - "AUX1 In", - "AUX2 In", - "SPDIF In", - "Internal Loopback" -}; - -// Ports.h defines -static int sourcePortJavaSoundMapping[ALL_SOURCE_PORT_COUNT] = { - PORT_SRC_MICROPHONE, - PORT_SRC_LINE_IN, - PORT_SRC_COMPACT_DISC, - PORT_SRC_UNKNOWN, - PORT_SRC_UNKNOWN, - PORT_SRC_UNKNOWN, - PORT_SRC_UNKNOWN -}; - -struct tag_PortControlID; - -typedef struct tag_PortInfo { - int fd; // file descriptor of the pseudo device - audio_info_t audioInfo; - // ports - int targetPortCount; - int sourcePortCount; - // indexes to sourcePorts/targetPorts - // contains first target ports, then source ports - int ports[ALL_TARGET_PORT_COUNT + ALL_SOURCE_PORT_COUNT]; - // controls - int maxControlCount; // upper bound of number of controls - int usedControlIDs; // number of items already filled in controlIDs - struct tag_PortControlID* controlIDs; // the control IDs themselves -} PortInfo; - -#define PORT_CONTROL_TYPE_PLAY 0x4000000 -#define PORT_CONTROL_TYPE_RECORD 0x8000000 -#define PORT_CONTROL_TYPE_SELECT_PORT 1 -#define PORT_CONTROL_TYPE_GAIN 2 -#define PORT_CONTROL_TYPE_BALANCE 3 -#define PORT_CONTROL_TYPE_MONITOR_GAIN 10 -#define PORT_CONTROL_TYPE_OUTPUT_MUTED 11 -#define PORT_CONTROL_TYPE_PLAYRECORD_MASK PORT_CONTROL_TYPE_PLAY | PORT_CONTROL_TYPE_RECORD -#define PORT_CONTROL_TYPE_MASK 0xFFFFFF - - -typedef struct tag_PortControlID { - PortInfo* portInfo; - INT32 controlType; // PORT_CONTROL_TYPE_XX - uint_t port; -} PortControlID; - - -///// implemented functions of Ports.h - -INT32 PORT_GetPortMixerCount() { - return (INT32) getAudioDeviceCount(); -} - - -INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) { - AudioDeviceDescription desc; - - if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, TRUE)) { - strncpy(description->name, desc.name, PORT_STRING_LENGTH-1); - description->name[PORT_STRING_LENGTH-1] = 0; - strncpy(description->vendor, desc.vendor, PORT_STRING_LENGTH-1); - description->vendor[PORT_STRING_LENGTH-1] = 0; - strncpy(description->version, desc.version, PORT_STRING_LENGTH-1); - description->version[PORT_STRING_LENGTH-1] = 0; - /*strncpy(description->description, desc.description, PORT_STRING_LENGTH-1);*/ - strncpy(description->description, "Solaris Ports", PORT_STRING_LENGTH-1); - description->description[PORT_STRING_LENGTH-1] = 0; - return TRUE; - } - return FALSE; -} - - -void* PORT_Open(INT32 mixerIndex) { - PortInfo* info = NULL; - int fd = -1; - AudioDeviceDescription desc; - int success = FALSE; - - TRACE0("PORT_Open\n"); - if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) { - fd = open(desc.pathctl, O_RDWR); - } - if (fd < 0) { - ERROR1("Couldn't open audio device ctl for device %d!\n", mixerIndex); - return NULL; - } - - info = (PortInfo*) malloc(sizeof(PortInfo)); - if (info != NULL) { - memset(info, 0, sizeof(PortInfo)); - info->fd = fd; - success = TRUE; - } - if (!success) { - if (fd >= 0) { - close(fd); - } - PORT_Close((void*) info); - info = NULL; - } - return info; -} - -void PORT_Close(void* id) { - TRACE0("PORT_Close\n"); - if (id != NULL) { - PortInfo* info = (PortInfo*) id; - if (info->fd >= 0) { - close(info->fd); - info->fd = -1; - } - if (info->controlIDs) { - free(info->controlIDs); - info->controlIDs = NULL; - } - free(info); - } -} - - - -INT32 PORT_GetPortCount(void* id) { - int ret = 0; - PortInfo* info = (PortInfo*) id; - if (info != NULL) { - if (!info->targetPortCount && !info->sourcePortCount) { - int i; - AUDIO_INITINFO(&info->audioInfo); - if (ioctl(info->fd, AUDIO_GETINFO, &info->audioInfo) >= 0) { - for (i = 0; i < ALL_TARGET_PORT_COUNT; i++) { - if (info->audioInfo.play.avail_ports & targetPorts[i]) { - info->ports[info->targetPortCount] = i; - info->targetPortCount++; - } - TRACE4("Target %d %s: avail=%d mod=%d\n", i, targetPortNames[i], - info->audioInfo.play.avail_ports & targetPorts[i], - info->audioInfo.play.mod_ports & targetPorts[i]); - } - for (i = 0; i < ALL_SOURCE_PORT_COUNT; i++) { - if (info->audioInfo.record.avail_ports & sourcePorts[i]) { - info->ports[info->targetPortCount + info->sourcePortCount] = i; - info->sourcePortCount++; - } - TRACE4("Source %d %s: avail=%d mod=%d\n", i, sourcePortNames[i], - info->audioInfo.record.avail_ports & sourcePorts[i], - info->audioInfo.record.mod_ports & sourcePorts[i]); - } - } - } - ret = info->targetPortCount + info->sourcePortCount; - } - return ret; -} - -int isSourcePort(PortInfo* info, INT32 portIndex) { - return (portIndex >= info->targetPortCount); -} - -INT32 PORT_GetPortType(void* id, INT32 portIndex) { - PortInfo* info = (PortInfo*) id; - if ((portIndex >= 0) && (portIndex < PORT_GetPortCount(id))) { - if (isSourcePort(info, portIndex)) { - return sourcePortJavaSoundMapping[info->ports[portIndex]]; - } else { - return targetPortJavaSoundMapping[info->ports[portIndex]]; - } - } - return 0; -} - -// pre-condition: portIndex must have been verified! -char* getPortName(PortInfo* info, INT32 portIndex) { - char* ret = NULL; - - if (isSourcePort(info, portIndex)) { - ret = sourcePortNames[info->ports[portIndex]]; - } else { - ret = targetPortNames[info->ports[portIndex]]; - } - return ret; -} - -INT32 PORT_GetPortName(void* id, INT32 portIndex, char* name, INT32 len) { - PortInfo* info = (PortInfo*) id; - char* n; - - if ((portIndex >= 0) && (portIndex < PORT_GetPortCount(id))) { - n = getPortName(info, portIndex); - if (n) { - strncpy(name, n, len-1); - name[len-1] = 0; - return TRUE; - } - } - return FALSE; -} - -void createPortControl(PortInfo* info, PortControlCreator* creator, INT32 portIndex, - INT32 type, void** controlObjects, int* controlCount) { - PortControlID* controlID; - void* newControl = NULL; - int controlIndex; - char* jsType = NULL; - int isBoolean = FALSE; - - TRACE0(">createPortControl\n"); - - // fill the ControlID structure and add this control - if (info->usedControlIDs >= info->maxControlCount) { - ERROR1("not enough free controlIDs !! maxControlIDs = %d\n", info->maxControlCount); - return; - } - controlID = &(info->controlIDs[info->usedControlIDs]); - controlID->portInfo = info; - controlID->controlType = type; - controlIndex = info->ports[portIndex]; - if (isSourcePort(info, portIndex)) { - controlID->port = sourcePorts[controlIndex]; - } else { - controlID->port = targetPorts[controlIndex]; - } - switch (type & PORT_CONTROL_TYPE_MASK) { - case PORT_CONTROL_TYPE_SELECT_PORT: - jsType = CONTROL_TYPE_SELECT; isBoolean = TRUE; break; - case PORT_CONTROL_TYPE_GAIN: - jsType = CONTROL_TYPE_VOLUME; break; - case PORT_CONTROL_TYPE_BALANCE: - jsType = CONTROL_TYPE_BALANCE; break; - case PORT_CONTROL_TYPE_MONITOR_GAIN: - jsType = CONTROL_TYPE_VOLUME; break; - case PORT_CONTROL_TYPE_OUTPUT_MUTED: - jsType = CONTROL_TYPE_MUTE; isBoolean = TRUE; break; - } - if (isBoolean) { - TRACE0(" PORT_CONTROL_TYPE_BOOLEAN\n"); - newControl = (creator->newBooleanControl)(creator, controlID, jsType); - } - else if (jsType == CONTROL_TYPE_BALANCE) { - TRACE0(" PORT_CONTROL_TYPE_BALANCE\n"); - newControl = (creator->newFloatControl)(creator, controlID, jsType, - -1.0f, 1.0f, 2.0f / 65.0f, ""); - } else { - TRACE0(" PORT_CONTROL_TYPE_FLOAT\n"); - newControl = (creator->newFloatControl)(creator, controlID, jsType, - 0.0f, 1.0f, 1.0f / 256.0f, ""); - } - if (newControl) { - controlObjects[*controlCount] = newControl; - (*controlCount)++; - info->usedControlIDs++; - } - TRACE0("addCompoundControl %d controls\n", *controlCount); - if (*controlCount) { - // create compound control and add it to the vector - compControl = (creator->newCompoundControl)(creator, name, controlObjects, *controlCount); - if (compControl) { - TRACE1(" addCompoundControl: calling addControl %p\n", compControl); - (creator->addControl)(creator, compControl); - } - *controlCount = 0; - } - TRACE0("addAllControl\n"); - // go through all controls and add them to the vector - for (i = 0; i < *controlCount; i++) { - (creator->addControl)(creator, controlObjects[i]); - } - *controlCount = 0; - TRACE0("PORT_GetControls(id=%p, portIndex=%d). controlIDs=%p, maxControlCount=%d\n", - id, portIndex, info->controlIDs, info->maxControlCount); - if ((portIndex >= 0) && (portIndex < portCount)) { - // if the memory isn't reserved for the control structures, allocate it - if (!info->controlIDs) { - int maxCount = 0; - TRACE0("getControl: allocate mem\n"); - // get a maximum number of controls: - // each port has a select, balance, and volume control. - maxCount = 3 * portCount; - // then there is monitorGain and outputMuted - maxCount += (2 * info->targetPortCount); - info->maxControlCount = maxCount; - info->controlIDs = (PortControlID*) malloc(sizeof(PortControlID) * maxCount); - } - if (!isSourcePort(info, portIndex)) { - type = PORT_CONTROL_TYPE_PLAY; - // add master mute control - createPortControl(info, creator, portIndex, - type | PORT_CONTROL_TYPE_OUTPUT_MUTED, - controls, &controlCount); - addAllControls(info, creator, controls, &controlCount); - selectable = info->audioInfo.play.mod_ports & targetPorts[info->ports[portIndex]]; - } else { - type = PORT_CONTROL_TYPE_RECORD; - selectable = info->audioInfo.record.mod_ports & sourcePorts[info->ports[portIndex]]; - } - // add a mixer strip with volume, ... - createPortControl(info, creator, portIndex, - type | PORT_CONTROL_TYPE_GAIN, - controls, &controlCount); - // ... balance, ... - createPortControl(info, creator, portIndex, - type | PORT_CONTROL_TYPE_BALANCE, - controls, &controlCount); - // ... and select control (if not always on)... - if (selectable) { - createPortControl(info, creator, portIndex, - type | PORT_CONTROL_TYPE_SELECT_PORT, - controls, &controlCount); - } - // ... packaged in a compound control. - addCompoundControl(info, creator, getPortName(info, portIndex), controls, &controlCount); - - if (type == PORT_CONTROL_TYPE_PLAY) { - // add a single strip for source ports with monitor gain - createPortControl(info, creator, portIndex, - type | PORT_CONTROL_TYPE_MONITOR_GAIN, - controls, &controlCount); - // also in a compound control - addCompoundControl(info, creator, MONITOR_GAIN_STRING, controls, &controlCount); - } - } - TRACE0("< PORT_getControls\n"); -} - -INT32 PORT_GetIntValue(void* controlIDV) { - PortControlID* controlID = (PortControlID*) controlIDV; - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - - AUDIO_INITINFO(&audioInfo); - if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) { - if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) { - case PORT_CONTROL_TYPE_SELECT_PORT: - return (prinfo->port & controlID->port)?TRUE:FALSE; - case PORT_CONTROL_TYPE_OUTPUT_MUTED: - return (audioInfo.output_muted)?TRUE:FALSE; - default: - ERROR1("PORT_GetIntValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK); - } - } - ERROR0("PORT_GetIntValue: Could not ioctl!\n"); - return 0; -} - -void PORT_SetIntValue(void* controlIDV, INT32 value) { - PortControlID* controlID = (PortControlID*) controlIDV; - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - int setPort; - - if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) { - case PORT_CONTROL_TYPE_SELECT_PORT: - // first try to just add this port. if that fails, set ONLY to this port. - AUDIO_INITINFO(&audioInfo); - if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) { - if (value) { - setPort = (prinfo->port | controlID->port); - } else { - setPort = (prinfo->port - controlID->port); - } - AUDIO_INITINFO(&audioInfo); - prinfo->port = setPort; - if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) { - // didn't work. Either this line doesn't support to select several - // ports at once (e.g. record), or a real error - if (value) { - // set to ONLY this port (and disable any other currently selected ports) - AUDIO_INITINFO(&audioInfo); - prinfo->port = controlID->port; - if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) { - ERROR2("Error setting output select port %d to port %d!\n", controlID->port, controlID->port); - } - } else { - // assume it's an error - ERROR2("Error setting output select port %d to port %d!\n", controlID->port, setPort); - } - } - break; - case PORT_CONTROL_TYPE_OUTPUT_MUTED: - AUDIO_INITINFO(&audioInfo); - audioInfo.output_muted = (value?TRUE:FALSE); - if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) { - ERROR2("Error setting output muted on port %d to %d!\n", controlID->port, value); - } - break; - default: - ERROR1("PORT_SetIntValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK); - } - } -} - -float PORT_GetFloatValue(void* controlIDV) { - PortControlID* controlID = (PortControlID*) controlIDV; - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - - AUDIO_INITINFO(&audioInfo); - if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) { - if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) { - case PORT_CONTROL_TYPE_GAIN: - return ((float) (prinfo->gain - AUDIO_MIN_GAIN)) - / ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN)); - case PORT_CONTROL_TYPE_BALANCE: - return ((float) ((prinfo->balance - AUDIO_LEFT_BALANCE - AUDIO_MID_BALANCE) << 1)) - / ((float) (AUDIO_RIGHT_BALANCE - AUDIO_LEFT_BALANCE)); - case PORT_CONTROL_TYPE_MONITOR_GAIN: - return ((float) (audioInfo.monitor_gain - AUDIO_MIN_GAIN)) - / ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN)); - default: - ERROR1("PORT_GetFloatValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK); - } - } - ERROR0("PORT_GetFloatValue: Could not ioctl!\n"); - return 0.0f; -} - -void PORT_SetFloatValue(void* controlIDV, float value) { - PortControlID* controlID = (PortControlID*) controlIDV; - audio_info_t audioInfo; - audio_prinfo_t* prinfo; - - AUDIO_INITINFO(&audioInfo); - - if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) { - prinfo = &(audioInfo.play); - } else { - prinfo = &(audioInfo.record); - } - switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) { - case PORT_CONTROL_TYPE_GAIN: - prinfo->gain = AUDIO_MIN_GAIN - + (int) ((value * ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN))) + 0.5f); - break; - case PORT_CONTROL_TYPE_BALANCE: - prinfo->balance = AUDIO_LEFT_BALANCE + AUDIO_MID_BALANCE - + ((int) (value * ((float) ((AUDIO_RIGHT_BALANCE - AUDIO_LEFT_BALANCE) >> 1))) + 0.5f); - break; - case PORT_CONTROL_TYPE_MONITOR_GAIN: - audioInfo.monitor_gain = AUDIO_MIN_GAIN - + (int) ((value * ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN))) + 0.5f); - break; - default: - ERROR1("PORT_SetFloatValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK); - return; - } - if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) { - ERROR0("PORT_SetFloatValue: Could not ioctl!\n"); - } -} - -#endif // USE_PORTS --- old/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.c 2020-05-20 18:10:36.498294848 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#define USE_ERROR -#define USE_TRACE - -#include "PLATFORM_API_SolarisOS_Utils.h" - -#define MAX_AUDIO_DEVICES 20 - -// not thread safe... -static AudioDevicePath globalADPaths[MAX_AUDIO_DEVICES]; -static int globalADCount = -1; -static int globalADCacheTime = -1; -/* how many seconds do we cache devices */ -#define AD_CACHE_TIME 30 - -// return seconds -long getTimeInSeconds() { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec; -} - - -int getAudioDeviceCount() { - int count = MAX_AUDIO_DEVICES; - - getAudioDevices(globalADPaths, &count); - return count; -} - -/* returns TRUE if the path exists at all */ -int addAudioDevice(char* path, AudioDevicePath* adPath, int* count) { - int i; - int found = 0; - int fileExists = 0; - // not thread safe... - static struct stat statBuf; - - // get stats on the file - if (stat(path, &statBuf) == 0) { - // file exists. - fileExists = 1; - // If it is not yet in the adPath array, add it to the array - for (i = 0; i < *count; i++) { - if (adPath[i].st_ino == statBuf.st_ino - && adPath[i].st_dev == statBuf.st_dev) { - found = 1; - break; - } - } - if (!found) { - adPath[*count].st_ino = statBuf.st_ino; - adPath[*count].st_dev = statBuf.st_dev; - strncpy(adPath[*count].path, path, MAX_NAME_LENGTH); - adPath[*count].path[MAX_NAME_LENGTH - 1] = 0; - (*count)++; - TRACE1("Added audio device %s\n", path); - } - } - return fileExists; -} - - -void getAudioDevices(AudioDevicePath* adPath, int* count) { - int maxCount = *count; - char* audiodev; - char devsound[15]; - int i; - long timeInSeconds = getTimeInSeconds(); - - if (globalADCount < 0 - || (getTimeInSeconds() - globalADCacheTime) > AD_CACHE_TIME - || (adPath != globalADPaths)) { - *count = 0; - // first device, if set, is AUDIODEV variable - audiodev = getenv("AUDIODEV"); - if (audiodev != NULL && audiodev[0] != 0) { - addAudioDevice(audiodev, adPath, count); - } - // then try /dev/audio - addAudioDevice("/dev/audio", adPath, count); - // then go through all of the /dev/sound/? devices - for (i = 0; i < 100; i++) { - sprintf(devsound, "/dev/sound/%d", i); - if (!addAudioDevice(devsound, adPath, count)) { - break; - } - } - if (adPath == globalADPaths) { - /* commit cache */ - globalADCount = *count; - /* set cache time */ - globalADCacheTime = timeInSeconds; - } - } else { - /* return cache */ - *count = globalADCount; - } - // that's it -} - -int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames) { - int count = MAX_AUDIO_DEVICES; - int ret = 0; - - getAudioDevices(globalADPaths, &count); - if (index>=0 && index < count) { - ret = getAudioDeviceDescription(globalADPaths[index].path, adDesc, getNames); - } - return ret; -} - -int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames) { - int fd; - int mixerMode; - int len; - audio_info_t info; - audio_device_t deviceInfo; - - strncpy(adDesc->path, path, MAX_NAME_LENGTH); - adDesc->path[MAX_NAME_LENGTH] = 0; - strcpy(adDesc->pathctl, adDesc->path); - strcat(adDesc->pathctl, "ctl"); - strcpy(adDesc->name, adDesc->path); - adDesc->vendor[0] = 0; - adDesc->version[0] = 0; - adDesc->description[0] = 0; - adDesc->maxSimulLines = 1; - - // try to open the pseudo device and get more information - fd = open(adDesc->pathctl, O_WRONLY | O_NONBLOCK); - if (fd >= 0) { - close(fd); - if (getNames) { - fd = open(adDesc->pathctl, O_RDONLY); - if (fd >= 0) { - if (ioctl(fd, AUDIO_GETDEV, &deviceInfo) >= 0) { - strncpy(adDesc->vendor, deviceInfo.name, MAX_AUDIO_DEV_LEN); - adDesc->vendor[MAX_AUDIO_DEV_LEN] = 0; - strncpy(adDesc->version, deviceInfo.version, MAX_AUDIO_DEV_LEN); - adDesc->version[MAX_AUDIO_DEV_LEN] = 0; - /* add config string to the dev name - * creates a string like "/dev/audio (onboard1)" - */ - len = strlen(adDesc->name) + 1; - if (MAX_NAME_LENGTH - len > 3) { - strcat(adDesc->name, " ("); - strncat(adDesc->name, deviceInfo.config, MAX_NAME_LENGTH - len); - strcat(adDesc->name, ")"); - } - adDesc->name[MAX_NAME_LENGTH-1] = 0; - } - if (ioctl(fd, AUDIO_MIXERCTL_GET_MODE, &mixerMode) >= 0) { - if (mixerMode == AM_MIXER_MODE) { - TRACE1(" getAudioDeviceDescription: %s is in mixer mode\n", adDesc->path); - adDesc->maxSimulLines = -1; - } - } else { - ERROR1("ioctl AUDIO_MIXERCTL_GET_MODE failed on %s!\n", adDesc->path); - } - close(fd); - } else { - ERROR1("could not open %s!\n", adDesc->pathctl); - } - } - return 1; - } - return 0; -} --- old/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h 2020-05-20 18:10:37.194308211 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include -#include -#include -#include -#ifndef __linux__ -#include -#endif -#include -#include -#include - -#ifndef PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED -#define PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED - -/* input from Codec inter. loopback */ -#ifndef AUDIO_CODEC_LOOPB_IN -#define AUDIO_CODEC_LOOPB_IN (0x40) -#endif - - -#define MAX_NAME_LENGTH 300 - -typedef struct tag_AudioDevicePath { - char path[MAX_NAME_LENGTH]; - ino_t st_ino; // inode number to detect duplicate devices - dev_t st_dev; // device ID to detect duplicate audio devices -} AudioDevicePath; - -typedef struct tag_AudioDeviceDescription { - INT32 maxSimulLines; - char path[MAX_NAME_LENGTH+1]; - char pathctl[MAX_NAME_LENGTH+4]; - char name[MAX_NAME_LENGTH+1]; - char vendor[MAX_NAME_LENGTH+1]; - char version[MAX_NAME_LENGTH+1]; - char description[MAX_NAME_LENGTH+1]; -} AudioDeviceDescription; - -int getAudioDeviceCount(); - -/* - * adPath is an array of AudioDevicePath structures - * count contains initially the number of elements in adPath - * and will be set to the returned number of paths. - */ -void getAudioDevices(AudioDevicePath* adPath, int* count); - -/* - * fills adDesc from the audio device given in path - * returns 0 if an error occurred - * if getNames is 0, only path and pathctl are filled - */ -int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames); -int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames); - - -#endif // PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED --- old/src/jdk.attach/solaris/classes/sun/tools/attach/AttachProviderImpl.java 2020-05-20 18:10:37.910321958 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package sun.tools.attach; - -import com.sun.tools.attach.VirtualMachine; -import com.sun.tools.attach.VirtualMachineDescriptor; -import com.sun.tools.attach.AttachNotSupportedException; -import java.io.IOException; - -/* - * An AttachProvider implementation for Solaris that use the doors - * interface to the VM. - */ -public class AttachProviderImpl extends HotSpotAttachProvider { - - public AttachProviderImpl() { - } - - public String name() { - return "sun"; - } - - public String type() { - return "doors"; - } - - public VirtualMachine attachVirtualMachine(String vmid) - throws AttachNotSupportedException, IOException - { - // AttachNotSupportedException will be thrown if the target VM can be determined - // to be not attachable. - testAttachable(vmid); - - return new VirtualMachineImpl(this, vmid); - } - - public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd) - throws AttachNotSupportedException, IOException - { - if (vmd.provider() != this) { - throw new AttachNotSupportedException("provider mismatch"); - } - // To avoid re-checking if the VM if attachable, we check if the descriptor - // is for a hotspot VM - these descriptors are created by the listVirtualMachines - // implementation which only returns a list of attachable VMs. - if (vmd instanceof HotSpotVirtualMachineDescriptor) { - assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable(); - return new VirtualMachineImpl(this, vmd.id()); - } else { - return attachVirtualMachine(vmd.id()); - } - } - -} --- old/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java 2020-05-20 18:10:38.606335320 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package sun.tools.attach; - -import com.sun.tools.attach.AttachOperationFailedException; -import com.sun.tools.attach.AgentLoadException; -import com.sun.tools.attach.AttachNotSupportedException; -import com.sun.tools.attach.spi.AttachProvider; - -import java.io.InputStream; -import java.io.IOException; -import java.io.File; -import java.io.FileNotFoundException; - -/* - * Solaris implementation of HotSpotVirtualMachine - */ -@SuppressWarnings("restricted") -public class VirtualMachineImpl extends HotSpotVirtualMachine { - // "/tmp" is used as a global well-known location for the files - // .java_pid. and .attach_pid. It is important that this - // location is the same for all processes, otherwise the tools - // will not be able to find all Hotspot processes. - // Any changes to this needs to be synchronized with HotSpot. - private static final String tmpdir = "/tmp"; - - // door descriptor; - private int fd = -1; - String socket_path; - - /** - * Attaches to the target VM - */ - VirtualMachineImpl(AttachProvider provider, String vmid) - throws AttachNotSupportedException, IOException - { - super(provider, vmid); - // This provider only understands pids - int pid; - try { - pid = Integer.parseInt(vmid); - if (pid < 1) { - throw new NumberFormatException(); - } - } catch (NumberFormatException x) { - throw new AttachNotSupportedException("Invalid process identifier: " + vmid); - } - - // Opens the door file to the target VM. If the file is not - // found it might mean that the attach mechanism isn't started in the - // target VM so we attempt to start it and retry. - try { - fd = openDoor(pid); - } catch (FileNotFoundException fnf1) { - File f = createAttachFile(pid).getCanonicalFile(); - try { - sendQuitTo(pid); - - // give the target VM time to start the attach mechanism - final int delay_step = 100; - final long timeout = attachTimeout(); - long time_spend = 0; - long delay = 0; - do { - // Increase timeout on each attempt to reduce polling - delay += delay_step; - try { - Thread.sleep(delay); - } catch (InterruptedException x) { } - try { - fd = openDoor(pid); - } catch (FileNotFoundException fnf2) { - // pass - } - - time_spend += delay; - if (time_spend > timeout/2 && fd == -1) { - // Send QUIT again to give target VM the last chance to react - sendQuitTo(pid); - } - } while (time_spend <= timeout && fd == -1); - if (fd == -1) { - throw new AttachNotSupportedException( - String.format("Unable to open door %s: " + - "target process %d doesn't respond within %dms " + - "or HotSpot VM not loaded", socket_path, pid, time_spend)); - } - } finally { - f.delete(); - } - } - assert fd >= 0; - } - - /** - * Detach from the target VM - */ - public void detach() throws IOException { - synchronized (this) { - if (fd != -1) { - close(fd); - fd = -1; - } - } - } - - /** - * Execute the given command in the target VM. - */ - InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null - checkNulls(args); - - // first check that we are still attached - int door; - synchronized (this) { - if (fd == -1) { - throw new IOException("Detached from target VM"); - } - door = fd; - } - - // enqueue the command via a door call - int s = enqueue(door, cmd, args); - assert s >= 0; // valid file descriptor - - // The door call returns a file descriptor (one end of a socket pair). - // Create an input stream around it. - SocketInputStream sis = new SocketInputStream(s); - - // Read the command completion status - int completionStatus; - try { - completionStatus = readInt(sis); - } catch (IOException ioe) { - sis.close(); - throw ioe; - } - - // If non-0 it means an error but we need to special-case the - // "load" command to ensure that the right exception is thrown. - if (completionStatus != 0) { - // read from the stream and use that as the error message - String message = readMessage(sis); - sis.close(); - if (cmd.equals("load")) { - String msg = "Failed to load agent library"; - if (!message.isEmpty()) - msg += ": " + message; - throw new AgentLoadException(msg); - } else { - if (message.isEmpty()) - message = "Command failed in target VM"; - throw new AttachOperationFailedException(message); - } - } - - // Return the input stream so that the command output can be read - return sis; - } - - // InputStream over a socket - private class SocketInputStream extends InputStream { - int s; - - public SocketInputStream(int s) { - this.s = s; - } - - public synchronized int read() throws IOException { - byte b[] = new byte[1]; - int n = this.read(b, 0, 1); - if (n == 1) { - return b[0] & 0xff; - } else { - return -1; - } - } - - public synchronized int read(byte[] bs, int off, int len) throws IOException { - if ((off < 0) || (off > bs.length) || (len < 0) || - ((off + len) > bs.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) - return 0; - - return VirtualMachineImpl.read(s, bs, off, len); - } - - public synchronized void close() throws IOException { - if (s != -1) { - int toClose = s; - s = -1; - VirtualMachineImpl.close(toClose); - } - } - } - - // The door is attached to .java_pid in the temporary directory. - private int openDoor(int pid) throws IOException { - socket_path = tmpdir + "/.java_pid" + pid; - fd = open(socket_path); - - // Check that the file owner/permission to avoid attaching to - // bogus process - try { - checkPermissions(socket_path); - } catch (IOException ioe) { - close(fd); - throw ioe; - } - return fd; - } - - // On Solaris a simple handshake is used to start the attach mechanism - // if not already started. The client creates a .attach_pid file in the - // target VM's working directory (or temp directory), and the SIGQUIT handler - // checks for the file. - private File createAttachFile(int pid) throws IOException { - String fn = ".attach_pid" + pid; - String path = "/proc/" + pid + "/cwd/" + fn; - File f = new File(path); - try { - f.createNewFile(); - } catch (IOException x) { - f = new File(tmpdir, fn); - f.createNewFile(); - } - return f; - } - - //-- native methods - - static native void sendQuitTo(int pid) throws IOException; - - static native void checkPermissions(String path) throws IOException; - - static native int open(String path) throws IOException; - - static native void close(int fd) throws IOException; - - static native int read(int fd, byte buf[], int off, int buflen) throws IOException; - - // enqueue a command (and arguments) to the given door - static native int enqueue(int fd, String cmd, Object ... args) - throws IOException; - - static { - System.loadLibrary("attach"); - } -} --- old/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c 2020-05-20 18:10:39.306348760 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni_util.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sun_tools_attach_VirtualMachineImpl.h" - -#define ROOT_UID 0 - -/* - * Declare library specific JNI_Onload entry if static build - */ -DEF_STATIC_JNI_OnLoad - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: open - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_open - (JNIEnv *env, jclass cls, jstring path) -{ - jboolean isCopy; - const char* p = GetStringPlatformChars(env, path, &isCopy); - if (p == NULL) { - return 0; - } else { - int fd; - int err = 0; - - fd = open(p, O_RDWR); - if (fd == -1) { - err = errno; - } - - if (isCopy) { - JNU_ReleaseStringPlatformChars(env, path, p); - } - - if (fd == -1) { - if (err == ENOENT) { - JNU_ThrowByName(env, "java/io/FileNotFoundException", NULL); - } else { - char* msg = strdup(strerror(err)); - JNU_ThrowIOException(env, msg); - if (msg != NULL) { - free(msg); - } - } - } - return fd; - } -} - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: checkPermissions - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions - (JNIEnv *env, jclass cls, jstring path) -{ - jboolean isCopy; - const char* p = GetStringPlatformChars(env, path, &isCopy); - if (p != NULL) { - struct stat64 sb; - uid_t uid, gid; - int res; - - memset(&sb, 0, sizeof(struct stat64)); - - /* - * Check that the path is owned by the effective uid/gid of this - * process. Also check that group/other access is not allowed. - */ - uid = geteuid(); - gid = getegid(); - - res = stat64(p, &sb); - if (res != 0) { - /* save errno */ - res = errno; - } - - if (res == 0) { - char msg[100]; - jboolean isError = JNI_FALSE; - if (sb.st_uid != uid && uid != ROOT_UID) { - snprintf(msg, sizeof(msg), - "file should be owned by the current user (which is %d) but is owned by %d", uid, sb.st_uid); - isError = JNI_TRUE; - } else if (sb.st_gid != gid && uid != ROOT_UID) { - snprintf(msg, sizeof(msg), - "file's group should be the current group (which is %d) but the group is %d", gid, sb.st_gid); - isError = JNI_TRUE; - } else if ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) != 0) { - snprintf(msg, sizeof(msg), - "file should only be readable and writable by the owner but has 0%03o access", sb.st_mode & 0777); - isError = JNI_TRUE; - } - if (isError) { - char buf[256]; - snprintf(buf, sizeof(buf), "well-known file %s is not secure: %s", p, msg); - JNU_ThrowIOException(env, buf); - } - } else { - char* msg = strdup(strerror(res)); - JNU_ThrowIOException(env, msg); - if (msg != NULL) { - free(msg); - } - } - - if (isCopy) { - JNU_ReleaseStringPlatformChars(env, path, p); - } - } -} - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: close - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close - (JNIEnv *env, jclass cls, jint fd) -{ - int ret; - RESTARTABLE(close(fd), ret); -} - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: read - * Signature: (I[BI)I - */ -JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read - (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen) -{ - unsigned char buf[128]; - size_t len = sizeof(buf); - ssize_t n; - - size_t remaining = (size_t)(baLen - off); - if (len > remaining) { - len = remaining; - } - - RESTARTABLE(read(fd, buf, len), n); - if (n == -1) { - JNU_ThrowIOExceptionWithLastError(env, "read"); - } else { - if (n == 0) { - n = -1; // EOF - } else { - (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf)); - } - } - return n; -} - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: sendQuitTo - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo - (JNIEnv *env, jclass cls, jint pid) -{ - if (kill((pid_t)pid, SIGQUIT) == -1) { - JNU_ThrowIOExceptionWithLastError(env, "kill"); - } -} - -/* - * A simple table to translate some known errors into reasonable - * error messages - */ -static struct { - jint err; - const char* msg; -} const error_messages[] = { - { 100, "Bad request" }, - { 101, "Protocol mismatch" }, - { 102, "Resource failure" }, - { 103, "Internal error" }, - { 104, "Permission denied" }, -}; - -/* - * Lookup the given error code and return the appropriate - * message. If not found return NULL. - */ -static const char* translate_error(jint err) { - int table_size = sizeof(error_messages) / sizeof(error_messages[0]); - int i; - - for (i = 0; i < table_size; i++) { - if (err == error_messages[i].err) { - return error_messages[i].msg; - } - } - return NULL; -} - -/* - * Current protocol version - */ -static const char* PROTOCOL_VERSION = "1"; - -/* - * Class: sun_tools_attach_VirtualMachineImpl - * Method: enqueue - * Signature: (JILjava/lang/String;[Ljava/lang/Object;)V - */ -JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue - (JNIEnv *env, jclass cls, jint fd, jstring cmd, jobjectArray args) -{ - jint arg_count, i; - size_t size; - jboolean isCopy; - door_arg_t door_args; - char res_buffer[128]; - jint result = -1; - int rc; - const char* cstr; - char* buf; - - /* - * First we get the command string and create the start of the - * argument string to send to the target VM: - * \0\0 - */ - cstr = JNU_GetStringPlatformChars(env, cmd, &isCopy); - if (cstr == NULL) { - return -1; /* pending exception */ - } - size = strlen(PROTOCOL_VERSION) + strlen(cstr) + 2; - buf = (char*)malloc(size); - if (buf != NULL) { - char* pos = buf; - strcpy(buf, PROTOCOL_VERSION); - pos += strlen(PROTOCOL_VERSION)+1; - strcpy(pos, cstr); - } - if (isCopy) { - JNU_ReleaseStringPlatformChars(env, cmd, cstr); - } - if (buf == NULL) { - JNU_ThrowOutOfMemoryError(env, "malloc failed"); - return -1; - } - - /* - * Next we iterate over the arguments and extend the buffer - * to include them. - */ - arg_count = (*env)->GetArrayLength(env, args); - - for (i = 0; i < arg_count; i++) { - jobject obj = (*env)->GetObjectArrayElement(env, args, i); - if (obj != NULL) { - cstr = JNU_GetStringPlatformChars(env, obj, &isCopy); - if (cstr != NULL) { - size_t len = strlen(cstr); - char* newbuf = (char*)realloc(buf, size+len+1); - if (newbuf != NULL) { - buf = newbuf; - strcpy(buf+size, cstr); - size += len+1; - } - if (isCopy) { - JNU_ReleaseStringPlatformChars(env, obj, cstr); - } - if (newbuf == NULL) { - free(buf); - JNU_ThrowOutOfMemoryError(env, "realloc failed"); - return -1; - } - } - } else { - char* newbuf = (char*)realloc(buf, size + 1); - if (newbuf == NULL) { - free(buf); - JNU_ThrowOutOfMemoryError(env, "realloc failed"); - return -1; - } - buf = newbuf; - buf[size++] = 0; - } - if ((*env)->ExceptionOccurred(env)) { - free(buf); - return -1; - } - } - - /* - * The arguments to the door function are in 'buf' so we now - * do the door call - */ - door_args.data_ptr = buf; - door_args.data_size = size; - door_args.desc_ptr = NULL; - door_args.desc_num = 0; - door_args.rbuf = (char*)&res_buffer; - door_args.rsize = sizeof(res_buffer); - - RESTARTABLE(door_call(fd, &door_args), rc); - - /* - * door_call failed - */ - if (rc == -1) { - JNU_ThrowIOExceptionWithLastError(env, "door_call"); - } else { - /* - * door_call succeeded but the call didn't return the expected jint. - */ - if (door_args.data_size < sizeof(jint)) { - JNU_ThrowIOException(env, "Enqueue error - reason unknown as result is truncated!"); - } else { - jint* res = (jint*)(door_args.data_ptr); - if (*res != JNI_OK) { - const char* msg = translate_error(*res); - char buf[255]; - if (msg == NULL) { - sprintf(buf, "Unable to enqueue command to target VM: %d", *res); - } else { - sprintf(buf, "Unable to enqueue command to target VM: %s", msg); - } - JNU_ThrowIOException(env, buf); - } else { - /* - * The door call should return a file descriptor to one end of - * a socket pair - */ - if ((door_args.desc_ptr != NULL) && - (door_args.desc_num == 1) && - (door_args.desc_ptr->d_attributes & DOOR_DESCRIPTOR)) { - result = door_args.desc_ptr->d_data.d_desc.d_descriptor; - } else { - JNU_ThrowIOException(env, "Reply from enqueue missing descriptor!"); - } - } - } - } - - free(buf); - return result; -} --- old/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg 2020-05-20 18:10:40.002362123 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,23 +0,0 @@ -# -# Configuration file to allow the SunPKCS11 provider to utilize -# the Solaris Cryptographic Framework, if it is available -# - -name = Solaris - -description = SunPKCS11 accessing Solaris Cryptographic Framework - -library = /usr/lib/$ISA/libpkcs11.so - -handleStartupErrors = ignoreAll - -# Use the X9.63 encoding for EC points (do not wrap in an ASN.1 OctetString). -useEcX963Encoding = true - -attributes = compatibility - -disabledMechanisms = { - CKM_DSA_KEY_PAIR_GEN - SecureRandom -} - --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java 2020-05-20 18:10:58.230712087 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot; - -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.types.basic.*; - -/** This class implements the compiler-specific access to the vtbl for - a given C++ type. */ -public class HotSpotSolarisVtblAccess extends BasicVtblAccess { - - public HotSpotSolarisVtblAccess(SymbolLookup symbolLookup, - String[] jvmLibNames) { - super(symbolLookup, jvmLibNames); - } - - protected String vtblSymbolForType(Type type) { - String demangledSymbol = type.getName() + "::__vtbl"; - return mangle(demangledSymbol); - } - - //-------------------------------------------------------------------------------- - // Internals only below this point - // - - private String mangle(String symbol) { - String[] parts = symbol.split("::"); - StringBuffer mangled = new StringBuffer("__1c"); - for (int i = 0; i < parts.length; i++) { - int len = parts[i].length(); - if (len >= 26) { - mangled.append((char)('a' + (len / 26))); - len = len % 26; - } - mangled.append((char)('A' + len)); - mangled.append(parts[i]); - } - mangled.append("_"); - return mangled.toString(); - } -} --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/solaris_amd64/SolarisAMD64JavaThreadPDAccess.java 2020-05-20 18:11:11.186960833 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.solaris_amd64; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.amd64.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.runtime.amd64.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; -import sun.jvm.hotspot.utilities.Observable; -import sun.jvm.hotspot.utilities.Observer; - -public class SolarisAMD64JavaThreadPDAccess implements JavaThreadPDAccess { - private static AddressField lastJavaFPField; - private static AddressField osThreadField; - private static AddressField baseOfStackPointerField; - - // Field from OSThread - private static CIntegerField osThreadThreadIDField; - - // This is currently unneeded but is being kept in case we change - // the currentFrameGuess algorithm - private static final long GUESS_SCAN_RANGE = 128 * 1024; - - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("JavaThread"); - Type anchorType = db.lookupType("JavaFrameAnchor"); - - lastJavaFPField = anchorType.getAddressField("_last_Java_fp"); - osThreadField = type.getAddressField("_osthread"); - - type = db.lookupType("OSThread"); - osThreadThreadIDField = type.getCIntegerField("_thread_id"); - } - - public Address getLastJavaFP(Address addr) { - return lastJavaFPField.getValue(addr.addOffsetTo(sun.jvm.hotspot.runtime.JavaThread.getAnchorField().getOffset())); - } - - public Address getLastJavaPC(Address addr) { - return null; - } - - public Address getBaseOfStackPointer(Address addr) { - return null; - } - - public Frame getLastFramePD(JavaThread thread, Address addr) { - Address fp = thread.getLastJavaFP(); - if (fp == null) { - return null; // no information - } - Address pc = thread.getLastJavaPC(); - if ( pc != null ) { - return new AMD64Frame(thread.getLastJavaSP(), fp, pc); - } else { - return new AMD64Frame(thread.getLastJavaSP(), fp); - } - } - - public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { - return new AMD64RegisterMap(thread, updateMap); - } - - public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { - ThreadProxy t = getThreadProxy(addr); - AMD64ThreadContext context = (AMD64ThreadContext) t.getContext(); - AMD64CurrentFrameGuess guesser = new AMD64CurrentFrameGuess(context, thread); - if (!guesser.run(GUESS_SCAN_RANGE)) { - return null; - } - if (guesser.getPC() == null) { - return new AMD64Frame(guesser.getSP(), guesser.getFP()); - } else { - return new AMD64Frame(guesser.getSP(), guesser.getFP(), guesser.getPC()); - } - } - - - public void printThreadIDOn(Address addr, PrintStream tty) { - tty.print(getThreadProxy(addr)); - } - - - public void printInfoOn(Address threadAddr, PrintStream tty) { - } - - public Address getLastSP(Address addr) { - ThreadProxy t = getThreadProxy(addr); - AMD64ThreadContext context = (AMD64ThreadContext) t.getContext(); - return context.getRegisterAsAddress(AMD64ThreadContext.RSP); - } - - public ThreadProxy getThreadProxy(Address addr) { - // Fetch the OSThread (for now and for simplicity, not making a - // separate "OSThread" class in this package) - Address osThreadAddr = osThreadField.getValue(addr); - // Get the address of the thread ID from the OSThread - Address tidAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset()); - - JVMDebugger debugger = VM.getVM().getDebugger(); - return debugger.getThreadForIdentifierAddress(tidAddr); - } - -} --- old/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c 2020-05-20 18:12:18.112245724 -0700 +++ /dev/null 2020-03-09 18:57:19.455001459 -0700 @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "jvm.h" -#include "com_sun_management_internal_OperatingSystemImpl.h" - -typedef struct { - kstat_t *kstat; - uint64_t last_idle; - uint64_t last_total; - double last_ratio; -} cpuload_t; - -static cpuload_t *cpu_loads = NULL; -static unsigned int num_cpus; -static kstat_ctl_t *kstat_ctrl = NULL; - -static void map_cpu_kstat_counters() { - kstat_t *kstat; - int i; - - // Get number of CPU(s) - if ((num_cpus = sysconf(_SC_NPROCESSORS_ONLN)) == -1) { - num_cpus = 1; - } - - // Data structure for saving CPU load - if ((cpu_loads = calloc(num_cpus,sizeof(cpuload_t))) == NULL) { - return; - } - - // Get kstat cpu_stat counters for every CPU - // (loop over kstat to find our cpu_stat(s) - i = 0; - for (kstat = kstat_ctrl->kc_chain; kstat != NULL; kstat = kstat->ks_next) { - if (strncmp(kstat->ks_module, "cpu_stat", 8) == 0) { - - if (kstat_read(kstat_ctrl, kstat, NULL) == -1) { - // Failed to initialize kstat for this CPU so ignore it - continue; - } - - if (i == num_cpus) { - // Found more cpu_stats than reported CPUs - break; - } - - cpu_loads[i++].kstat = kstat; - } - } -} - -static int init_cpu_kstat_counters() { - static int initialized = 0; - - // Concurrence in this method is prevented by the lock in - // the calling method get_cpu_load(); - if(!initialized) { - if ((kstat_ctrl = kstat_open()) != NULL) { - map_cpu_kstat_counters(); - initialized = 1; - } - } - return initialized ? 0 : -1; -} - -static void update_cpu_kstat_counters() { - if(kstat_chain_update(kstat_ctrl) != 0) { - free(cpu_loads); - map_cpu_kstat_counters(); - } -} - -int read_cpustat(cpuload_t *load, cpu_stat_t *cpu_stat) { - if (load->kstat == NULL) { - // no handle. - return -1; - } - if (kstat_read(kstat_ctrl, load->kstat, cpu_stat) == -1) { - // disabling for now, a kstat chain update is likely to happen next time - load->kstat = NULL; - return -1; - } - return 0; -} - -double get_single_cpu_load(unsigned int n) { - cpuload_t *load; - cpu_stat_t cpu_stat; - uint_t *usage; - uint64_t c_idle; - uint64_t c_total; - uint64_t d_idle; - uint64_t d_total; - int i; - - if (n >= num_cpus) { - return -1.0; - } - - load = &cpu_loads[n]; - if (read_cpustat(load, &cpu_stat) < 0) { - return -1.0; - } - - usage = cpu_stat.cpu_sysinfo.cpu; - c_idle = usage[CPU_IDLE]; - - for (c_total = 0, i = 0; i < CPU_STATES; i++) { - c_total += usage[i]; - } - - // Calculate diff against previous snapshot - d_idle = c_idle - load->last_idle; - d_total = c_total - load->last_total; - - /** update if weve moved */ - if (d_total > 0) { - // Save current values for next time around - load->last_idle = c_idle; - load->last_total = c_total; - load->last_ratio = (double) (d_total - d_idle) / d_total; - } - - return load->last_ratio; -} - -int get_info(const char *path, void *info, size_t s, off_t o) { - int fd; - int ret = 0; - if ((fd = open(path, O_RDONLY)) < 0) { - return -1; - } - if (pread(fd, info, s, o) != s) { - ret = -1; - } - close(fd); - return ret; -} - -#define MIN(a, b) ((a < b) ? a : b) - -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; - -/** - * Return the cpu load (0-1) for proc number 'which' (or average all if which == -1) - */ -double get_cpu_load(int which) { - double load =.0; - - pthread_mutex_lock(&lock); - if(init_cpu_kstat_counters()==0) { - - update_cpu_kstat_counters(); - - if (which == -1) { - unsigned int i; - double t; - - for (t = .0, i = 0; i < num_cpus; i++) { - t += get_single_cpu_load(i); - } - - // Cap total systemload to 1.0 - load = MIN((t / num_cpus), 1.0); - } else { - load = MIN(get_single_cpu_load(which), 1.0); - } - } else { - load = -1.0; - } - pthread_mutex_unlock(&lock); - - return load; -} - -/** - * Return the cpu load (0-1) for the current process (i.e the JVM) - * or -1.0 if the get_info() call failed - */ -double get_process_load(void) { - psinfo_t info; - - // Get the percentage of "recent cpu usage" from all the lwp:s in the JVM:s - // process. This is returned as a value between 0.0 and 1.0 multiplied by 0x8000. - if (get_info("/proc/self/psinfo",&info.pr_pctcpu, sizeof(info.pr_pctcpu), offsetof(psinfo_t, pr_pctcpu)) == 0) { - return (double) info.pr_pctcpu / 0x8000; - } - return -1.0; -} - -JNIEXPORT jdouble JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0 -(JNIEnv *env, jobject dummy) -{ - return get_cpu_load(-1); -} - -JNIEXPORT jdouble JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0 -(JNIEnv *env, jobject dummy) -{ - return get_process_load(); -} - -JNIEXPORT jdouble JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getSingleCpuLoad0 -(JNIEnv *env, jobject mbean, jint cpu_number) -{ - return get_cpu_load(cpu_number); -} - -JNIEXPORT jlong JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getHostTotalCpuTicks0 -(JNIEnv *env, jobject mbean) -{ - return -1; -} - -JNIEXPORT jint JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getHostConfiguredCpuCount0 -(JNIEnv *env, jobject mbean) -{ - int n = sysconf(_SC_NPROCESSORS_CONF); - if (n <= 0) { - n = 1; - } - return n; -} - -JNIEXPORT jint JNICALL -Java_com_sun_management_internal_OperatingSystemImpl_getHostOnlineCpuCount0 -(JNIEnv *env, jobject mbean) -{ - int n = sysconf(_SC_NPROCESSORS_ONLN); - if (n <= 0) { - n = 1; - } - return n; -}