1 diff -Nru jdk24u-jdk-24-29.orig/bin/unshuffle_list.txt jdk24u-jdk-24-29/bin/unshuffle_list.txt
2 --- jdk24u-jdk-24-29.orig/bin/unshuffle_list.txt 2024-12-29 15:19:41.076403399 +0100
3 +++ jdk24u-jdk-24-29/bin/unshuffle_list.txt 2024-12-29 15:20:25.047019940 +0100
5 src/langtools/sample : langtools/src/sample
6 src/linux : jdk/src/linux
7 src/sample : jdk/src/sample
8 +src/solaris : jdk/src/solaris
9 src/hotspot/share : hotspot/src/share/vm
10 src/hotspot/cpu/aarch64 : hotspot/src/cpu/aarch64/vm
11 src/hotspot/cpu/arm : hotspot/src/cpu/arm/vm
13 src/hotspot/os/linux : hotspot/src/os/linux/vm
14 src/hotspot/os/posix/dtrace : hotspot/src/os/posix/dtrace
15 src/hotspot/os/posix : hotspot/src/os/posix/vm
16 +src/hotspot/os/solaris : hotspot/src/os/solaris/vm
17 src/hotspot/os/windows : hotspot/src/os/windows/vm
18 src/hotspot/os_cpu/aix_ppc : hotspot/src/os_cpu/aix_ppc/vm
19 src/hotspot/os_cpu/bsd_x86 : hotspot/src/os_cpu/bsd_x86/vm
21 src/hotspot/os_cpu/linux_s390 : hotspot/src/os_cpu/linux_s390/vm
22 src/hotspot/os_cpu/linux_x86 : hotspot/src/os_cpu/linux_x86/vm
23 src/hotspot/os_cpu/linux_zero : hotspot/src/os_cpu/linux_zero/vm
24 +src/hotspot/os_cpu/solaris_x86 : hotspot/src/os_cpu/solaris_x86/vm
25 src/hotspot/os_cpu/windows_x86 : hotspot/src/os_cpu/windows_x86/vm
26 src/hotspot : hotspot/src
27 src/utils/IdealGraphVisualizer : hotspot/src/share/tools/IdealGraphVisualizer
28 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/basic_tools.m4 jdk24u-jdk-24-29/make/autoconf/basic_tools.m4
29 --- jdk24u-jdk-24-29.orig/make/autoconf/basic_tools.m4 2024-12-29 15:19:41.040717954 +0100
30 +++ jdk24u-jdk-24-29/make/autoconf/basic_tools.m4 2024-12-29 15:20:25.048607639 +0100
33 elif test "x$($TAR --version | $GREP "busybox")" != "x"; then
35 + elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
37 elif test "x$OPENJDK_BUILD_OS" = "xaix"; then
40 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/build-aux/config.guess jdk24u-jdk-24-29/make/autoconf/build-aux/config.guess
41 --- jdk24u-jdk-24-29.orig/make/autoconf/build-aux/config.guess 2024-12-29 15:19:41.044566791 +0100
42 +++ jdk24u-jdk-24-29/make/autoconf/build-aux/config.guess 2024-12-29 15:20:25.048987320 +0100
47 +# Test and fix solaris on x86_64
48 +echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
50 + # isainfo -n returns either i386 or amd64
51 + REAL_CPU=`isainfo -n`
52 + OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
55 # Test and fix cygwin on x86_64
56 echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
58 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/build-performance.m4 jdk24u-jdk-24-29/make/autoconf/build-performance.m4
59 --- jdk24u-jdk-24-29.orig/make/autoconf/build-performance.m4 2024-12-29 15:19:41.041131762 +0100
60 +++ jdk24u-jdk-24-29/make/autoconf/build-performance.m4 2024-12-29 15:20:25.049450916 +0100
62 if test "$NUM_CORES" -eq "0"; then
63 NUM_CORES=`cat /proc/cpuinfo | grep -c ^CPU`
65 + elif test -x /usr/sbin/psrinfo; then
66 + # Looks like a Solaris system
67 + NUM_CORES=`/usr/sbin/psrinfo -v | grep -c on-line`
68 elif test -x /usr/sbin/sysctl; then
69 # Looks like a MacOSX system
70 NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
72 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
74 elif test -x /usr/sbin/prtconf; then
75 - # Looks like an AIX system
76 + # Looks like a Solaris or AIX system
77 MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
79 elif test -x /usr/sbin/sysctl; then
80 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/flags-cflags.m4 jdk24u-jdk-24-29/make/autoconf/flags-cflags.m4
81 --- jdk24u-jdk-24-29.orig/make/autoconf/flags-cflags.m4 2024-12-29 15:19:41.045782859 +0100
82 +++ jdk24u-jdk-24-29/make/autoconf/flags-cflags.m4 2024-12-29 15:20:25.049992802 +0100
84 if test "x$OPENJDK_TARGET_OS" = xlinux; then
85 CFLAGS_OS_DEF_JVM="-DLINUX -D_FILE_OFFSET_BITS=64"
86 CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64"
87 + elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
88 + CFLAGS_OS_DEF_JVM="-DSOLARIS"
89 + CFLAGS_OS_DEF_JDK="-D__solaris__"
90 elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
91 CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
92 CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
93 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/jdk-options.m4 jdk24u-jdk-24-29/make/autoconf/jdk-options.m4
94 --- jdk24u-jdk-24-29.orig/make/autoconf/jdk-options.m4 2024-12-29 15:19:41.046187773 +0100
95 +++ jdk24u-jdk-24-29/make/autoconf/jdk-options.m4 2024-12-29 15:20:25.050527202 +0100
97 ZIP_EXTERNAL_DEBUG_SYMBOLS=false
98 elif test "x$with_native_debug_symbols" = xexternal; then
100 - if test "x$OPENJDK_TARGET_OS" = xlinux; then
101 + if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
102 if test "x$OBJCOPY" = x; then
103 # enabling of enable-debug-symbols and can't find objcopy
106 ZIP_EXTERNAL_DEBUG_SYMBOLS=false
107 elif test "x$with_native_debug_symbols" = xzipped; then
109 - if test "x$OPENJDK_TARGET_OS" = xlinux; then
110 + if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
111 if test "x$OBJCOPY" = x; then
112 # enabling of enable-debug-symbols and can't find objcopy
114 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/libraries.m4 jdk24u-jdk-24-29/make/autoconf/libraries.m4
115 --- jdk24u-jdk-24-29.orig/make/autoconf/libraries.m4 2024-12-29 15:19:41.043836607 +0100
116 +++ jdk24u-jdk-24-29/make/autoconf/libraries.m4 2024-12-29 15:20:25.050972546 +0100
117 @@ -133,13 +133,15 @@
118 BASIC_JVM_LIBS="$LIBM"
120 # Dynamic loading library
121 - if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
122 + if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
123 BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL"
127 if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
128 BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
129 + elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
130 + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lthread"
133 # librt for legacy clock_gettime
135 BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
138 + if test "x$OPENJDK_TARGET_OS" = xsolaris; then
139 + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -lnsl \
141 + BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM"
144 if test "x$OPENJDK_TARGET_OS" = xwindows; then
145 BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
146 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib powrprof.lib uuid.lib \
147 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/platform.m4 jdk24u-jdk-24-29/make/autoconf/platform.m4
148 --- jdk24u-jdk-24-29.orig/make/autoconf/platform.m4 2024-12-29 15:19:41.041696476 +0100
149 +++ jdk24u-jdk-24-29/make/autoconf/platform.m4 2024-12-29 15:20:25.051524163 +0100
163 AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
165 + # OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
166 + # /amd64 or /sparcv9. This string is appended to some library paths, like this:
167 + # /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so
168 + OPENJDK_$1_CPU_ISADIR=""
169 + if test "x$OPENJDK_$1_OS" = xsolaris; then
170 + if test "x$OPENJDK_$1_CPU" = xx86_64; then
171 + OPENJDK_$1_CPU_ISADIR="/amd64"
174 + AC_SUBST(OPENJDK_$1_CPU_ISADIR)
176 # Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
177 OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
178 if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
181 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
183 + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
184 + RELEASE_FILE_OS_NAME=SunOS
186 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
187 RELEASE_FILE_OS_NAME=Linux
189 diff -Nru jdk24u-jdk-24-29.orig/make/autoconf/toolchain.m4 jdk24u-jdk-24-29/make/autoconf/toolchain.m4
190 --- jdk24u-jdk-24-29.orig/make/autoconf/toolchain.m4 2024-12-29 15:19:41.043116614 +0100
191 +++ jdk24u-jdk-24-29/make/autoconf/toolchain.m4 2024-12-29 15:20:25.052038752 +0100
194 # These toolchains are valid on different platforms
195 VALID_TOOLCHAINS_linux="gcc clang"
196 +VALID_TOOLCHAINS_solaris="gcc"
197 VALID_TOOLCHAINS_macosx="clang"
198 VALID_TOOLCHAINS_aix="clang"
199 VALID_TOOLCHAINS_windows="microsoft"
200 diff -Nru jdk24u-jdk-24-29.orig/make/common/FileUtils.gmk jdk24u-jdk-24-29/make/common/FileUtils.gmk
201 --- jdk24u-jdk-24-29.orig/make/common/FileUtils.gmk 2024-12-29 15:19:40.996796014 +0100
202 +++ jdk24u-jdk-24-29/make/common/FileUtils.gmk 2024-12-29 15:20:25.052495522 +0100
204 ################################################################################
205 # All install-file and related macros automatically call DecodeSpace when needed.
207 -ifeq ($(call isTargetOs, macosx), true)
208 +ifeq ($(call isTargetOs, solaris), true)
209 + # On Solaris, if the target is a symlink and exists, cp won't overwrite.
210 + # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
211 + # name of the target file differs from the source file, rename after copy.
212 + # If the source and target parent directories are the same, recursive copy doesn't work
213 + # so we fall back on regular copy, which isn't preserving symlinks.
214 + define install-file
215 + $(call MakeTargetDir)
216 + $(RM) '$(call DecodeSpace, $@)'
217 + if [ '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))' != \
218 + '$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))' ]; then \
219 + $(CP) -f -r -P '$(call DecodeSpace, $<)' \
220 + '$(call DecodeSpace, $(dir $(call EncodeSpace, $@)))'; \
221 + if [ '$(call DecodeSpace, $(notdir $(call EncodeSpace, $@)))' != \
222 + '$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))' ]; then \
223 + $(MV) '$(call DecodeSpace, $(dir $(call EncodeSpace, $@))/$(notdir $(call EncodeSpace, $<)))' \
224 + '$(call DecodeSpace, $@)'; \
227 + if [ -L '$(call DecodeSpace, $<)' ]; then \
228 + $(ECHO) "Source file is a symlink and target is in the same directory: $< $@" ; \
231 + $(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'; \
234 +else ifeq ($(call isTargetOs, macosx), true)
235 # On mac, extended attributes sometimes creep into the source files, which may later
236 # cause the creation of ._* files which confuses testing. Clear these with xattr if
237 # set. Some files get their write permissions removed after being copied to the
238 diff -Nru jdk24u-jdk-24-29.orig/make/common/modules/LauncherCommon.gmk jdk24u-jdk-24-29/make/common/modules/LauncherCommon.gmk
239 --- jdk24u-jdk-24-29.orig/make/common/modules/LauncherCommon.gmk 2024-12-29 15:19:40.993653222 +0100
240 +++ jdk24u-jdk-24-29/make/common/modules/LauncherCommon.gmk 2024-12-29 15:20:25.052964745 +0100
242 -DLAUNCHER_NAME='"$$(LAUNCHER_NAME)"' \
245 + CFLAGS_solaris := -fPIC, \
246 CFLAGS_windows := $$($1_CFLAGS_windows), \
247 EXTRA_HEADER_DIRS := java.base:libjvm, \
248 DISABLED_WARNINGS_gcc := unused-function unused-variable, \
249 @@ -150,12 +151,14 @@
250 LDFLAGS := $$($1_LDFLAGS), \
251 LDFLAGS_linux := $$(call SET_EXECUTABLE_ORIGIN,/../lib), \
252 LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib), \
253 + LDFLAGS_solaris := $$(call SET_EXECUTABLE_ORIGIN,/../lib), \
254 LDFLAGS_FILTER_OUT := $$($1_LDFLAGS_FILTER_OUT), \
255 JDK_LIBS := $$($1_JDK_LIBS), \
256 JDK_LIBS_windows := $$($1_JDK_LIBS_windows), \
257 LIBS := $$($1_LIBS), \
258 LIBS_unix := $(LIBZ_LIBS), \
259 LIBS_linux := $(LIBDL) -lpthread, \
260 + LIBS_solaris := $(LIBDL) -lthread, \
262 -framework ApplicationServices \
264 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/gensrc/GensrcAdlc.gmk jdk24u-jdk-24-29/make/hotspot/gensrc/GensrcAdlc.gmk
265 --- jdk24u-jdk-24-29.orig/make/hotspot/gensrc/GensrcAdlc.gmk 2024-12-29 15:19:41.052346251 +0100
266 +++ jdk24u-jdk-24-29/make/hotspot/gensrc/GensrcAdlc.gmk 2024-12-29 15:20:25.053429759 +0100
268 # NOTE: No optimization or debug flags set here
269 ifeq ($(call isBuildOs, linux), true)
270 ADLC_CFLAGS := -fno-exceptions -DLINUX
271 + else ifeq ($(call isBuildOs, solaris), true)
272 + ADLC_LDFLAGS := -m64
273 + ADLC_CFLAGS := -m64 -fpermissive
274 else ifeq ($(call isBuildOs, aix), true)
275 ifeq ($(TOOLCHAIN_TYPE), clang)
278 # ADLC flags depending on target OS
279 ifeq ($(call isTargetOs, linux), true)
280 ADLCFLAGS += -DLINUX=1 -D_GNU_SOURCE=1
281 + else ifeq ($(call isTargetOs, solaris), true)
282 + ADLCFLAGS += -DSOLARIS=1
283 else ifeq ($(call isTargetOs, aix), true)
285 else ifeq ($(call isTargetOs, macosx), true)
286 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/gensrc/GensrcDtrace.gmk jdk24u-jdk-24-29/make/hotspot/gensrc/GensrcDtrace.gmk
287 --- jdk24u-jdk-24-29.orig/make/hotspot/gensrc/GensrcDtrace.gmk 2024-12-29 15:19:41.052187375 +0100
288 +++ jdk24u-jdk-24-29/make/hotspot/gensrc/GensrcDtrace.gmk 2024-12-29 15:20:25.053868654 +0100
291 ifeq ($(call check-jvm-feature, dtrace), true)
293 - ifeq ($(call isTargetOs, macosx), true)
294 + ifeq ($(call isTargetOs, solaris), true)
295 + DTRACE_FLAGS := -64
296 + DTRACE_CPP_FLAGS := -D_LP64 -x c
297 + else ifeq ($(call isTargetOs, macosx), true)
298 DTRACE_CPP_FLAGS := -D_LP64 -x c
299 else ifeq ($(call isTargetOs, linux), true)
300 DTRACE_CPP_FLAGS := -x c
302 TARGETS += $(patsubst $(DTRACE_SOURCE_DIR)/%.d, \
303 $(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d))
305 + ifeq ($(call isTargetOs, solaris), true)
306 + ############################################################################
307 + # First we need to generate the dtraceGenOffsets tool. When run, this will
308 + # produce two header files and a C++ file. Note that generateJvmOffsets.cpp
309 + # is using the same JVM_CFLAGS as libjvm.so.
311 + # Include support files that will setup JVM compiler flags.
312 + include lib/JvmFeatures.gmk
313 + include lib/JvmFlags.gmk
315 + # We cannot compile until the JVMTI and JFR gensrc has finished.
316 + # JFR_FILES is defined in GensrcJfr.gmk.
317 + JVMTI_H := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h
319 + $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
320 + NAME := dtraceGenOffsets, \
321 + TYPE := EXECUTABLE, \
322 + SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
323 + TOOLCHAIN := $(TOOLCHAIN_BUILD), \
325 + CFLAGS := -m64 $(JVM_CFLAGS), \
326 + EXTRA_DEPS := $(JVMTI_H) $(JFR_FILES), \
327 + OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
328 + OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
331 + DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
333 + # Argument 1: Output filename
334 + # Argument 2: dtrace-gen-offset tool command line option
335 + define SetupDtraceOffsetsGeneration
336 + $$(eval $$(call SetupExecute, dtrace_offset_$$(strip $2), \
337 + INFO := Generating dtrace $2 file, \
338 + DEPS := $$(BUILD_DTRACE_GEN_OFFSETS), \
339 + OUTPUT_FILE := $1, \
340 + COMMAND := ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $1 ), \
343 + TARGETS += $$(dtrace_offset_$$(strip $2)_TARGET)
346 + JVM_OFFSETS_H := $(DTRACE_GENSRC_DIR)/JvmOffsets.h
347 + JVM_OFFSETS_CPP := $(DTRACE_GENSRC_DIR)/JvmOffsets.cpp
348 + JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
350 + ############################################################################
351 + # Run the dtrace-gen-offset tool to generate these three files.
352 + # The generated JvmOffsets.cpp is compiled with the rest of libjvm.
353 + # The header files are used by libjvm_db and jhelper.d, respectively.
355 + $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
356 + $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
357 + $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
361 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileDtraceLibraries.gmk jdk24u-jdk-24-29/make/hotspot/lib/CompileDtraceLibraries.gmk
362 --- jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileDtraceLibraries.gmk 1970-01-01 01:00:00.000000000 +0100
363 +++ jdk24u-jdk-24-29/make/hotspot/lib/CompileDtraceLibraries.gmk 2024-12-29 15:20:25.106492623 +0100
366 +# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
367 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
369 +# This code is free software; you can redistribute it and/or modify it
370 +# under the terms of the GNU General Public License version 2 only, as
371 +# published by the Free Software Foundation. Oracle designates this
372 +# particular file as subject to the "Classpath" exception as provided
373 +# by Oracle in the LICENSE file that accompanied this code.
375 +# This code is distributed in the hope that it will be useful, but WITHOUT
376 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
377 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
378 +# version 2 for more details (a copy is included in the LICENSE file that
379 +# accompanied this code).
381 +# You should have received a copy of the GNU General Public License version
382 +# 2 along with this work; if not, write to the Free Software Foundation,
383 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
385 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
386 +# or visit www.oracle.com if you need additional information or have any
390 +ifeq ($(call check-jvm-feature, dtrace), true)
391 + ifeq ($(call isTargetOs, solaris), true)
392 + JNI_INCLUDE_FLAGS := \
393 + -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
394 + -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
397 + ############################################################################
398 + # Build the stand-alone dtrace libraries.
400 + LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
401 + $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
402 + NAME := jvm_dtrace, \
403 + OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
404 + SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
405 + CFLAGS := $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \
406 + LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
407 + LIBS := $(LIBDL) -lthread -ldoor, \
408 + OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
411 + # Note that libjvm_db.c has tests for COMPILER2, but this was never set by
413 + LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
414 + $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
416 + OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
417 + SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
418 + CFLAGS := -I$(DTRACE_GENSRC_DIR) $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \
419 + LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
420 + OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
423 + TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
427 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileJvm.gmk jdk24u-jdk-24-29/make/hotspot/lib/CompileJvm.gmk
428 --- jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileJvm.gmk 2024-12-29 15:19:41.051115056 +0100
429 +++ jdk24u-jdk-24-29/make/hotspot/lib/CompileJvm.gmk 2024-12-29 15:20:25.054350436 +0100
431 include lib/JvmOverrideFiles.gmk
432 include lib/JvmFlags.gmk
434 +# Include support files that will setup DTRACE_EXTRA_OBJECT_FILES.
435 +include lib/JvmDtraceObjects.gmk
437 ################################################################################
438 # Setup compilation of the main Hotspot native library (libjvm).
441 EXCLUDES := $(JVM_EXCLUDES), \
442 EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
443 EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
444 + EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
445 DEFAULT_CFLAGS := false, \
446 CFLAGS := $(JVM_CFLAGS), \
447 abstract_vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
448 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileLibraries.gmk jdk24u-jdk-24-29/make/hotspot/lib/CompileLibraries.gmk
449 --- jdk24u-jdk-24-29.orig/make/hotspot/lib/CompileLibraries.gmk 2024-12-29 15:19:41.051718945 +0100
450 +++ jdk24u-jdk-24-29/make/hotspot/lib/CompileLibraries.gmk 2024-12-29 15:20:25.054691054 +0100
452 include HotspotCommon.gmk
454 include lib/CompileJvm.gmk
455 +include lib/CompileDtraceLibraries.gmk
457 ifneq ($(GTEST_FRAMEWORK_SRC), )
458 ifneq ($(CREATING_BUILDJDK), true)
459 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/lib/JvmDtraceObjects.gmk jdk24u-jdk-24-29/make/hotspot/lib/JvmDtraceObjects.gmk
460 --- jdk24u-jdk-24-29.orig/make/hotspot/lib/JvmDtraceObjects.gmk 1970-01-01 01:00:00.000000000 +0100
461 +++ jdk24u-jdk-24-29/make/hotspot/lib/JvmDtraceObjects.gmk 2024-12-29 15:20:25.106783253 +0100
464 +# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
465 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
467 +# This code is free software; you can redistribute it and/or modify it
468 +# under the terms of the GNU General Public License version 2 only, as
469 +# published by the Free Software Foundation. Oracle designates this
470 +# particular file as subject to the "Classpath" exception as provided
471 +# by Oracle in the LICENSE file that accompanied this code.
473 +# This code is distributed in the hope that it will be useful, but WITHOUT
474 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
475 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
476 +# version 2 for more details (a copy is included in the LICENSE file that
477 +# accompanied this code).
479 +# You should have received a copy of the GNU General Public License version
480 +# 2 along with this work; if not, write to the Free Software Foundation,
481 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
483 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
484 +# or visit www.oracle.com if you need additional information or have any
488 +ifeq ($(call check-jvm-feature, dtrace), true)
489 + ifeq ($(call isTargetOs, solaris), true)
491 + ############################################################################
492 + # Integrate with libjvm. Here we generate two object files which are
493 + # linked with libjvm.so. This step is complicated from a dependency
494 + # perspective. We add these two files to the linking of libjvm using
495 + # EXTRA_OBJECT_FILES, but they need to be created outside the call to
496 + # SetupNativeCompilation. Also, one of the files is dependent on compiled
497 + # object files from the libjvm compilation, so this generation must happen
498 + # as a part of the libjvm compilation.
500 + DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
501 + DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
503 + DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
505 + ############################################################################
506 + # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
507 + # object files from the compilation.
509 + # Concatenate all *.d files into a single file
510 + DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
516 + # *.d in the objs dir is used for generated make dependency files, so use
517 + # *.dt for dtrace files to avoid clashes.
518 + $(JVM_OUTPUTDIR)/objs/dtrace.dt: $(DTRACE_SOURCE_FILES)
519 + $(call LogInfo, Generating $(@F))
520 + $(call MakeDir, $(@D))
523 + DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \
525 + classLoadingService.o \
544 + ifeq ($(call check-jvm-feature, parallelgc), true)
545 + DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \
550 + DTRACE_FLAGS := -64 -G
551 + DTRACE_CPP_FLAGS := -D_LP64
553 + # Make sure we run our selected compiler for preprocessing instead of letting
554 + # the dtrace tool pick it on it's own.
555 + $(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.dt $(DTRACE_INSTRUMENTED_OBJS)
556 + $(call LogInfo, Generating $(@F) from $(<F) and object files)
557 + $(call MakeDir, $(DTRACE_SUPPORT_DIR))
558 + $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).dt, \
559 + ($(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).dt))
560 + $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
561 + -s $(DTRACE_SUPPORT_DIR)/$(@F).dt $(sort $(DTRACE_INSTRUMENTED_OBJS)))
563 + ############################################################################
564 + # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
566 + JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
568 + # jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step.
569 + DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
570 + JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
572 + # Make sure we run our selected compiler for preprocessing instead of letting
573 + # the dtrace tool pick it on it's own.
574 + $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
575 + $(call LogInfo, Running dtrace for $(<F))
576 + $(call MakeDir, $(DTRACE_SUPPORT_DIR))
577 + $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).dt, \
578 + ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
579 + > $(DTRACE_SUPPORT_DIR)/$(@F).dt))
580 + $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
581 + -s $(DTRACE_SUPPORT_DIR)/$(@F).dt)
585 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/src/native/dtrace/generateJvmOffsets.cpp jdk24u-jdk-24-29/make/hotspot/src/native/dtrace/generateJvmOffsets.cpp
586 --- jdk24u-jdk-24-29.orig/make/hotspot/src/native/dtrace/generateJvmOffsets.cpp 1970-01-01 01:00:00.000000000 +0100
587 +++ jdk24u-jdk-24-29/make/hotspot/src/native/dtrace/generateJvmOffsets.cpp 2024-12-29 15:20:25.107269598 +0100
590 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
591 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
593 + * This code is free software; you can redistribute it and/or modify it
594 + * under the terms of the GNU General Public License version 2 only, as
595 + * published by the Free Software Foundation.
597 + * This code is distributed in the hope that it will be useful, but WITHOUT
598 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
599 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
600 + * version 2 for more details (a copy is included in the LICENSE file that
601 + * accompanied this code).
603 + * You should have received a copy of the GNU General Public License version
604 + * 2 along with this work; if not, write to the Free Software Foundation,
605 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
607 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
608 + * or visit www.oracle.com if you need additional information or have any
614 + * This is to provide sanity check in jhelper.d which compares SCCS
615 + * versions of generateJvmOffsets.cpp used to create and extract
616 + * contents of __JvmOffsets[] table.
617 + * The __JvmOffsets[] table is located in generated JvmOffsets.cpp.
619 + * GENOFFS_SCCS_VER 34
623 +#include <strings.h>
625 +/* A workaround for private and protected fields */
626 +#define private public
627 +#define protected public
629 +#include <proc_service.h>
630 +#include "gc/shared/collectedHeap.hpp"
631 +#include "memory/heap.hpp"
632 +#include "oops/compressedOops.hpp"
633 +#include "runtime/vmStructs.hpp"
635 +typedef enum GEN_variant {
645 + * To avoid the most part of potential link errors
646 + * we link this program with -z nodefs .
648 + * But for 'debug1' and 'fastdebug1' we still have to provide
649 + * a particular workaround for the following symbols below.
650 + * It will be good to find out a generic way in the future.
655 +#if defined(i386) || defined(__i386) || defined(__amd64)
659 +LIR_Opr LIR_OprFact::illegalOpr = (LIR_Opr) 0;
661 +address StubRoutines::_call_stub_return_address = NULL;
663 +StubQueue* AbstractInterpreter::_code = NULL;
666 +#endif /* COMPILER1 */
668 +#define GEN_OFFS_NAME(Type,Name,OutputType) \
669 + switch(gen_variant) { \
671 + printf("#define OFFSET_%-33s %ld\n", \
672 + #OutputType #Name, offset_of(Type, Name)); \
675 + printf("#define IDX_OFFSET_%-33s %d\n", \
676 + #OutputType #Name, index++); \
679 + printf("\tOFFSET_%s,\n", #OutputType #Name); \
683 +#define GEN_OFFS(Type,Name) \
684 + GEN_OFFS_NAME(Type,Name,Type)
686 +#define GEN_SIZE(Type) \
687 + switch(gen_variant) { \
689 + printf("#define SIZE_%-35s %ld\n", \
690 + #Type, sizeof(Type)); \
693 + printf("#define IDX_SIZE_%-35s %d\n", \
697 + printf("\tSIZE_%s,\n", #Type); \
701 +#define GEN_VALUE(String,Value) \
702 + switch(gen_variant) { \
704 + printf("#define %-40s %d\n", #String, Value); \
707 + printf("#define IDX_%-40s %d\n", #String, index++); \
710 + printf("\t" #String ",\n"); \
714 +void gen_prologue(GEN_variant gen_variant) {
715 + const char *suffix = "Undefined-Suffix";
717 + switch(gen_variant) {
718 + case GEN_OFFSET: suffix = ".h"; break;
719 + case GEN_INDEX: suffix = "Index.h"; break;
720 + case GEN_TABLE: suffix = ".cpp"; break;
724 + printf(" * JvmOffsets%s !!!DO NOT EDIT!!! \n", suffix);
725 + printf(" * The generateJvmOffsets program generates this file!\n");
727 + switch(gen_variant) {
734 + printf("#include \"JvmOffsets.h\"\n");
736 + printf("int __JvmOffsets[] = {\n");
741 +void gen_epilogue(GEN_variant gen_variant) {
742 + if (gen_variant != GEN_TABLE) {
749 +int generateJvmOffsets(GEN_variant gen_variant) {
750 + int index = 0; /* It is used to generate JvmOffsetsIndex.h */
751 + int pointer_size = sizeof(void *);
752 + int data_model = (pointer_size == 4) ? PR_MODEL_ILP32 : PR_MODEL_LP64;
754 + gen_prologue(gen_variant);
756 + GEN_VALUE(DATA_MODEL, data_model);
757 + GEN_VALUE(POINTER_SIZE, pointer_size);
758 +#if COMPILER1_AND_COMPILER2
759 + GEN_VALUE(COMPILER, 3);
761 + GEN_VALUE(COMPILER, 1);
763 + GEN_VALUE(COMPILER, 2);
765 + GEN_VALUE(COMPILER, 0);
766 +#endif // COMPILER1 && COMPILER2
769 + GEN_OFFS(CollectedHeap, _reserved);
770 + GEN_OFFS(MemRegion, _start);
771 + GEN_OFFS(MemRegion, _word_size);
772 + GEN_SIZE(HeapWord);
775 + GEN_OFFS(VMStructEntry, typeName);
776 + GEN_OFFS(VMStructEntry, fieldName);
777 + GEN_OFFS(VMStructEntry, address);
778 + GEN_SIZE(VMStructEntry);
781 + GEN_VALUE(MAX_METHOD_CODE_SIZE, max_method_code_size);
782 +#if defined(i386) || defined(__i386) || defined(__amd64)
783 + GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size);
784 + GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size);
785 + GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, -7 * pointer_size);
788 + GEN_OFFS(Klass, _name);
789 + GEN_OFFS(ConstantPool, _pool_holder);
792 + GEN_VALUE(OFFSET_HeapBlockHeader_used, (int) offset_of(HeapBlock::Header, _used));
793 + GEN_OFFS(oopDesc, _metadata);
796 + GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE);
797 + GEN_VALUE(ConstMethod_has_linenumber_table, ConstMethod::_has_linenumber_table);
798 + GEN_OFFS(AccessFlags, _flags);
799 + GEN_OFFS(Symbol, _length);
800 + GEN_OFFS(Symbol, _body);
803 + GEN_OFFS(Method, _constMethod);
804 + GEN_OFFS(Method, _access_flags);
807 + GEN_OFFS(ConstMethod, _constants);
808 + GEN_OFFS(ConstMethod, _flags);
809 + GEN_OFFS(ConstMethod, _code_size);
810 + GEN_OFFS(ConstMethod, _name_index);
811 + GEN_OFFS(ConstMethod, _signature_index);
814 + GEN_OFFS(CodeHeap, _memory);
815 + GEN_OFFS(CodeHeap, _segmap);
816 + GEN_OFFS(CodeHeap, _log2_segment_size);
819 + GEN_OFFS(VirtualSpace, _low_boundary);
820 + GEN_OFFS(VirtualSpace, _high_boundary);
821 + GEN_OFFS(VirtualSpace, _low);
822 + GEN_OFFS(VirtualSpace, _high);
825 + /* We need to use different names here because of the template parameter */
826 + GEN_OFFS_NAME(GrowableArray<CodeHeap*>, _data, GrowableArray_CodeHeap);
827 + GEN_OFFS_NAME(GrowableArray<CodeHeap*>, _len, GrowableArray_CodeHeap);
830 + GEN_OFFS(CodeBlob, _name);
831 + GEN_OFFS(CodeBlob, _header_size);
832 + GEN_OFFS(CodeBlob, _content_begin);
833 + GEN_OFFS(CodeBlob, _code_begin);
834 + GEN_OFFS(CodeBlob, _code_end);
835 + GEN_OFFS(CodeBlob, _data_offset);
836 + GEN_OFFS(CodeBlob, _frame_size);
839 + GEN_OFFS(nmethod, _method);
840 + GEN_OFFS(nmethod, _dependencies_offset);
841 + GEN_OFFS(nmethod, _metadata_offset);
842 + GEN_OFFS(nmethod, _scopes_data_begin);
843 + GEN_OFFS(nmethod, _scopes_pcs_offset);
844 + GEN_OFFS(nmethod, _handler_table_offset);
845 + GEN_OFFS(nmethod, _deopt_handler_begin);
846 + GEN_OFFS(nmethod, _orig_pc_offset);
848 + GEN_OFFS(PcDesc, _pc_offset);
849 + GEN_OFFS(PcDesc, _scope_decode_offset);
853 + GEN_OFFS(NarrowPtrStruct, _base);
854 + GEN_OFFS(NarrowPtrStruct, _shift);
857 + GEN_VALUE(SIZE_HeapBlockHeader, (int) sizeof(HeapBlock::Header));
859 + GEN_SIZE(ConstantPool);
864 + GEN_SIZE(ConstMethod);
866 + GEN_SIZE(CodeBlob);
867 + GEN_SIZE(BufferBlob);
868 + GEN_SIZE(SingletonBlob);
869 + GEN_SIZE(RuntimeStub);
870 + GEN_SIZE(SafepointBlob);
872 + gen_epilogue(gen_variant);
880 + "HELP: generateJvmOffsets {-header | -index | -table} \n";
882 +int main(int argc, const char *argv[]) {
883 + GEN_variant gen_var;
886 + printf("%s", HELP);
890 + if (0 == strcmp(argv[1], "-header")) {
891 + gen_var = GEN_OFFSET;
893 + else if (0 == strcmp(argv[1], "-index")) {
894 + gen_var = GEN_INDEX;
896 + else if (0 == strcmp(argv[1], "-table")) {
897 + gen_var = GEN_TABLE;
900 + printf("%s", HELP);
903 + return generateJvmOffsets(gen_var);
905 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris
906 --- jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris 1970-01-01 01:00:00.000000000 +0100
907 +++ jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris 2024-12-29 15:20:25.107563620 +0100
910 +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
911 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
913 +# This code is free software; you can redistribute it and/or modify it
914 +# under the terms of the GNU General Public License version 2 only, as
915 +# published by the Free Software Foundation.
917 +# This code is distributed in the hope that it will be useful, but WITHOUT
918 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
919 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
920 +# version 2 for more details (a copy is included in the LICENSE file that
921 +# accompanied this code).
923 +# You should have received a copy of the GNU General Public License version
924 +# 2 along with this work; if not, write to the Free Software Foundation,
925 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
927 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
928 +# or visit www.oracle.com if you need additional information or have any
932 +JVM_handle_solaris_signal
933 +sysThreadAvailableStackWithSlack
934 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris-dtrace-compiler1 jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris-dtrace-compiler1
935 --- jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris-dtrace-compiler1 1970-01-01 01:00:00.000000000 +0100
936 +++ jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris-dtrace-compiler1 2024-12-29 15:20:25.107801381 +0100
939 +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
940 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
942 +# This code is free software; you can redistribute it and/or modify it
943 +# under the terms of the GNU General Public License version 2 only, as
944 +# published by the Free Software Foundation.
946 +# This code is distributed in the hope that it will be useful, but WITHOUT
947 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
948 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
949 +# version 2 for more details (a copy is included in the LICENSE file that
950 +# accompanied this code).
952 +# You should have received a copy of the GNU General Public License version
953 +# 2 along with this work; if not, write to the Free Software Foundation,
954 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
956 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
957 +# or visit www.oracle.com if you need additional information or have any
962 +__1cHnmethodG__vtbl_
963 +__1cICodeBlobG__vtbl_
964 +__1cIUniverseO_collectedHeap_
965 +__1cJCodeCacheG_heaps_
966 +__1cKBufferBlobG__vtbl_
967 +__1cLRuntimeStubG__vtbl_
968 +__1cNSafepointBlobG__vtbl_
969 +__1cSDeoptimizationBlobG__vtbl_
972 diff -Nru jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris-dtrace-compiler2 jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris-dtrace-compiler2
973 --- jdk24u-jdk-24-29.orig/make/hotspot/symbols/symbols-solaris-dtrace-compiler2 1970-01-01 01:00:00.000000000 +0100
974 +++ jdk24u-jdk-24-29/make/hotspot/symbols/symbols-solaris-dtrace-compiler2 2024-12-29 15:20:25.108039628 +0100
977 +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
978 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
980 +# This code is free software; you can redistribute it and/or modify it
981 +# under the terms of the GNU General Public License version 2 only, as
982 +# published by the Free Software Foundation.
984 +# This code is distributed in the hope that it will be useful, but WITHOUT
985 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
986 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
987 +# version 2 for more details (a copy is included in the LICENSE file that
988 +# accompanied this code).
990 +# You should have received a copy of the GNU General Public License version
991 +# 2 along with this work; if not, write to the Free Software Foundation,
992 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
994 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
995 +# or visit www.oracle.com if you need additional information or have any
1000 +__1cHnmethodG__vtbl_
1001 +__1cICodeBlobG__vtbl_
1002 +__1cIUniverseO_collectedHeap_
1003 +__1cJCodeCacheG_heaps_
1004 +__1cKBufferBlobG__vtbl_
1005 +__1cLRuntimeStubG__vtbl_
1006 +__1cNSafepointBlobG__vtbl_
1007 +__1cSDeoptimizationBlobG__vtbl_
1008 +__1cNExceptionBlobG__vtbl_
1009 +__1cQUncommonTrapBlobG__vtbl_
1012 diff -Nru jdk24u-jdk-24-29.orig/make/ide/visualstudio/hotspot/CreateVSProject.gmk jdk24u-jdk-24-29/make/ide/visualstudio/hotspot/CreateVSProject.gmk
1013 --- jdk24u-jdk-24-29.orig/make/ide/visualstudio/hotspot/CreateVSProject.gmk 2024-12-29 15:19:40.989281916 +0100
1014 +++ jdk24u-jdk-24-29/make/ide/visualstudio/hotspot/CreateVSProject.gmk 2024-12-29 15:20:25.055136902 +0100
1019 + -ignorePath solaris \
1020 -ignorePath x86_32 \
1023 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.base/Copy.gmk jdk24u-jdk-24-29/make/modules/java.base/Copy.gmk
1024 --- jdk24u-jdk-24-29.orig/make/modules/java.base/Copy.gmk 2024-12-29 15:19:40.941628254 +0100
1025 +++ jdk24u-jdk-24-29/make/modules/java.base/Copy.gmk 2024-12-29 15:20:25.055545714 +0100
1028 TARGETS += $(NET_PROPERTIES_DST)
1030 -ifeq ($(call isTargetOs, linux), true)
1031 +ifeq ($(call isTargetOs, solaris linux), true)
1032 $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
1033 FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
1034 DEST := $(CONF_DST_DIR)/sdp, \
1035 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.base/gensrc/GensrcMisc.gmk jdk24u-jdk-24-29/make/modules/java.base/gensrc/GensrcMisc.gmk
1036 --- jdk24u-jdk-24-29.orig/make/modules/java.base/gensrc/GensrcMisc.gmk 2024-12-29 15:19:40.942589672 +0100
1037 +++ jdk24u-jdk-24-29/make/modules/java.base/gensrc/GensrcMisc.gmk 2024-12-29 15:20:25.056346896 +0100
1038 @@ -136,6 +136,21 @@
1042 +################################################################################
1044 +ifeq ($(call isTargetOs, solaris), true)
1046 + GENSRC_SC_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
1048 + $(GENSRC_SC_FILE): \
1049 + $(TOPDIR)/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template
1050 + $(generate-preproc-src)
1052 + TARGETS += $(GENSRC_SC_FILE)
1056 +################################################################################
1057 # Create the javax/crypto/JceSecurity.class, using the build default.
1059 ifeq ($(UNLIMITED_CRYPTO), true)
1060 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.base/lib/CoreLibraries.gmk jdk24u-jdk-24-29/make/modules/java.base/lib/CoreLibraries.gmk
1061 --- jdk24u-jdk-24-29.orig/make/modules/java.base/lib/CoreLibraries.gmk 2024-12-29 15:19:40.943721691 +0100
1062 +++ jdk24u-jdk-24-29/make/modules/java.base/lib/CoreLibraries.gmk 2024-12-29 15:20:25.056869920 +0100
1064 ################################################################################
1066 LIBVERIFY_OPTIMIZATION := HIGH
1067 -ifeq ($(call isTargetOs, linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1068 +ifeq ($(call isTargetOs, solaris linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1069 LIBVERIFY_OPTIMIZATION := LOW
1073 DISABLED_WARNINGS_clang_TimeZone_md.c := unused-variable, \
1074 JDK_LIBS := libjvm, \
1075 LIBS_linux := $(LIBDL), \
1076 + LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL), \
1077 LIBS_aix := $(LIBDL) $(LIBM), \
1079 -framework CoreFoundation \
1081 DISABLED_WARNINGS_clang_java_md_macosx.m := unused-variable, \
1082 LIBS_unix := $(LIBZ_LIBS), \
1083 LIBS_linux := $(LIBDL) -lpthread, \
1084 + LIBS_solaris := $(LIBDL), \
1086 -framework ApplicationServices \
1088 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.base/Lib.gmk jdk24u-jdk-24-29/make/modules/java.base/Lib.gmk
1089 --- jdk24u-jdk-24-29.orig/make/modules/java.base/Lib.gmk 2024-12-29 15:19:40.944753774 +0100
1090 +++ jdk24u-jdk-24-29/make/modules/java.base/Lib.gmk 2024-12-29 15:20:25.055981968 +0100
1092 -delayload:winhttp.dll, \
1093 JDK_LIBS := libjava libjvm, \
1094 LIBS_linux := $(LIBDL), \
1095 + LIBS_solaris := -lnsl -lsocket $(LIBDL), \
1096 LIBS_aix := $(LIBDL), \
1097 LIBS_windows := advapi32.lib delayimp.lib iphlpapi.lib secur32.lib \
1098 winhttp.lib ws2_32.lib, \
1101 DISABLED_WARNINGS_clang_Net.c := unused-function unused-variable, \
1102 DISABLED_WARNINGS_clang_UnixNativeDispatcher.c := unused-variable, \
1103 - JDK_LIBS := libjava libnet, \
1104 + JDK_LIBS := libjava libjvm libnet, \
1105 LIBS_linux := $(LIBDL) -lpthread, \
1106 + LIBS_solaris := -lsocket -lposix4 $(LIBDL) -lsendfile, \
1107 LIBS_aix := $(LIBDL), \
1109 -framework CoreFoundation \
1111 DISABLED_WARNINGS_gcc_jsig.c := unused-but-set-variable, \
1112 DISABLED_WARNINGS_clang_jsig.c := unused-but-set-variable, \
1113 LIBS_linux := $(LIBDL), \
1114 + LIBS_solaris := $(LIBDL), \
1115 LIBS_aix := $(LIBDL), \
1118 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.desktop/Gensrc.gmk jdk24u-jdk-24-29/make/modules/java.desktop/Gensrc.gmk
1119 --- jdk24u-jdk-24-29.orig/make/modules/java.desktop/Gensrc.gmk 2024-12-29 15:19:40.967927385 +0100
1120 +++ jdk24u-jdk-24-29/make/modules/java.desktop/Gensrc.gmk 2024-12-29 15:20:25.057303377 +0100
1122 include gensrc/GensrcIcons.gmk
1125 -ifeq ($(call isTargetOs, linux aix), true)
1126 +ifeq ($(call isTargetOs, linux solaris aix), true)
1127 include gensrc/GensrcX11Wrappers.gmk
1130 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.desktop/lib/AwtLibraries.gmk jdk24u-jdk-24-29/make/modules/java.desktop/lib/AwtLibraries.gmk
1131 --- jdk24u-jdk-24-29.orig/make/modules/java.desktop/lib/AwtLibraries.gmk 2024-12-29 15:19:40.968409202 +0100
1132 +++ jdk24u-jdk-24-29/make/modules/java.desktop/lib/AwtLibraries.gmk 2024-12-29 15:20:25.058308807 +0100
1137 -ifeq ($(call isTargetOs, linux macosx aix), true)
1138 +ifeq ($(call isTargetOs, solaris linux macosx aix), true)
1139 LIBAWT_EXCLUDE_FILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
1143 JDK_LIBS := java.base:libjava java.base:libjvm, \
1144 LIBS_unix := $(LIBM), \
1145 LIBS_linux := $(LIBDL), \
1146 + LIBS_solaris := $(LIBDL), \
1147 LIBS_aix := $(LIBDL), \
1149 -framework ApplicationServices \
1151 DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \
1152 DISABLED_WARNINGS_clang_X11Renderer.c := unused-function, \
1153 DISABLED_WARNINGS_clang_X11SurfaceData.c := unused-function, \
1154 - JDK_LIBS := libawt java.base:libjava, \
1155 + JDK_LIBS := libawt java.base:libjava java.base:libjvm, \
1156 LIBS_linux := $(LIBDL) $(LIBM), \
1157 + LIBS_solaris := $(LIBDL) $(LIBM) $(LIBCXX), \
1158 STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \
1162 DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \
1164 DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := unused-function sign-compare, \
1165 - JDK_LIBS := libawt java.base:libjava, \
1166 + JDK_LIBS := libawt java.base:libjava java.base:libjvm, \
1167 LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \
1169 LIBS_linux := -lpthread, \
1173 ifeq ($(call isTargetOsType, unix)+$(call isTargetOs, macosx), true+false)
1174 - LIBJAWT_JDK_LIBS_unix := libawt
1175 + LIBJAWT_JDK_LIBS_unix := libawt java.base:libjava java.base:libjvm
1176 ifeq ($(ENABLE_HEADLESS_ONLY), false)
1177 LIBJAWT_JDK_LIBS_unix += libawt_xawt
1180 LDFLAGS_windows := $(LDFLAGS_CXX_JDK), \
1181 LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
1182 JDK_LIBS_unix := $(LIBJAWT_JDK_LIBS_unix), \
1183 + LIBS_solaris := $(X_LIBS) -lXrender, \
1184 JDK_LIBS_windows := libawt, \
1185 JDK_LIBS_macosx := libawt_lwawt, \
1186 LIBS_macosx := -framework Cocoa, \
1187 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.desktop/lib/ClientLibraries.gmk jdk24u-jdk-24-29/make/modules/java.desktop/lib/ClientLibraries.gmk
1188 --- jdk24u-jdk-24-29.orig/make/modules/java.desktop/lib/ClientLibraries.gmk 2024-12-29 15:19:40.968231334 +0100
1189 +++ jdk24u-jdk-24-29/make/modules/java.desktop/lib/ClientLibraries.gmk 2024-12-29 15:20:25.058848583 +0100
1191 DISABLED_WARNINGS_gcc := format-nonliteral stringop-truncation type-limits \
1193 DISABLED_WARNINGS_clang := format-nonliteral, \
1194 - JDK_LIBS := libawt java.base:libjava, \
1195 + JDK_LIBS := libawt java.base:libjava java.base:libjvm, \
1196 LIBS_unix := $(LCMS_LIBS) $(LIBM), \
1200 DISABLED_WARNINGS_gcc_jcmaster.c := implicit-fallthrough, \
1201 DISABLED_WARNINGS_gcc_jdphuff.c := shift-negative-value, \
1202 DISABLED_WARNINGS_clang_imageioJPEG.c := unused-but-set-variable, \
1203 - JDK_LIBS := java.base:libjava, \
1204 + JDK_LIBS := java.base:libjava java.base:libjvm, \
1205 LIBS := $(LIBJPEG_LIBS), \
1209 LIBS := $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(LIBZ_LIBS) $(PNG_LIBS), \
1210 LIBS_unix := $(LIBM) -lpthread, \
1211 LIBS_linux := $(LIBDL) $(X_LIBS) -lX11 -lXext, \
1212 + LIBS_solaris := $(LIBDL) $(X_LIBS) -lX11 -lXext, \
1213 LIBS_macosx := -liconv \
1214 -framework ApplicationServices \
1217 -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
1218 -DHB_NO_PRAGMA_GCC_DIAGNOSTIC
1220 - ifeq ($(call isTargetOs, linux macosx), true)
1221 + ifeq ($(call isTargetOs, solaris linux macosx), true)
1222 HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES -DHB_NO_VISIBILITY
1225 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.desktop/Lib.gmk jdk24u-jdk-24-29/make/modules/java.desktop/Lib.gmk
1226 --- jdk24u-jdk-24-29.orig/make/modules/java.desktop/Lib.gmk 2024-12-29 15:19:40.966758458 +0100
1227 +++ jdk24u-jdk-24-29/make/modules/java.desktop/Lib.gmk 2024-12-29 15:20:25.057641020 +0100
1229 -DX_PLATFORM=X_$(OPENJDK_TARGET_OS_UPPERCASE) \
1232 - -DUSE_PLATFORM_MIDI_OUT=TRUE \
1233 - -DUSE_PLATFORM_MIDI_IN=TRUE \
1236 + ifeq ($(call isTargetOs, solaris), false)
1237 + LIBJSOUND_CFLAGS += \
1238 + -DUSE_PLATFORM_MIDI_OUT=TRUE \
1239 + -DUSE_PLATFORM_MIDI_IN=TRUE \
1243 LIBJSOUND_LINK_TYPE := C
1244 ifeq ($(call isTargetOs, macosx), true)
1245 LIBJSOUND_LINK_TYPE := C++
1246 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.instrument/Lib.gmk jdk24u-jdk-24-29/make/modules/java.instrument/Lib.gmk
1247 --- jdk24u-jdk-24-29.orig/make/modules/java.instrument/Lib.gmk 2024-12-29 15:19:40.960757682 +0100
1248 +++ jdk24u-jdk-24-29/make/modules/java.instrument/Lib.gmk 2024-12-29 15:20:25.059240721 +0100
1250 JDK_LIBS := java.base:libjava java.base:libjli java.base:libjvm, \
1251 LIBS_unix := $(LIBZ_LIBS), \
1252 LIBS_linux := $(LIBDL), \
1253 + LIBS_solaris := $(LIBDL), \
1254 LIBS_aix := $(LIBDL) -liconv, \
1255 LIBS_macosx := -liconv \
1256 -framework ApplicationServices \
1257 diff -Nru jdk24u-jdk-24-29.orig/make/modules/java.management/Lib.gmk jdk24u-jdk-24-29/make/modules/java.management/Lib.gmk
1258 --- jdk24u-jdk-24-29.orig/make/modules/java.management/Lib.gmk 2024-12-29 15:19:40.969810894 +0100
1259 +++ jdk24u-jdk-24-29/make/modules/java.management/Lib.gmk 2024-12-29 15:20:25.059651103 +0100
1261 ################################################################################
1263 LIBMANAGEMENT_OPTIMIZATION := HIGH
1264 -ifeq ($(call isTargetOs, linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1265 +ifeq ($(call isTargetOs, solaris linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1266 LIBMANAGEMENT_OPTIMIZATION := LOW
1270 DISABLED_WARNINGS_gcc_VMManagementImpl.c := unused-variable, \
1271 DISABLED_WARNINGS_clang_VMManagementImpl.c := unused-variable, \
1272 JDK_LIBS := java.base:libjava java.base:libjvm, \
1273 + LIBS_solaris := -lkstat, \
1274 LIBS_aix := -lperfstat, \
1275 LIBS_windows := advapi32.lib psapi.lib, \
1277 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.attach/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.attach/Lib.gmk
1278 --- jdk24u-jdk-24-29.orig/make/modules/jdk.attach/Lib.gmk 2024-12-29 15:19:40.955644587 +0100
1279 +++ jdk24u-jdk-24-29/make/modules/jdk.attach/Lib.gmk 2024-12-29 15:20:25.060027203 +0100
1281 OPTIMIZATION := LOW, \
1282 CFLAGS := $(LIBATTACH_CFLAGS), \
1283 CFLAGS_windows := -Gy, \
1284 - JDK_LIBS := java.base:libjava, \
1285 + JDK_LIBS := java.base:libjava java.base:libjvm, \
1286 + LIBS_solaris := -ldoor, \
1287 LIBS_windows := advapi32.lib psapi.lib, \
1290 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.crypto.cryptoki/Copy.gmk jdk24u-jdk-24-29/make/modules/jdk.crypto.cryptoki/Copy.gmk
1291 --- jdk24u-jdk-24-29.orig/make/modules/jdk.crypto.cryptoki/Copy.gmk 1970-01-01 01:00:00.000000000 +0100
1292 +++ jdk24u-jdk-24-29/make/modules/jdk.crypto.cryptoki/Copy.gmk 2024-12-29 15:20:25.108324877 +0100
1295 +# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
1296 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1298 +# This code is free software; you can redistribute it and/or modify it
1299 +# under the terms of the GNU General Public License version 2 only, as
1300 +# published by the Free Software Foundation. Oracle designates this
1301 +# particular file as subject to the "Classpath" exception as provided
1302 +# by Oracle in the LICENSE file that accompanied this code.
1304 +# This code is distributed in the hope that it will be useful, but WITHOUT
1305 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1306 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1307 +# version 2 for more details (a copy is included in the LICENSE file that
1308 +# accompanied this code).
1310 +# You should have received a copy of the GNU General Public License version
1311 +# 2 along with this work; if not, write to the Free Software Foundation,
1312 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1314 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1315 +# or visit www.oracle.com if you need additional information or have any
1319 +include CopyCommon.gmk
1321 +################################################################################
1323 +ifeq ($(call isTargetOs, solaris), true)
1325 + SUNPKCS11_CFG_SRC := \
1326 + $(TOPDIR)/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg
1327 + SUNPKCS11_CFG_DST := $(CONF_DST_DIR)/security/sunpkcs11-solaris.cfg
1329 + $(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC)
1330 + $(call install-file)
1332 + SECURITY_PKCS11_CONF_FILES += $(SUNPKCS11_CFG_DST)
1334 + TARGETS := $(SUNPKCS11_CFG_DST)
1338 +################################################################################
1339 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.hotspot.agent/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.hotspot.agent/Lib.gmk
1340 --- jdk24u-jdk-24-29.orig/make/modules/jdk.hotspot.agent/Lib.gmk 2024-12-29 15:19:40.962661958 +0100
1341 +++ jdk24u-jdk-24-29/make/modules/jdk.hotspot.agent/Lib.gmk 2024-12-29 15:20:25.060416388 +0100
1343 CFLAGS := $(LIBSAPROC_CFLAGS), \
1344 CXXFLAGS := $(LIBSAPROC_CFLAGS) $(LIBSAPROC_CXXFLAGS), \
1345 EXTRA_SRC := $(LIBSAPROC_EXTRA_SRC), \
1346 - JDK_LIBS := java.base:libjava, \
1347 + JDK_LIBS := java.base:libjava java.base:libjvm, \
1348 LIBS_linux := $(LIBDL), \
1349 + LIBS_solaris := -ldl -lstdc++ -lthread -lproc, \
1351 -framework CoreFoundation \
1352 -framework Foundation \
1353 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.jdwp.agent/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.jdwp.agent/Lib.gmk
1354 --- jdk24u-jdk-24-29.orig/make/modules/jdk.jdwp.agent/Lib.gmk 2024-12-29 15:19:40.961157832 +0100
1355 +++ jdk24u-jdk-24-29/make/modules/jdk.jdwp.agent/Lib.gmk 2024-12-29 15:20:25.060832362 +0100
1359 LIBS_linux := -lpthread, \
1360 + LIBS_solaris := -lnsl -lsocket, \
1361 LIBS_windows := iphlpapi.lib ws2_32.lib, \
1365 java.base:libjava, \
1366 JDK_LIBS := java.base:libjvm, \
1367 LIBS_linux := $(LIBDL), \
1368 + LIBS_solaris := $(LIBDL), \
1369 LIBS_macosx := -liconv, \
1370 LIBS_aix := -liconv, \
1372 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.management/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.management/Lib.gmk
1373 --- jdk24u-jdk-24-29.orig/make/modules/jdk.management/Lib.gmk 2024-12-29 15:19:40.958221433 +0100
1374 +++ jdk24u-jdk-24-29/make/modules/jdk.management/Lib.gmk 2024-12-29 15:20:25.061284036 +0100
1378 LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH
1379 -ifeq ($(call isTargetOs, linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1380 +ifeq ($(call isTargetOs, solaris linux)+$(COMPILE_WITH_DEBUG_SYMBOLS), true+true)
1381 LIBMANAGEMENT_EXT_OPTIMIZATION := LOW
1385 DISABLED_WARNINGS_clang_UnixOperatingSystem.c := format-nonliteral, \
1386 CFLAGS := $(LIBMANAGEMENT_EXT_CFLAGS), \
1387 JDK_LIBS := java.base:libjava java.base:libjvm, \
1388 + LIBS_solaris := -lkstat, \
1389 LIBS_aix := -lperfstat, \
1390 LIBS_windows := advapi32.lib psapi.lib, \
1392 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.management.agent/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.management.agent/Lib.gmk
1393 --- jdk24u-jdk-24-29.orig/make/modules/jdk.management.agent/Lib.gmk 2024-12-29 15:19:40.965748005 +0100
1394 +++ jdk24u-jdk-24-29/make/modules/jdk.management.agent/Lib.gmk 2024-12-29 15:20:25.061653179 +0100
1396 $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \
1397 NAME := management_agent, \
1398 OPTIMIZATION := LOW, \
1399 - JDK_LIBS := java.base:libjava, \
1400 + JDK_LIBS := java.base:libjava java.base:libjvm, \
1401 LIBS_windows := advapi32.lib, \
1404 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.net/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.net/Lib.gmk
1405 --- jdk24u-jdk-24-29.orig/make/modules/jdk.net/Lib.gmk 2024-12-29 15:19:40.969538777 +0100
1406 +++ jdk24u-jdk-24-29/make/modules/jdk.net/Lib.gmk 2024-12-29 15:20:25.062061531 +0100
1409 ################################################################################
1411 +ifeq ($(call isTargetOs, solaris), false)
1413 $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
1415 OPTIMIZATION := LOW, \
1419 TARGETS += $(BUILD_LIBEXTNET)
1422 diff -Nru jdk24u-jdk-24-29.orig/make/modules/jdk.sctp/Lib.gmk jdk24u-jdk-24-29/make/modules/jdk.sctp/Lib.gmk
1423 --- jdk24u-jdk-24-29.orig/make/modules/jdk.sctp/Lib.gmk 2024-12-29 15:19:40.963373042 +0100
1424 +++ jdk24u-jdk-24-29/make/modules/jdk.sctp/Lib.gmk 2024-12-29 15:20:25.062432619 +0100
1426 java.base:libnio/ch, \
1427 JDK_LIBS := java.base:libjava java.base:libnet, \
1428 LIBS_linux := $(LIBDL) -lpthread, \
1429 + LIBS_solaris := -lsocket, \
1432 TARGETS += $(BUILD_LIBSCTP)
1433 diff -Nru jdk24u-jdk-24-29.orig/make/RunTestsPrebuilt.gmk jdk24u-jdk-24-29/make/RunTestsPrebuilt.gmk
1434 --- jdk24u-jdk-24-29.orig/make/RunTestsPrebuilt.gmk 2024-12-29 15:19:40.972763429 +0100
1435 +++ jdk24u-jdk-24-29/make/RunTestsPrebuilt.gmk 2024-12-29 15:20:25.047687299 +0100
1437 OPENJDK_TARGET_OS := linux
1438 else ifeq ($(UNAME_OS), Darwin)
1439 OPENJDK_TARGET_OS := macosx
1440 + else ifeq ($(UNAME_OS), SunOS)
1441 + OPENJDK_TARGET_OS := solaris
1443 OPENJDK_TARGET_OS := $(UNAME_OS)
1445 @@ -180,15 +182,28 @@
1446 # Assume little endian unless otherwise specified
1447 OPENJDK_TARGET_CPU_ENDIAN := little
1449 -UNAME_CPU := $(shell $(UNAME) -m)
1450 -ifeq ($(UNAME_CPU), i686)
1451 - OPENJDK_TARGET_CPU := x86
1452 - OPENJDK_TARGET_CPU_BITS := 32
1454 - # Assume all others are 64-bit. We use the same CPU name as uname for
1455 - # at least x86_64 and aarch64.
1456 - OPENJDK_TARGET_CPU := $(UNAME_CPU)
1457 +ifeq ($(OPENJDK_TARGET_OS), solaris)
1458 + # On solaris, use uname -p
1459 + UNAME_CPU := $(shell $(UNAME) -p)
1460 + # Assume 64-bit platform
1461 OPENJDK_TARGET_CPU_BITS := 64
1462 + ifeq ($(UNAME_CPU), i386)
1463 + OPENJDK_TARGET_CPU := x86_64
1465 + OPENJDK_TARGET_CPU := $(UNAME_CPU)
1468 + # ... all others use uname -m
1469 + UNAME_CPU := $(shell $(UNAME) -m)
1470 + ifeq ($(UNAME_CPU), i686)
1471 + OPENJDK_TARGET_CPU := x86
1472 + OPENJDK_TARGET_CPU_BITS := 32
1474 + # Assume all others are 64-bit. We use the same CPU name as uname for
1475 + # at least x86_64 and aarch64.
1476 + OPENJDK_TARGET_CPU := $(UNAME_CPU)
1477 + OPENJDK_TARGET_CPU_BITS := 64
1481 OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU)
1482 @@ -213,6 +228,11 @@
1483 else ifeq ($(OPENJDK_TARGET_OS), macosx)
1484 NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
1485 MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
1486 +else ifeq ($(OPENJDK_TARGET_OS), solaris)
1487 + NUM_CORES := $(shell /usr/sbin/psrinfo -v | $(GREP) -c on-line)
1488 + MEMORY_SIZE := $(shell \
1489 + /usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
1491 else ifeq ($(OPENJDK_TARGET_OS), windows)
1492 NUM_CORES := $(NUMBER_OF_PROCESSORS)
1493 MEMORY_SIZE := $(shell \
1494 diff -Nru jdk24u-jdk-24-29.orig/make/RunTestsPrebuiltSpec.gmk jdk24u-jdk-24-29/make/RunTestsPrebuiltSpec.gmk
1495 --- jdk24u-jdk-24-29.orig/make/RunTestsPrebuiltSpec.gmk 2024-12-29 15:19:40.502513991 +0100
1496 +++ jdk24u-jdk-24-29/make/RunTestsPrebuiltSpec.gmk 2024-12-29 15:20:25.048055505 +0100
1497 @@ -173,6 +173,16 @@
1501 +# On Solaris gnu versions of some tools are required.
1502 +ifeq ($(OPENJDK_BUILD_OS), solaris)
1511 ifeq ($(OPENJDK_BUILD_OS), windows)
1514 diff -Nru jdk24u-jdk-24-29.orig/make/scripts/compare.sh jdk24u-jdk-24-29/make/scripts/compare.sh
1515 --- jdk24u-jdk-24-29.orig/make/scripts/compare.sh 2024-12-29 15:19:40.999058715 +0100
1516 +++ jdk24u-jdk-24-29/make/scripts/compare.sh 2024-12-29 15:20:25.063307605 +0100
1518 # Disassembly diff filters. These filters try to filter out ephemeral parts of the
1519 # disassembly, such as hard-coded addresses, to be able to catch "actual" differences.
1521 -if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
1522 +if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
1523 + if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
1524 + # Random strings looking like this differ: <.XAKoKoPIac2W0OA.
1525 + DIS_DIFF_FILTER="$SED \
1526 + -e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \
1529 +elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
1530 DIS_DIFF_FILTER="$SED -r \
1531 -e 's/^ [0-9A-F]{16}: //' \
1532 -e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
1533 @@ -385,7 +392,14 @@
1536 CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
1537 - $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
1538 + # On solaris, there is no -q option.
1539 + if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
1540 + $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
1541 + | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
1542 + > $CONTENTS_DIFF_FILE
1544 + $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
1547 ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
1548 ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
1549 @@ -407,8 +421,14 @@
1552 if [ "$CMP_ZIPS_CONTENTS" = "true" ]; then
1553 - DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
1554 - | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
1555 + if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
1556 + DIFFING_FILES=$($GREP -e 'differ$' -e '^diff ' $CONTENTS_DIFF_FILE \
1557 + | $SED -e 's/^Files //g' -e 's/diff -r //g' | $CUT -f 1 -d ' ' \
1558 + | $SED "s|$OTHER_UNZIPDIR/||g")
1560 + DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
1561 + | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
1564 # Separate executable/library files from other files in zip.
1566 @@ -756,6 +776,10 @@
1567 # to filter out that extra information.
1568 $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
1569 $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
1570 + elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
1571 + # Some symbols get seemingly random 15 character prefixes. Filter them out.
1572 + $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
1573 + $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
1574 elif [ "$OPENJDK_TARGET_OS" = "aix" ]; then
1575 $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
1576 $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
1577 diff -Nru jdk24u-jdk-24-29.orig/make/scripts/hide_important_warnings_from_javac.sh jdk24u-jdk-24-29/make/scripts/hide_important_warnings_from_javac.sh
1578 --- jdk24u-jdk-24-29.orig/make/scripts/hide_important_warnings_from_javac.sh 2024-12-29 15:19:40.998265976 +0100
1579 +++ jdk24u-jdk-24-29/make/scripts/hide_important_warnings_from_javac.sh 2024-12-29 15:20:25.063631963 +0100
1586 +if [ -x /usr/bin/ggrep ] ; then
1587 + # Gnu grep on Solaris
1588 + # (reference configure and build/solaris-i586-clientANDserver-release/spec.gmk
1589 + GREP=/usr/bin/ggrep
1594 EXP="Note: Some input files use or override a deprecated API."
1595 EXP="${EXP}|Note: Recompile with -Xlint:deprecation for details."
1596 diff -Nru jdk24u-jdk-24-29.orig/make/test/JtregNativeHotspot.gmk jdk24u-jdk-24-29/make/test/JtregNativeHotspot.gmk
1597 --- jdk24u-jdk-24-29.orig/make/test/JtregNativeHotspot.gmk 2024-12-29 15:19:40.972190461 +0100
1598 +++ jdk24u-jdk-24-29/make/test/JtregNativeHotspot.gmk 2024-12-29 15:20:25.064365661 +0100
1599 @@ -883,6 +883,10 @@
1600 BUILD_HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libatExit := java.base:libjvm
1601 BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exedaemonDestroy := java.base:libjvm
1603 +ifeq ($(call isTargetOs, solaris), true)
1604 + BUILD_HOTSPOT_JTREG_EXCLUDE += libterminatedThread.c
1607 ifeq ($(call isTargetOs, windows), true)
1608 BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
1609 BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c libTestJNI.c libCompleteExit.c libMonitorWithDeadObjectTest.c libTestPsig.c exeGetCreatedJavaVMs.c libTestUnloadedClass.cpp
1610 diff -Nru jdk24u-jdk-24-29.orig/make/test/JtregNativeJdk.gmk jdk24u-jdk-24-29/make/test/JtregNativeJdk.gmk
1611 --- jdk24u-jdk-24-29.orig/make/test/JtregNativeJdk.gmk 2024-12-29 15:19:40.972486023 +0100
1612 +++ jdk24u-jdk-24-29/make/test/JtregNativeJdk.gmk 2024-12-29 15:20:25.064883320 +0100
1614 BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeCallerAccessTest := java.base:libjvm
1615 BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeNullCallerTest := java.base:libjvm
1617 -BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava
1618 +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava java.base:libjvm
1619 BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libTracePinnedThreads := java.base:libjvm
1620 -BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libNewDirectByteBuffer := java.base:libjava
1621 -BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava
1622 +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libNewDirectByteBuffer := java.base:libjava java.base:libjvm
1623 +BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava java.base:libjvm
1625 # Platform specific setup
1626 ifeq ($(call isTargetOs, windows), true)
1628 BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib
1629 BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeNullCallerTest := /EHsc
1631 - BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libDirectIO := java.base:libjava
1632 + BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libDirectIO := java.base:libjava java.base:libjvm
1633 BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeThread := -pthread
1635 # java.lang.foreign tests
1637 ifeq ($(call isTargetOs, linux), true)
1638 BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libInheritedChannel := java.base:libjava
1639 BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl
1640 + else ifeq ($(call isTargetOs, solaris), true)
1641 + BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libInheritedChannel := java.base:libjava java.base:libjvm
1642 + BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -lsocket -lnsl -lthread -ldl
1644 BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX)
1646 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/cpu/x86/globalDefinitions_x86.hpp jdk24u-jdk-24-29/src/hotspot/cpu/x86/globalDefinitions_x86.hpp
1647 --- jdk24u-jdk-24-29.orig/src/hotspot/cpu/x86/globalDefinitions_x86.hpp 2024-12-29 15:19:43.881468590 +0100
1648 +++ jdk24u-jdk-24-29/src/hotspot/cpu/x86/globalDefinitions_x86.hpp 2024-12-29 15:20:25.065428060 +0100
1650 #define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE
1653 -#if defined(LINUX) || defined(__APPLE__)
1654 +#if defined(LINUX) || defined(SOLARIS) || defined(__APPLE__)
1655 #define SUPPORT_RESERVED_STACK_AREA
1658 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/os/posix/include/jvm_md.h jdk24u-jdk-24-29/src/hotspot/os/posix/include/jvm_md.h
1659 --- jdk24u-jdk-24-29.orig/src/hotspot/os/posix/include/jvm_md.h 2024-12-29 15:19:43.850726619 +0100
1660 +++ jdk24u-jdk-24-29/src/hotspot/os/posix/include/jvm_md.h 2024-12-29 15:20:25.065874413 +0100
1663 #define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX
1666 +#if defined(AIX) || defined(SOLARIS)
1667 #define JVM_MAXPATHLEN MAXPATHLEN
1669 // Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may
1671 #define JVM_SIGTERM SIGTERM
1673 #define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
1675 +#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */
1677 #define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
1678 #define SHUTDOWN2_SIGNAL SIGINT
1679 #define SHUTDOWN3_SIGNAL SIGTERM
1680 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/os/posix/os_posix.cpp jdk24u-jdk-24-29/src/hotspot/os/posix/os_posix.cpp
1681 --- jdk24u-jdk-24-29.orig/src/hotspot/os/posix/os_posix.cpp 2024-12-29 15:19:43.851756327 +0100
1682 +++ jdk24u-jdk-24-29/src/hotspot/os/posix/os_posix.cpp 2024-12-29 15:20:25.066524583 +0100
1684 st->print("%ld", sysconf(_SC_CHILD_MAX));
1686 print_rlimit(st, ", THREADS", RLIMIT_THREADS);
1688 +#elif !defined(SOLARIS)
1689 print_rlimit(st, ", NPROC", RLIMIT_NPROC);
1692 @@ -614,6 +614,12 @@
1693 print_rlimit(st, ", MEMLOCK", RLIMIT_MEMLOCK, true);
1696 +#if defined(SOLARIS)
1697 + // maximum size of mapped address space of a process in bytes;
1698 + // if the limit is exceeded, mmap and brk fail
1699 + print_rlimit(st, ", VMEM", RLIMIT_VMEM, true);
1702 // MacOS; The maximum size (in bytes) to which a process's resident set size may grow.
1703 #if defined(__APPLE__)
1704 print_rlimit(st, ", RSS", RLIMIT_RSS, true);
1705 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/os/posix/os_posix.inline.hpp jdk24u-jdk-24-29/src/hotspot/os/posix/os_posix.inline.hpp
1706 --- jdk24u-jdk-24-29.orig/src/hotspot/os/posix/os_posix.inline.hpp 2024-12-29 15:19:43.853207918 +0100
1707 +++ jdk24u-jdk-24-29/src/hotspot/os/posix/os_posix.inline.hpp 2024-12-29 15:20:25.066856941 +0100
1709 #include <sys/socket.h>
1713 // Aix does not have NUMA support but need these for compilation.
1714 inline bool os::numa_has_group_homing() { AIX_ONLY(ShouldNotReachHere();) return false; }
1717 // Platform Mutex/Monitor implementation
1719 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/os/posix/vmError_posix.cpp jdk24u-jdk-24-29/src/hotspot/os/posix/vmError_posix.cpp
1720 --- jdk24u-jdk-24-29.orig/src/hotspot/os/posix/vmError_posix.cpp 2024-12-29 15:19:43.852643683 +0100
1721 +++ jdk24u-jdk-24-29/src/hotspot/os/posix/vmError_posix.cpp 2024-12-29 15:20:25.067184764 +0100
1723 #include <sys/syscall.h>
1727 +#include <thread.h>
1732 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/c1/c1_LIR.cpp jdk24u-jdk-24-29/src/hotspot/share/c1/c1_LIR.cpp
1733 --- jdk24u-jdk-24-29.orig/src/hotspot/share/c1/c1_LIR.cpp 2024-12-29 15:19:44.561293086 +0100
1734 +++ jdk24u-jdk-24-29/src/hotspot/share/c1/c1_LIR.cpp 2024-12-29 15:20:25.067897390 +0100
1736 case lir_monaddr: // input and result always valid, info always invalid
1737 case lir_null_check: // input and info always valid, result always invalid
1738 case lir_move: // input and result always valid, may have info
1739 + case lir_pack64: // input and result always valid
1740 + case lir_unpack64: // input and result always valid
1742 assert(op->as_Op1() != nullptr, "must be");
1743 LIR_Op1* op1 = (LIR_Op1*)op;
1744 @@ -1736,6 +1738,8 @@
1745 case lir_convert: s = "convert"; break;
1746 case lir_alloc_object: s = "alloc_obj"; break;
1747 case lir_monaddr: s = "mon_addr"; break;
1748 + case lir_pack64: s = "pack64"; break;
1749 + case lir_unpack64: s = "unpack64"; break;
1751 case lir_cmp: s = "cmp"; break;
1752 case lir_cmp_l2i: s = "cmp_l2i"; break;
1753 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/c1/c1_LIR.hpp jdk24u-jdk-24-29/src/hotspot/share/c1/c1_LIR.hpp
1754 --- jdk24u-jdk-24-29.orig/src/hotspot/share/c1/c1_LIR.hpp 2024-12-29 15:19:44.562078817 +0100
1755 +++ jdk24u-jdk-24-29/src/hotspot/share/c1/c1_LIR.hpp 2024-12-29 15:20:25.068700119 +0100
1765 @@ -2239,6 +2241,9 @@
1766 void logical_or (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or, left, right, dst)); }
1767 void logical_xor (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_xor, left, right, dst)); }
1769 + void pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64, src, dst, T_LONG, lir_patch_none, NULL)); }
1770 + void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
1772 void null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null = false);
1773 void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
1774 append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
1775 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/cds/classListParser.cpp jdk24u-jdk-24-29/src/hotspot/share/cds/classListParser.cpp
1776 --- jdk24u-jdk-24-29.orig/src/hotspot/share/cds/classListParser.cpp 2024-12-29 15:19:44.325037907 +0100
1777 +++ jdk24u-jdk-24-29/src/hotspot/share/cds/classListParser.cpp 2024-12-29 15:20:25.069282551 +0100
1779 // This function is used for loading classes for customized class loaders
1780 // during archive dumping.
1781 InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
1782 -#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__) || defined(_WINDOWS)))
1783 +#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(__APPLE__) || defined(_WINDOWS)))
1784 // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
1785 // (3) MacOSX/64-bit and (4) Windowss/64-bit
1786 // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
1787 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/nmt/memTracker.cpp jdk24u-jdk-24-29/src/hotspot/share/nmt/memTracker.cpp
1788 --- jdk24u-jdk-24-29.orig/src/hotspot/share/nmt/memTracker.cpp 2024-12-29 15:19:44.514278783 +0100
1789 +++ jdk24u-jdk-24-29/src/hotspot/share/nmt/memTracker.cpp 2024-12-29 15:20:25.070636942 +0100
1791 #include <windows.h>
1795 + volatile bool NMT_stack_walkable = false;
1797 + volatile bool NMT_stack_walkable = true;
1800 NMT_TrackingLevel MemTracker::_tracking_level = NMT_unknown;
1802 MemBaseline MemTracker::_baseline;
1803 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/nmt/memTracker.hpp jdk24u-jdk-24-29/src/hotspot/share/nmt/memTracker.hpp
1804 --- jdk24u-jdk-24-29.orig/src/hotspot/share/nmt/memTracker.hpp 2024-12-29 15:19:44.515838269 +0100
1805 +++ jdk24u-jdk-24-29/src/hotspot/share/nmt/memTracker.hpp 2024-12-29 15:20:25.070989421 +0100
1807 #include "utilities/debug.hpp"
1808 #include "utilities/nativeCallStack.hpp"
1810 -#define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail) ? \
1811 +extern volatile bool NMT_stack_walkable;
1813 +#define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \
1814 NativeCallStack(0) : FAKE_CALLSTACK)
1815 -#define CALLER_PC ((MemTracker::tracking_level() == NMT_detail) ? \
1816 +#define CALLER_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \
1817 NativeCallStack(1) : FAKE_CALLSTACK)
1820 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/runtime/abstract_vm_version.cpp jdk24u-jdk-24-29/src/hotspot/share/runtime/abstract_vm_version.cpp
1821 --- jdk24u-jdk-24-29.orig/src/hotspot/share/runtime/abstract_vm_version.cpp 2024-12-29 15:19:44.432849856 +0100
1822 +++ jdk24u-jdk-24-29/src/hotspot/share/runtime/abstract_vm_version.cpp 2024-12-29 15:20:25.069877513 +0100
1825 #define OS LINUX_ONLY("linux") \
1826 WINDOWS_ONLY("windows") \
1827 + SOLARIS_ONLY("solaris") \
1831 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/runtime/semaphore.hpp jdk24u-jdk-24-29/src/hotspot/share/runtime/semaphore.hpp
1832 --- jdk24u-jdk-24-29.orig/src/hotspot/share/runtime/semaphore.hpp 2024-12-29 15:19:44.435349254 +0100
1833 +++ jdk24u-jdk-24-29/src/hotspot/share/runtime/semaphore.hpp 2024-12-29 15:20:25.070209400 +0100
1835 #include "memory/allocation.hpp"
1836 #include "utilities/globalDefinitions.hpp"
1838 -#if defined(LINUX) || defined(AIX)
1839 +#if defined(LINUX) || defined(SOLARIS) || defined(AIX)
1840 # include "semaphore_posix.hpp"
1842 # include OS_HEADER(semaphore)
1843 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/services/dtraceAttacher.cpp jdk24u-jdk-24-29/src/hotspot/share/services/dtraceAttacher.cpp
1844 --- jdk24u-jdk-24-29.orig/src/hotspot/share/services/dtraceAttacher.cpp 1970-01-01 01:00:00.000000000 +0100
1845 +++ jdk24u-jdk-24-29/src/hotspot/share/services/dtraceAttacher.cpp 2024-12-29 15:20:25.108656505 +0100
1848 + * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
1849 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1851 + * This code is free software; you can redistribute it and/or modify it
1852 + * under the terms of the GNU General Public License version 2 only, as
1853 + * published by the Free Software Foundation.
1855 + * This code is distributed in the hope that it will be useful, but WITHOUT
1856 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1857 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1858 + * version 2 for more details (a copy is included in the LICENSE file that
1859 + * accompanied this code).
1861 + * You should have received a copy of the GNU General Public License version
1862 + * 2 along with this work; if not, write to the Free Software Foundation,
1863 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1865 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1866 + * or visit www.oracle.com if you need additional information or have any
1871 +#include "precompiled.hpp"
1872 +#include "code/codeCache.hpp"
1873 +#include "memory/resourceArea.hpp"
1874 +#include "runtime/deoptimization.hpp"
1875 +#include "runtime/flags/jvmFlag.hpp"
1876 +#include "runtime/vmThread.hpp"
1877 +#include "runtime/vmOperations.hpp"
1878 +#include "services/dtraceAttacher.hpp"
1879 +#include "runtime/flags/jvmFlagAccess.hpp"
1883 +static void set_bool_flag(const char* name, bool value) {
1884 + JVMFlag* flag = JVMFlag::find_flag(name);
1885 + JVMFlagAccess::set_bool(flag, &value, JVMFlagOrigin::ATTACH_ON_DEMAND);
1888 +// Enable the "fine grained" flags.
1889 +void DTrace::enable_dprobes(int probes) {
1890 + bool changed = false;
1891 + if (!DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) {
1892 + set_bool_flag("DTraceAllocProbes", true);
1895 + if (!DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) {
1896 + set_bool_flag("DTraceMethodProbes", true);
1899 + if (!DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) {
1900 + set_bool_flag("DTraceMonitorProbes", true);
1905 + // one or more flags changed, need to deoptimize
1906 + DeoptimizationScope deopt_scope;
1907 + CodeCache::mark_all_nmethods_for_deoptimization(&deopt_scope);
1908 + deopt_scope.deoptimize_marked();
1912 +// Disable the "fine grained" flags.
1913 +void DTrace::disable_dprobes(int probes) {
1914 + bool changed = false;
1915 + if (DTraceAllocProbes && (probes & DTRACE_ALLOC_PROBES)) {
1916 + set_bool_flag("DTraceAllocProbes", false);
1919 + if (DTraceMethodProbes && (probes & DTRACE_METHOD_PROBES)) {
1920 + set_bool_flag("DTraceMethodProbes", false);
1923 + if (DTraceMonitorProbes && (probes & DTRACE_MONITOR_PROBES)) {
1924 + set_bool_flag("DTraceMonitorProbes", false);
1928 + // one or more flags changed, need to deoptimize
1929 + DeoptimizationScope deopt_scope;
1930 + CodeCache::mark_all_nmethods_for_deoptimization(&deopt_scope);
1931 + deopt_scope.deoptimize_marked();
1935 +// Do clean-up on "all door clients detached" event.
1936 +void DTrace::detach_all_clients() {
1937 + disable_dprobes(DTRACE_ALL_PROBES);
1940 +void DTrace::set_monitor_dprobes(bool flag) {
1941 + // explicit setting of DTraceMonitorProbes flag
1942 + set_bool_flag("DTraceMonitorProbes", flag);
1945 +#endif /* SOLARIS */
1946 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/debug.cpp jdk24u-jdk-24-29/src/hotspot/share/utilities/debug.cpp
1947 --- jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/debug.cpp 2024-12-29 15:19:44.107612010 +0100
1948 +++ jdk24u-jdk-24-29/src/hotspot/share/utilities/debug.cpp 2024-12-29 15:20:25.071553653 +0100
1949 @@ -620,11 +620,12 @@
1950 tty->print_cr(" findm(intptr_t pc) - finds Method*");
1951 tty->print_cr(" find(intptr_t x) - finds & prints nmethod/stub/bytecode/oop based on pointer into it");
1952 tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g.");
1953 - tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 or");
1954 + tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or");
1955 tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or");
1956 tty->print_cr(" pns($sp, $fp, $pc) on Linux/AArch64 or");
1957 tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or");
1958 tty->print_cr(" pns($sp, $s8, $pc) on Linux/mips or");
1959 + tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC");
1960 tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()");
1961 tty->print_cr(" - in dbx do 'frame 1' before calling pns()");
1962 tty->print_cr("class metadata.");
1963 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/globalDefinitions_gcc.hpp jdk24u-jdk-24-29/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
1964 --- jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/globalDefinitions_gcc.hpp 2024-12-29 15:19:44.097041012 +0100
1965 +++ jdk24u-jdk-24-29/src/hotspot/share/utilities/globalDefinitions_gcc.hpp 2024-12-29 15:20:25.072004166 +0100
1971 +#include <ieeefp.h>
1978 #include <pthread.h>
1981 +#include <thread.h>
1988 +#include <sys/trap.h>
1989 +#include <sys/regset.h>
1990 +#include <sys/procset.h>
1991 +#include <ucontext.h>
1992 +#include <setjmp.h>
1993 +#include <inttypes.h>
1996 #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX)
2000 #include <sys/time.h>
2001 #endif // LINUX || _ALLBSD_SOURCE
2003 +// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
2004 +// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
2005 +// system header files. On 32-bit architectures, there is no problem.
2006 +// On 64-bit architectures, defining NULL as a 32-bit constant can cause
2007 +// problems with varargs functions: C++ integral promotion rules say for
2008 +// varargs, we pass the argument 0 as an int. So, if NULL was passed to a
2009 +// varargs function it will remain 32-bits. Depending on the calling
2010 +// convention of the machine, if the argument is passed on the stack then
2011 +// only 32-bits of the "NULL" pointer may be initialized to zero. The
2012 +// other 32-bits will be garbage. If the varargs function is expecting a
2013 +// pointer when it extracts the argument, then we have a problem.
2015 +// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
2017 +// Note: this fix doesn't work well on Linux because NULL will be overwritten
2018 +// whenever a system header file is included. Linux handles NULL correctly
2019 +// through a special type '__null'.
2027 +// NOTE:In the ANSI committee's continuing attempt to make each version
2028 +// of C++ incompatible with the previous version, you can no longer cast
2029 +// pointers to functions without specifying linkage unless you want to get
2032 +// This also means that pointers to functions can no longer be "hidden"
2033 +// in opaque types like void * because at the invocation point warnings
2034 +// will be generated. While this makes perfect sense from a type safety
2035 +// point of view it causes a lot of warnings on old code using C header
2036 +// files. Here are some typedefs to make the job of silencing warnings
2039 +// The final kick in the teeth is that you can only have extern "C" linkage
2040 +// specified at file scope. So these typedefs are here rather than in the
2041 +// .hpp for the class (os:Solaris usually) that needs them.
2044 + typedef int (*int_fnP_thread_t_iP_uP_stack_tP_gregset_t)(thread_t, int*, unsigned *, stack_t*, gregset_t);
2045 + typedef int (*int_fnP_thread_t_i_gregset_t)(thread_t, int, gregset_t);
2046 + typedef int (*int_fnP_thread_t_i)(thread_t, int);
2047 + typedef int (*int_fnP_thread_t)(thread_t);
2049 + typedef int (*int_fnP_cond_tP_mutex_tP_timestruc_tP)(cond_t *cv, mutex_t *mx, timestruc_t *abst);
2050 + typedef int (*int_fnP_cond_tP_mutex_tP)(cond_t *cv, mutex_t *mx);
2052 + // typedef for missing API in libc
2053 + typedef int (*int_fnP_mutex_tP_i_vP)(mutex_t *, int, void *);
2054 + typedef int (*int_fnP_mutex_tP)(mutex_t *);
2055 + typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
2056 + typedef int (*int_fnP_cond_tP)(cond_t *cv);
2060 // checking for nanness
2061 -#if defined(__APPLE__)
2064 +inline int g_isnan(float f) { return isnanf(f); }
2066 +// isnanf() broken on Intel Solaris use isnand()
2067 +inline int g_isnan(float f) { return isnand(f); }
2069 +inline int g_isnan(double f) { return isnand(f); }
2070 +#elif defined(__APPLE__)
2071 inline int g_isnan(double f) { return isnan(f); }
2072 #elif defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX)
2073 inline int g_isnan(float f) { return isnan(f); }
2074 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/macros.hpp jdk24u-jdk-24-29/src/hotspot/share/utilities/macros.hpp
2075 --- jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/macros.hpp 2024-12-29 15:19:44.105856555 +0100
2076 +++ jdk24u-jdk-24-29/src/hotspot/share/utilities/macros.hpp 2024-12-29 15:20:25.072407199 +0100
2077 @@ -403,6 +403,14 @@
2078 #define NOT_AIX(code) code
2082 +#define SOLARIS_ONLY(code) code
2083 +#define NOT_SOLARIS(code)
2085 +#define SOLARIS_ONLY(code)
2086 +#define NOT_SOLARIS(code) code
2090 #define WINDOWS_ONLY(code) code
2091 #define NOT_WINDOWS(code)
2092 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/ostream.cpp jdk24u-jdk-24-29/src/hotspot/share/utilities/ostream.cpp
2093 --- jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/ostream.cpp 2024-12-29 15:19:44.101737493 +0100
2094 +++ jdk24u-jdk-24-29/src/hotspot/share/utilities/ostream.cpp 2024-12-29 15:20:25.072857953 +0100
2095 @@ -1074,7 +1074,7 @@
2099 -#if defined(LINUX) || defined(AIX) || defined(_ALLBSD_SOURCE)
2100 +#if defined(SOLARIS) || defined(LINUX) || defined(AIX) || defined(_ALLBSD_SOURCE)
2101 #include <sys/types.h>
2102 #include <sys/socket.h>
2103 #include <netinet/in.h>
2104 diff -Nru jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/vmError.cpp jdk24u-jdk-24-29/src/hotspot/share/utilities/vmError.cpp
2105 --- jdk24u-jdk-24-29.orig/src/hotspot/share/utilities/vmError.cpp 2024-12-29 15:19:44.095861158 +0100
2106 +++ jdk24u-jdk-24-29/src/hotspot/share/utilities/vmError.cpp 2024-12-29 15:20:25.073637466 +0100
2107 @@ -1915,6 +1915,8 @@
2108 out.print_raw ("# Executing ");
2109 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
2110 out.print_raw ("/bin/sh -c ");
2111 +#elif defined(SOLARIS)
2112 + out.print_raw ("/usr/bin/sh -c ");
2113 #elif defined(_WINDOWS)
2114 out.print_raw ("cmd /C ");
2116 @@ -1979,6 +1981,8 @@
2117 tty->print("# Executing ");
2119 tty->print ("/bin/sh -c ");
2120 +#elif defined(SOLARIS)
2121 + tty->print ("/usr/bin/sh -c ");
2123 tty->print_cr("\"%s\"...", cmd);
2125 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/classes/sun/net/sdp/SdpSupport.java jdk24u-jdk-24-29/src/java.base/share/classes/sun/net/sdp/SdpSupport.java
2126 --- jdk24u-jdk-24-29.orig/src/java.base/share/classes/sun/net/sdp/SdpSupport.java 2024-12-29 15:19:43.498352670 +0100
2127 +++ jdk24u-jdk-24-29/src/java.base/share/classes/sun/net/sdp/SdpSupport.java 2024-12-29 15:20:25.074112180 +0100
2131 public final class SdpSupport {
2132 - private static final boolean isSupported = OperatingSystem.isLinux();
2133 + private static final boolean isSupported = (OperatingSystem.isSolaris() || OperatingSystem.isLinux());
2134 private static final JavaIOFileDescriptorAccess fdAccess =
2135 SharedSecrets.getJavaIOFileDescriptorAccess();
2137 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template jdk24u-jdk-24-29/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template
2138 --- jdk24u-jdk-24-29.orig/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template 2024-12-29 15:19:43.472817047 +0100
2139 +++ jdk24u-jdk-24-29/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template 2024-12-29 15:20:25.074604670 +0100
2141 #define SO_REUSEPORT 0
2142 #elif defined(__linux__)
2143 #define SO_REUSEPORT 15
2144 +#elif defined(__solaris__)
2145 +#define SO_REUSEPORT 0x100e
2146 #elif defined(AIX) || defined(MACOSX)
2147 #define SO_REUSEPORT 0x0200
2153 +/* On Solaris, "sun" is defined as a macro. Undefine to make package
2154 + declaration valid */
2157 /* To be able to name the Java constants the same as the C constants without
2158 having the preprocessor rewrite those identifiers, add PREFIX_ to all
2159 identifiers matching a C constant. The PREFIX_ is filtered out in the
2160 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/conf/security/java.security jdk24u-jdk-24-29/src/java.base/share/conf/security/java.security
2161 --- jdk24u-jdk-24-29.orig/src/java.base/share/conf/security/java.security 2024-12-29 15:19:43.537205794 +0100
2162 +++ jdk24u-jdk-24-29/src/java.base/share/conf/security/java.security 2024-12-29 15:20:25.075192139 +0100
2163 @@ -110,7 +110,11 @@
2165 security.provider.tbd=Apple
2168 +security.provider.tbd=SunPKCS11 ${java.home}/conf/security/sunpkcs11-solaris.cfg
2170 security.provider.tbd=SunPKCS11
2174 # A list of preferred providers for specific algorithms. These providers will
2175 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/native/libjli/jli_util.h jdk24u-jdk-24-29/src/java.base/share/native/libjli/jli_util.h
2176 --- jdk24u-jdk-24-29.orig/src/java.base/share/native/libjli/jli_util.h 2024-12-29 15:19:43.628607287 +0100
2177 +++ jdk24u-jdk-24-29/src/java.base/share/native/libjli/jli_util.h 2024-12-29 15:20:25.075605933 +0100
2178 @@ -100,7 +100,11 @@
2179 #define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2))
2180 #define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3))
2181 #define JLI_Open open
2183 +#define JLI_Lseek llseek
2185 #define JLI_Lseek lseek
2190 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/native/libnet/net_util.c jdk24u-jdk-24-29/src/java.base/share/native/libnet/net_util.c
2191 --- jdk24u-jdk-24-29.orig/src/java.base/share/native/libnet/net_util.c 2024-12-29 15:19:43.600585892 +0100
2192 +++ jdk24u-jdk-24-29/src/java.base/share/native/libnet/net_util.c 2024-12-29 15:20:25.076024087 +0100
2195 /* check if SO_REUSEPORT is supported on this platform */
2196 REUSEPORT_available = reuseport_supported(IPv6_available);
2197 + parseExclusiveBindProperty(env);
2199 return JNI_VERSION_1_2;
2201 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/share/native/libnet/net_util.h jdk24u-jdk-24-29/src/java.base/share/native/libnet/net_util.h
2202 --- jdk24u-jdk-24-29.orig/src/java.base/share/native/libnet/net_util.h 2024-12-29 15:19:43.601050400 +0100
2203 +++ jdk24u-jdk-24-29/src/java.base/share/native/libnet/net_util.h 2024-12-29 15:20:25.076362529 +0100
2205 JNIEXPORT jobject JNICALL
2206 NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port);
2208 +void parseExclusiveBindProperty(JNIEnv *env);
2210 JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(SOCKETADDRESS *sa);
2212 JNIEXPORT jboolean JNICALL
2213 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
2214 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java 1970-01-01 01:00:00.000000000 +0100
2215 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java 2024-12-29 15:20:25.109126542 +0100
2218 + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2219 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2221 + * This code is free software; you can redistribute it and/or modify it
2222 + * under the terms of the GNU General Public License version 2 only, as
2223 + * published by the Free Software Foundation. Oracle designates this
2224 + * particular file as subject to the "Classpath" exception as provided
2225 + * by Oracle in the LICENSE file that accompanied this code.
2227 + * This code is distributed in the hope that it will be useful, but WITHOUT
2228 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2229 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2230 + * version 2 for more details (a copy is included in the LICENSE file that
2231 + * accompanied this code).
2233 + * You should have received a copy of the GNU General Public License version
2234 + * 2 along with this work; if not, write to the Free Software Foundation,
2235 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2237 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2238 + * or visit www.oracle.com if you need additional information or have any
2242 +package sun.nio.ch;
2244 +import java.nio.channels.spi.AsynchronousChannelProvider;
2247 + * Creates this platform's default AsynchronousChannelProvider
2250 +public class DefaultAsynchronousChannelProvider {
2253 + * Prevent instantiation.
2255 + private DefaultAsynchronousChannelProvider() { }
2258 + * Returns the default AsynchronousChannelProvider.
2260 + public static AsynchronousChannelProvider create() {
2261 + return new SolarisAsynchronousChannelProvider();
2264 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java
2265 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java 1970-01-01 01:00:00.000000000 +0100
2266 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java 2024-12-29 15:20:25.109394984 +0100
2269 + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2270 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2272 + * This code is free software; you can redistribute it and/or modify it
2273 + * under the terms of the GNU General Public License version 2 only, as
2274 + * published by the Free Software Foundation. Oracle designates this
2275 + * particular file as subject to the "Classpath" exception as provided
2276 + * by Oracle in the LICENSE file that accompanied this code.
2278 + * This code is distributed in the hope that it will be useful, but WITHOUT
2279 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2280 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2281 + * version 2 for more details (a copy is included in the LICENSE file that
2282 + * accompanied this code).
2284 + * You should have received a copy of the GNU General Public License version
2285 + * 2 along with this work; if not, write to the Free Software Foundation,
2286 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2288 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2289 + * or visit www.oracle.com if you need additional information or have any
2293 +package sun.nio.ch;
2296 + * Creates this platform's default SelectorProvider
2299 +public class DefaultSelectorProvider {
2300 + private static final SelectorProviderImpl INSTANCE = new DevPollSelectorProvider();
2303 + * Prevent instantiation.
2305 + private DefaultSelectorProvider() { }
2308 + * Returns the default SelectorProvider implementation.
2310 + public static SelectorProviderImpl get() {
2314 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java
2315 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java 1970-01-01 01:00:00.000000000 +0100
2316 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java 2024-12-29 15:20:25.109694733 +0100
2319 + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
2320 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2322 + * This code is free software; you can redistribute it and/or modify it
2323 + * under the terms of the GNU General Public License version 2 only, as
2324 + * published by the Free Software Foundation. Oracle designates this
2325 + * particular file as subject to the "Classpath" exception as provided
2326 + * by Oracle in the LICENSE file that accompanied this code.
2328 + * This code is distributed in the hope that it will be useful, but WITHOUT
2329 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2330 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2331 + * version 2 for more details (a copy is included in the LICENSE file that
2332 + * accompanied this code).
2334 + * You should have received a copy of the GNU General Public License version
2335 + * 2 along with this work; if not, write to the Free Software Foundation,
2336 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2338 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2339 + * or visit www.oracle.com if you need additional information or have any
2343 +package sun.nio.ch;
2345 +import java.io.IOException;
2348 + * Manipulates a native array of pollfd structs on Solaris:
2350 + * typedef struct pollfd {
2356 + * @author Mike McCloskey
2360 +class DevPollArrayWrapper {
2362 + // special event to remove a file descriptor from the driver
2363 + static final short POLLREMOVE = 0x0800;
2365 + // struct pollfd constants
2366 + static final short SIZE_POLLFD = 8;
2367 + static final short FD_OFFSET = 0;
2368 + static final short EVENT_OFFSET = 4;
2369 + static final short REVENT_OFFSET = 6;
2371 + // maximum number of pollfd structure to poll or update at a time
2372 + // dpwrite/ioctl(DP_POLL) allows up to file descriptor limit minus 1
2373 + static final int NUM_POLLFDS = Math.min(IOUtil.fdLimit()-1, 1024);
2375 + // The pollfd array for results from devpoll driver
2376 + private final AllocatedNativeObject pollArray;
2378 + // Base address of the native pollArray
2379 + private final long pollArrayAddress;
2381 + // The fd of the devpoll driver
2384 + DevPollArrayWrapper() throws IOException {
2385 + this.wfd = init();
2387 + int allocationSize = NUM_POLLFDS * SIZE_POLLFD;
2388 + this.pollArray = new AllocatedNativeObject(allocationSize, true);
2389 + this.pollArrayAddress = pollArray.address();
2392 + void close() throws IOException {
2393 + FileDispatcherImpl.closeIntFD(wfd);
2397 + void register(int fd, int ops) throws IOException {
2398 + register(wfd, fd, ops);
2401 + void registerMultiple(int numfds) throws IOException {
2402 + registerMultiple(wfd, pollArrayAddress, numfds);
2405 + int poll(long timeout) throws IOException {
2406 + return poll0(pollArrayAddress, NUM_POLLFDS, timeout, wfd);
2409 + int getDescriptor(int i) {
2410 + int offset = SIZE_POLLFD * i + FD_OFFSET;
2411 + return pollArray.getInt(offset);
2414 + short getEventOps(int i) {
2415 + int offset = SIZE_POLLFD * i + EVENT_OFFSET;
2416 + return pollArray.getShort(offset);
2419 + short getReventOps(int i) {
2420 + int offset = SIZE_POLLFD * i + REVENT_OFFSET;
2421 + return pollArray.getShort(offset);
2425 + * Updates the pollfd structure at the given index
2427 + void putPollFD(int index, int fd, short event) {
2428 + int structIndex = SIZE_POLLFD * index;
2429 + pollArray.putInt(structIndex + FD_OFFSET, fd);
2430 + pollArray.putShort(structIndex + EVENT_OFFSET, event);
2431 + pollArray.putShort(structIndex + REVENT_OFFSET, (short)0);
2434 + private native int init() throws IOException;
2435 + private native void register(int wfd, int fd, int mask) throws IOException;
2436 + private native void registerMultiple(int wfd, long address, int len)
2437 + throws IOException;
2438 + private native int poll0(long pollAddress, int numfds, long timeout, int wfd)
2439 + throws IOException;
2445 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
2446 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java 1970-01-01 01:00:00.000000000 +0100
2447 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java 2024-12-29 15:20:25.110052606 +0100
2450 + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
2451 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2453 + * This code is free software; you can redistribute it and/or modify it
2454 + * under the terms of the GNU General Public License version 2 only, as
2455 + * published by the Free Software Foundation. Oracle designates this
2456 + * particular file as subject to the "Classpath" exception as provided
2457 + * by Oracle in the LICENSE file that accompanied this code.
2459 + * This code is distributed in the hope that it will be useful, but WITHOUT
2460 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2461 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2462 + * version 2 for more details (a copy is included in the LICENSE file that
2463 + * accompanied this code).
2465 + * You should have received a copy of the GNU General Public License version
2466 + * 2 along with this work; if not, write to the Free Software Foundation,
2467 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2469 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2470 + * or visit www.oracle.com if you need additional information or have any
2474 +package sun.nio.ch;
2476 +import java.io.IOException;
2477 +import java.nio.channels.ClosedSelectorException;
2478 +import java.nio.channels.SelectionKey;
2479 +import java.nio.channels.Selector;
2480 +import java.nio.channels.spi.SelectorProvider;
2481 +import java.util.ArrayDeque;
2482 +import java.util.Deque;
2483 +import java.util.HashMap;
2484 +import java.util.Map;
2485 +import java.util.concurrent.TimeUnit;
2486 +import java.util.function.Consumer;
2488 +import static sun.nio.ch.DevPollArrayWrapper.NUM_POLLFDS;
2489 +import static sun.nio.ch.DevPollArrayWrapper.POLLREMOVE;
2492 + * Solaris /dev/poll based Selector implementation
2495 +class DevPollSelectorImpl
2496 + extends SelectorImpl
2498 + // provides access to /dev/poll driver
2499 + private final DevPollArrayWrapper pollWrapper;
2501 + // file descriptors used for interrupt
2502 + private final int fd0;
2503 + private final int fd1;
2505 + // maps file descriptor to selection key, synchronize on selector
2506 + private final Map<Integer, SelectionKeyImpl> fdToKey = new HashMap<>();
2508 + // pending new registrations/updates, queued by setEventOps
2509 + private final Object updateLock = new Object();
2510 + private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
2512 + // interrupt triggering and clearing
2513 + private final Object interruptLock = new Object();
2514 + private boolean interruptTriggered;
2516 + DevPollSelectorImpl(SelectorProvider sp) throws IOException {
2518 + this.pollWrapper = new DevPollArrayWrapper();
2520 + long fds = IOUtil.makePipe(false);
2521 + this.fd0 = (int) (fds >>> 32);
2522 + this.fd1 = (int) fds;
2523 + } catch (IOException ioe) {
2524 + pollWrapper.close();
2528 + // register one end of the socket pair for wakeups
2529 + pollWrapper.register(fd0, Net.POLLIN);
2532 + private void ensureOpen() {
2534 + throw new ClosedSelectorException();
2538 + protected int doSelect(Consumer<SelectionKey> action, long timeout)
2539 + throws IOException
2541 + assert Thread.holdsLock(this);
2543 + long to = timeout;
2544 + boolean blocking = (to != 0);
2545 + boolean timedPoll = (to > 0);
2548 + processUpdateQueue();
2549 + processDeregisterQueue();
2554 + long startTime = timedPoll ? System.nanoTime() : 0;
2555 + numEntries = pollWrapper.poll(to);
2556 + if (numEntries == IOStatus.INTERRUPTED && timedPoll) {
2557 + // timed poll interrupted so need to adjust timeout
2558 + long adjust = System.nanoTime() - startTime;
2559 + to -= TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS);
2561 + // timeout expired so no retry
2565 + } while (numEntries == IOStatus.INTERRUPTED);
2566 + assert IOStatus.check(numEntries);
2571 + processDeregisterQueue();
2572 + return processEvents(numEntries, action);
2576 + * Process changes to the interest ops.
2578 + private void processUpdateQueue() throws IOException {
2579 + assert Thread.holdsLock(this);
2581 + synchronized (updateLock) {
2582 + SelectionKeyImpl ski;
2584 + // Translate the queued updates to changes to the set of monitored
2585 + // file descriptors. The changes are written to the /dev/poll driver
2588 + while ((ski = updateKeys.pollFirst()) != null) {
2589 + if (ski.isValid()) {
2590 + int fd = ski.getFDVal();
2591 + // add to fdToKey if needed
2592 + SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
2593 + assert (previous == null) || (previous == ski);
2595 + int newEvents = ski.translateInterestOps();
2596 + int registeredEvents = ski.registeredEvents();
2597 + if (newEvents != registeredEvents) {
2598 + if (registeredEvents != 0)
2599 + pollWrapper.putPollFD(index++, fd, POLLREMOVE);
2600 + if (newEvents != 0)
2601 + pollWrapper.putPollFD(index++, fd, (short)newEvents);
2602 + ski.registeredEvents(newEvents);
2604 + // write to /dev/poll
2605 + if (index > (NUM_POLLFDS-2)) {
2606 + pollWrapper.registerMultiple(index);
2613 + // write any remaining changes
2615 + pollWrapper.registerMultiple(index);
2620 + * Process the polled events.
2621 + * If the interrupt fd has been selected, drain it and clear the interrupt.
2623 + private int processEvents(int numEntries, Consumer<SelectionKey> action)
2624 + throws IOException
2626 + assert Thread.holdsLock(this);
2628 + boolean interrupted = false;
2629 + int numKeysUpdated = 0;
2630 + for (int i=0; i<numEntries; i++) {
2631 + int fd = pollWrapper.getDescriptor(i);
2633 + interrupted = true;
2635 + SelectionKeyImpl ski = fdToKey.get(fd);
2636 + if (ski != null) {
2637 + int rOps = pollWrapper.getReventOps(i);
2638 + numKeysUpdated += processReadyEvents(rOps, ski, action);
2643 + if (interrupted) {
2647 + return numKeysUpdated;
2651 + protected void implClose() throws IOException {
2653 + assert Thread.holdsLock(this);
2655 + // prevent further wakeup
2656 + synchronized (interruptLock) {
2657 + interruptTriggered = true;
2660 + pollWrapper.close();
2661 + FileDispatcherImpl.closeIntFD(fd0);
2662 + FileDispatcherImpl.closeIntFD(fd1);
2667 + protected void implDereg(SelectionKeyImpl ski) throws IOException {
2668 + assert !ski.isValid();
2669 + assert Thread.holdsLock(this);
2671 + int fd = ski.getFDVal();
2672 + if (fdToKey.remove(fd) != null) {
2673 + if (ski.registeredEvents() != 0) {
2674 + pollWrapper.register(fd, POLLREMOVE);
2675 + ski.registeredEvents(0);
2678 + assert ski.registeredEvents() == 0;
2683 + public void setEventOps(SelectionKeyImpl ski) {
2685 + synchronized (updateLock) {
2686 + updateKeys.addLast(ski);
2691 + public Selector wakeup() {
2692 + synchronized (interruptLock) {
2693 + if (!interruptTriggered) {
2695 + IOUtil.write1(fd1, (byte)0);
2696 + } catch (IOException ioe) {
2697 + throw new InternalError(ioe);
2699 + interruptTriggered = true;
2705 + private void clearInterrupt() throws IOException {
2706 + synchronized (interruptLock) {
2707 + IOUtil.drain(fd0);
2708 + interruptTriggered = false;
2712 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorProvider.java
2713 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorProvider.java 1970-01-01 01:00:00.000000000 +0100
2714 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/DevPollSelectorProvider.java 2024-12-29 15:20:25.110308958 +0100
2717 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2718 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2720 + * This code is free software; you can redistribute it and/or modify it
2721 + * under the terms of the GNU General Public License version 2 only, as
2722 + * published by the Free Software Foundation. Oracle designates this
2723 + * particular file as subject to the "Classpath" exception as provided
2724 + * by Oracle in the LICENSE file that accompanied this code.
2726 + * This code is distributed in the hope that it will be useful, but WITHOUT
2727 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2728 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2729 + * version 2 for more details (a copy is included in the LICENSE file that
2730 + * accompanied this code).
2732 + * You should have received a copy of the GNU General Public License version
2733 + * 2 along with this work; if not, write to the Free Software Foundation,
2734 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2736 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2737 + * or visit www.oracle.com if you need additional information or have any
2741 +package sun.nio.ch;
2743 +import java.io.IOException;
2744 +import java.nio.channels.*;
2745 +import java.nio.channels.spi.*;
2747 +public class DevPollSelectorProvider
2748 + extends SelectorProviderImpl
2750 + public AbstractSelector openSelector() throws IOException {
2751 + return new DevPollSelectorImpl(this);
2754 + public Channel inheritedChannel() throws IOException {
2755 + return InheritedChannel.getChannel();
2758 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorImpl.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorImpl.java
2759 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorImpl.java 1970-01-01 01:00:00.000000000 +0100
2760 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorImpl.java 2024-12-29 15:20:25.110683821 +0100
2763 + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
2764 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2766 + * This code is free software; you can redistribute it and/or modify it
2767 + * under the terms of the GNU General Public License version 2 only, as
2768 + * published by the Free Software Foundation. Oracle designates this
2769 + * particular file as subject to the "Classpath" exception as provided
2770 + * by Oracle in the LICENSE file that accompanied this code.
2772 + * This code is distributed in the hope that it will be useful, but WITHOUT
2773 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2774 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2775 + * version 2 for more details (a copy is included in the LICENSE file that
2776 + * accompanied this code).
2778 + * You should have received a copy of the GNU General Public License version
2779 + * 2 along with this work; if not, write to the Free Software Foundation,
2780 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2782 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2783 + * or visit www.oracle.com if you need additional information or have any
2787 +package sun.nio.ch;
2789 +import java.io.IOException;
2790 +import java.nio.channels.ClosedSelectorException;
2791 +import java.nio.channels.SelectionKey;
2792 +import java.nio.channels.Selector;
2793 +import java.nio.channels.spi.SelectorProvider;
2794 +import java.util.ArrayDeque;
2795 +import java.util.Deque;
2796 +import java.util.HashMap;
2797 +import java.util.Map;
2798 +import java.util.concurrent.TimeUnit;
2799 +import java.util.function.Consumer;
2801 +import static sun.nio.ch.SolarisEventPort.PORT_SOURCE_FD;
2802 +import static sun.nio.ch.SolarisEventPort.PORT_SOURCE_USER;
2803 +import static sun.nio.ch.SolarisEventPort.SIZEOF_PORT_EVENT;
2804 +import static sun.nio.ch.SolarisEventPort.OFFSETOF_EVENTS;
2805 +import static sun.nio.ch.SolarisEventPort.OFFSETOF_SOURCE;
2806 +import static sun.nio.ch.SolarisEventPort.OFFSETOF_OBJECT;
2807 +import static sun.nio.ch.SolarisEventPort.port_create;
2808 +import static sun.nio.ch.SolarisEventPort.port_close;
2809 +import static sun.nio.ch.SolarisEventPort.port_associate;
2810 +import static sun.nio.ch.SolarisEventPort.port_dissociate;
2811 +import static sun.nio.ch.SolarisEventPort.port_getn;
2812 +import static sun.nio.ch.SolarisEventPort.port_send;
2815 + * Selector implementation based on the Solaris event port mechanism.
2818 +class EventPortSelectorImpl
2819 + extends SelectorImpl
2821 + // maximum number of events to retrieve in one call to port_getn
2822 + static final int MAX_EVENTS = Math.min(IOUtil.fdLimit()-1, 1024);
2824 + // port file descriptor
2825 + private final int pfd;
2827 + // the poll array (populated by port_getn)
2828 + private final long pollArrayAddress;
2829 + private final AllocatedNativeObject pollArray;
2831 + // maps file descriptor to selection key, synchronize on selector
2832 + private final Map<Integer, SelectionKeyImpl> fdToKey = new HashMap<>();
2834 + // the last update operation, incremented by processUpdateQueue
2835 + private int lastUpdate;
2837 + // pending new registrations/updates, queued by setEventOps and
2838 + // updateSelectedKeys
2839 + private final Object updateLock = new Object();
2840 + private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
2842 + // interrupt triggering and clearing
2843 + private final Object interruptLock = new Object();
2844 + private boolean interruptTriggered;
2846 + EventPortSelectorImpl(SelectorProvider sp) throws IOException {
2849 + this.pfd = port_create();
2851 + int allocationSize = MAX_EVENTS * SIZEOF_PORT_EVENT;
2852 + this.pollArray = new AllocatedNativeObject(allocationSize, false);
2853 + this.pollArrayAddress = pollArray.address();
2856 + private void ensureOpen() {
2858 + throw new ClosedSelectorException();
2862 + protected int doSelect(Consumer<SelectionKey> action, long timeout)
2863 + throws IOException
2865 + assert Thread.holdsLock(this);
2867 + long to = timeout;
2868 + boolean blocking = (to != 0);
2869 + boolean timedPoll = (to > 0);
2872 + processUpdateQueue();
2873 + processDeregisterQueue();
2878 + long startTime = timedPoll ? System.nanoTime() : 0;
2879 + numEvents = port_getn(pfd, pollArrayAddress, MAX_EVENTS, to);
2880 + if (numEvents == IOStatus.INTERRUPTED && timedPoll) {
2881 + // timed poll interrupted so need to adjust timeout
2882 + long adjust = System.nanoTime() - startTime;
2883 + to -= TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS);
2885 + // timeout also expired so no retry
2889 + } while (numEvents == IOStatus.INTERRUPTED);
2890 + assert IOStatus.check(numEvents);
2895 + processDeregisterQueue();
2896 + return processPortEvents(numEvents, action);
2900 + * Process new registrations and changes to the interest ops.
2902 + private void processUpdateQueue() throws IOException {
2903 + assert Thread.holdsLock(this);
2905 + // bump lastUpdate to ensure that the interest ops are changed at most
2906 + // once per bulk update
2909 + synchronized (updateLock) {
2910 + SelectionKeyImpl ski;
2911 + while ((ski = updateKeys.pollFirst()) != null) {
2912 + if (ski.isValid()) {
2913 + int fd = ski.getFDVal();
2914 + // add to fdToKey if needed
2915 + SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
2916 + assert (previous == null) || (previous == ski);
2918 + int newEvents = ski.translateInterestOps();
2919 + if (newEvents != ski.registeredEvents()) {
2920 + if (newEvents == 0) {
2921 + port_dissociate(pfd, PORT_SOURCE_FD, fd);
2923 + port_associate(pfd, PORT_SOURCE_FD, fd, newEvents);
2925 + ski.registeredEvents(newEvents);
2933 + * Process the polled events and re-queue the selected keys so the file
2934 + * descriptors are re-associated at the next select operation.
2936 + private int processPortEvents(int numEvents, Consumer<SelectionKey> action)
2937 + throws IOException
2939 + assert Thread.holdsLock(this);
2941 + int numKeysUpdated = 0;
2942 + boolean interrupted = false;
2944 + // Process the polled events while holding the update lock. This allows
2945 + // keys to be queued for ready file descriptors so they can be
2946 + // re-associated at the next select. The selected-key can be updated
2948 + synchronized (updateLock) {
2949 + for (int i = 0; i < numEvents; i++) {
2950 + short source = getSource(i);
2951 + if (source == PORT_SOURCE_FD) {
2952 + int fd = getDescriptor(i);
2953 + SelectionKeyImpl ski = fdToKey.get(fd);
2954 + if (ski != null) {
2955 + ski.registeredEvents(0);
2956 + updateKeys.addLast(ski);
2958 + // update selected-key set if no action specified
2959 + if (action == null) {
2960 + int rOps = getEventOps(i);
2961 + numKeysUpdated += processReadyEvents(rOps, ski, null);
2965 + } else if (source == PORT_SOURCE_USER) {
2966 + interrupted = true;
2973 + // if an action specified then iterate over the polled events again so
2974 + // that the action is performed without holding the update lock.
2975 + if (action != null) {
2976 + for (int i = 0; i < numEvents; i++) {
2977 + short source = getSource(i);
2978 + if (source == PORT_SOURCE_FD) {
2979 + int fd = getDescriptor(i);
2980 + SelectionKeyImpl ski = fdToKey.get(fd);
2981 + if (ski != null) {
2982 + int rOps = getEventOps(i);
2983 + numKeysUpdated += processReadyEvents(rOps, ski, action);
2989 + if (interrupted) {
2992 + return numKeysUpdated;
2996 + protected void implClose() throws IOException {
2998 + assert Thread.holdsLock(this);
3000 + // prevent further wakeup
3001 + synchronized (interruptLock) {
3002 + interruptTriggered = true;
3010 + protected void implDereg(SelectionKeyImpl ski) throws IOException {
3011 + assert !ski.isValid();
3012 + assert Thread.holdsLock(this);
3014 + int fd = ski.getFDVal();
3015 + if (fdToKey.remove(fd) != null) {
3016 + if (ski.registeredEvents() != 0) {
3017 + port_dissociate(pfd, PORT_SOURCE_FD, fd);
3018 + ski.registeredEvents(0);
3021 + assert ski.registeredEvents() == 0;
3026 + public void setEventOps(SelectionKeyImpl ski) {
3028 + synchronized (updateLock) {
3029 + updateKeys.addLast(ski);
3034 + public Selector wakeup() {
3035 + synchronized (interruptLock) {
3036 + if (!interruptTriggered) {
3038 + port_send(pfd, 0);
3039 + } catch (IOException ioe) {
3040 + throw new InternalError(ioe);
3042 + interruptTriggered = true;
3048 + private void clearInterrupt() throws IOException {
3049 + synchronized (interruptLock) {
3050 + interruptTriggered = false;
3054 + private short getSource(int i) {
3055 + int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_SOURCE;
3056 + return pollArray.getShort(offset);
3059 + private int getEventOps(int i) {
3060 + int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_EVENTS;
3061 + return pollArray.getInt(offset);
3064 + private int getDescriptor(int i) {
3065 + //assert Unsafe.getUnsafe().addressSize() == 8;
3066 + int offset = SIZEOF_PORT_EVENT * i + OFFSETOF_OBJECT;
3067 + return (int) pollArray.getLong(offset);
3070 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorProvider.java
3071 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorProvider.java 1970-01-01 01:00:00.000000000 +0100
3072 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/EventPortSelectorProvider.java 2024-12-29 15:20:25.110940058 +0100
3075 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3076 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3078 + * This code is free software; you can redistribute it and/or modify it
3079 + * under the terms of the GNU General Public License version 2 only, as
3080 + * published by the Free Software Foundation. Oracle designates this
3081 + * particular file as subject to the "Classpath" exception as provided
3082 + * by Oracle in the LICENSE file that accompanied this code.
3084 + * This code is distributed in the hope that it will be useful, but WITHOUT
3085 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3086 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3087 + * version 2 for more details (a copy is included in the LICENSE file that
3088 + * accompanied this code).
3090 + * You should have received a copy of the GNU General Public License version
3091 + * 2 along with this work; if not, write to the Free Software Foundation,
3092 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3094 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3095 + * or visit www.oracle.com if you need additional information or have any
3099 +package sun.nio.ch;
3101 +import java.io.IOException;
3102 +import java.nio.channels.*;
3103 +import java.nio.channels.spi.*;
3105 +public class EventPortSelectorProvider
3106 + extends SelectorProviderImpl
3108 + public AbstractSelector openSelector() throws IOException {
3109 + return new EventPortSelectorImpl(this);
3112 + public Channel inheritedChannel() throws IOException {
3113 + return InheritedChannel.getChannel();
3116 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java
3117 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java 1970-01-01 01:00:00.000000000 +0100
3118 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/SolarisAsynchronousChannelProvider.java 2024-12-29 15:20:25.111227229 +0100
3121 + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3122 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3124 + * This code is free software; you can redistribute it and/or modify it
3125 + * under the terms of the GNU General Public License version 2 only, as
3126 + * published by the Free Software Foundation. Oracle designates this
3127 + * particular file as subject to the "Classpath" exception as provided
3128 + * by Oracle in the LICENSE file that accompanied this code.
3130 + * This code is distributed in the hope that it will be useful, but WITHOUT
3131 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3132 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3133 + * version 2 for more details (a copy is included in the LICENSE file that
3134 + * accompanied this code).
3136 + * You should have received a copy of the GNU General Public License version
3137 + * 2 along with this work; if not, write to the Free Software Foundation,
3138 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3140 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3141 + * or visit www.oracle.com if you need additional information or have any
3145 +package sun.nio.ch;
3147 +import java.nio.channels.*;
3148 +import java.nio.channels.spi.AsynchronousChannelProvider;
3149 +import java.util.concurrent.ExecutorService;
3150 +import java.util.concurrent.ThreadFactory;
3151 +import java.io.IOException;
3153 +public class SolarisAsynchronousChannelProvider
3154 + extends AsynchronousChannelProvider
3156 + private static volatile SolarisEventPort defaultEventPort;
3158 + private SolarisEventPort defaultEventPort() throws IOException {
3159 + if (defaultEventPort == null) {
3160 + synchronized (SolarisAsynchronousChannelProvider.class) {
3161 + if (defaultEventPort == null) {
3162 + defaultEventPort =
3163 + new SolarisEventPort(this, ThreadPool.getDefault()).start();
3167 + return defaultEventPort;
3170 + public SolarisAsynchronousChannelProvider() {
3174 + public AsynchronousChannelGroup openAsynchronousChannelGroup(int nThreads, ThreadFactory factory)
3175 + throws IOException
3177 + return new SolarisEventPort(this, ThreadPool.create(nThreads, factory)).start();
3181 + public AsynchronousChannelGroup openAsynchronousChannelGroup(ExecutorService executor, int initialSize)
3182 + throws IOException
3184 + return new SolarisEventPort(this, ThreadPool.wrap(executor, initialSize)).start();
3187 + private SolarisEventPort toEventPort(AsynchronousChannelGroup group)
3188 + throws IOException
3190 + if (group == null) {
3191 + return defaultEventPort();
3193 + if (!(group instanceof SolarisEventPort))
3194 + throw new IllegalChannelGroupException();
3195 + return (SolarisEventPort)group;
3200 + public AsynchronousServerSocketChannel openAsynchronousServerSocketChannel(AsynchronousChannelGroup group)
3201 + throws IOException
3203 + return new UnixAsynchronousServerSocketChannelImpl(toEventPort(group));
3207 + public AsynchronousSocketChannel openAsynchronousSocketChannel(AsynchronousChannelGroup group)
3208 + throws IOException
3210 + return new UnixAsynchronousSocketChannelImpl(toEventPort(group));
3213 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/SolarisEventPort.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/SolarisEventPort.java
3214 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/ch/SolarisEventPort.java 1970-01-01 01:00:00.000000000 +0100
3215 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/ch/SolarisEventPort.java 2024-12-29 15:20:25.111721390 +0100
3218 + * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
3219 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3221 + * This code is free software; you can redistribute it and/or modify it
3222 + * under the terms of the GNU General Public License version 2 only, as
3223 + * published by the Free Software Foundation. Oracle designates this
3224 + * particular file as subject to the "Classpath" exception as provided
3225 + * by Oracle in the LICENSE file that accompanied this code.
3227 + * This code is distributed in the hope that it will be useful, but WITHOUT
3228 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3229 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3230 + * version 2 for more details (a copy is included in the LICENSE file that
3231 + * accompanied this code).
3233 + * You should have received a copy of the GNU General Public License version
3234 + * 2 along with this work; if not, write to the Free Software Foundation,
3235 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3237 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3238 + * or visit www.oracle.com if you need additional information or have any
3242 +package sun.nio.ch;
3244 +import java.nio.channels.spi.AsynchronousChannelProvider;
3245 +import java.util.concurrent.RejectedExecutionException;
3246 +import java.io.IOException;
3247 +import jdk.internal.misc.Unsafe;
3250 + * Provides an AsynchronousChannelGroup implementation based on the Solaris 10
3251 + * event port framework and also provides direct access to that framework.
3254 +class SolarisEventPort
3257 + private static final Unsafe unsafe = Unsafe.getUnsafe();
3258 + private static final int addressSize = unsafe.addressSize();
3260 + private static int dependsArch(int value32, int value64) {
3261 + return (addressSize == 4) ? value32 : value64;
3265 + * typedef struct port_event {
3266 + * int portev_events;
3267 + * ushort_t portev_source;
3268 + * ushort_t portev_pad;
3269 + * uintptr_t portev_object;
3270 + * void *portev_user;
3273 + static final int SIZEOF_PORT_EVENT = dependsArch(16, 24);
3274 + static final int OFFSETOF_EVENTS = 0;
3275 + static final int OFFSETOF_SOURCE = 4;
3276 + static final int OFFSETOF_OBJECT = 8;
3279 + static final short PORT_SOURCE_USER = 3;
3280 + static final short PORT_SOURCE_FD = 4;
3282 + // events (sys/poll.h)
3283 + static final int POLLIN = 0x0001;
3284 + static final int POLLOUT = 0x0004;
3286 + // file descriptor to event port.
3287 + private final int port;
3289 + // true when port is closed
3290 + private boolean closed;
3292 + SolarisEventPort(AsynchronousChannelProvider provider, ThreadPool pool)
3293 + throws IOException
3295 + super(provider, pool);
3297 + // create event port
3298 + this.port = port_create();
3301 + SolarisEventPort start() {
3302 + startThreads(new EventHandlerTask());
3306 + // releass resources
3307 + private void implClose() {
3308 + synchronized (this) {
3316 + private void wakeup() {
3318 + port_send(port, 0);
3319 + } catch (IOException x) {
3320 + throw new AssertionError(x);
3325 + void executeOnHandlerTask(Runnable task) {
3326 + synchronized (this) {
3328 + throw new RejectedExecutionException();
3335 + void shutdownHandlerTasks() {
3337 + * If no tasks are running then just release resources; otherwise
3338 + * write to the one end of the socketpair to wakeup any polling threads..
3340 + int nThreads = threadCount();
3341 + if (nThreads == 0) {
3344 + // send user event to wakeup each thread
3345 + while (nThreads-- > 0) {
3347 + port_send(port, 0);
3348 + } catch (IOException x) {
3349 + throw new AssertionError(x);
3356 + void startPoll(int fd, int events) {
3357 + // (re-)associate file descriptor
3358 + // no need to translate events
3360 + port_associate(port, PORT_SOURCE_FD, fd, events);
3361 + } catch (IOException x) {
3362 + throw new AssertionError(); // should not happen
3367 + * Task to read a single event from the port and dispatch it to the
3368 + * channel's onEvent handler.
3370 + private class EventHandlerTask implements Runnable {
3371 + public void run() {
3372 + Invoker.GroupAndInvokeCount myGroupAndInvokeCount =
3373 + Invoker.getGroupAndInvokeCount();
3374 + final boolean isPooledThread = (myGroupAndInvokeCount != null);
3375 + boolean replaceMe = false;
3376 + long address = unsafe.allocateMemory(SIZEOF_PORT_EVENT);
3379 + // reset invoke count
3380 + if (isPooledThread)
3381 + myGroupAndInvokeCount.resetInvokeCount();
3383 + // wait for I/O completion event
3384 + // A error here is fatal (thread will not be replaced)
3385 + replaceMe = false;
3389 + n = port_get(port, address);
3390 + } while (n == IOStatus.INTERRUPTED);
3391 + } catch (IOException x) {
3392 + x.printStackTrace();
3397 + short source = unsafe.getShort(address + OFFSETOF_SOURCE);
3398 + if (source != PORT_SOURCE_FD) {
3399 + // user event is trigger to invoke task or shutdown
3400 + if (source == PORT_SOURCE_USER) {
3401 + Runnable task = pollTask();
3402 + if (task == null) {
3403 + // shutdown request
3406 + // run task (may throw error/exception)
3414 + // pe->portev_object is file descriptor
3415 + int fd = (int)unsafe.getAddress(address + OFFSETOF_OBJECT);
3416 + // pe->portev_events
3417 + int events = unsafe.getInt(address + OFFSETOF_EVENTS);
3420 + PollableChannel ch;
3421 + fdToChannelLock.readLock().lock();
3423 + ch = fdToChannel.get(fd);
3425 + fdToChannelLock.readLock().unlock();
3431 + // no need to translate events
3432 + ch.onEvent(events, isPooledThread);
3436 + // free per-thread resources
3437 + unsafe.freeMemory(address);
3438 + // last task to exit when shutdown release resources
3439 + int remaining = threadExit(this, replaceMe);
3440 + if (remaining == 0 && isShutdown())
3447 + * Creates an event port
3449 + static native int port_create() throws IOException;
3452 + * Associates specific events of a given object with a port
3454 + static native boolean port_associate(int port, int source, long object, int events)
3455 + throws IOException;
3458 + * Removes the association of an object with a port.
3460 + static native boolean port_dissociate(int port, int source, long object)
3461 + throws IOException;
3464 + * Retrieves a single event from a port
3466 + static native int port_get(int port, long address) throws IOException;
3469 + * Retrieves at most {@code max} events from a port. A time-out of {@code < 0} means
3472 + static native int port_getn(int port, long address, int max, long timeout)
3473 + throws IOException;
3476 + * Sends a user-defined eventto a specified port.
3478 + static native void port_send(int port, int events) throws IOException;
3483 + static native void port_close(int port);
3490 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
3491 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java 1970-01-01 01:00:00.000000000 +0100
3492 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java 2024-12-29 15:20:25.112073283 +0100
3495 + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
3496 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3498 + * This code is free software; you can redistribute it and/or modify it
3499 + * under the terms of the GNU General Public License version 2 only, as
3500 + * published by the Free Software Foundation. Oracle designates this
3501 + * particular file as subject to the "Classpath" exception as provided
3502 + * by Oracle in the LICENSE file that accompanied this code.
3504 + * This code is distributed in the hope that it will be useful, but WITHOUT
3505 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3506 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3507 + * version 2 for more details (a copy is included in the LICENSE file that
3508 + * accompanied this code).
3510 + * You should have received a copy of the GNU General Public License version
3511 + * 2 along with this work; if not, write to the Free Software Foundation,
3512 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3514 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3515 + * or visit www.oracle.com if you need additional information or have any
3519 +package sun.nio.fs;
3521 +import java.nio.file.FileSystem;
3524 + * Creates this platform's default FileSystemProvider.
3527 +public class DefaultFileSystemProvider {
3528 + private static final SolarisFileSystemProvider INSTANCE
3529 + = new SolarisFileSystemProvider();
3531 + private DefaultFileSystemProvider() { }
3534 + * Returns the platform's default file system provider.
3536 + public static SolarisFileSystemProvider instance() {
3541 + * Returns the platform's default file system.
3543 + public static FileSystem theFileSystem() {
3544 + return INSTANCE.theFileSystem();
3547 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java
3548 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java 1970-01-01 01:00:00.000000000 +0100
3549 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java 2024-12-29 15:20:25.112514183 +0100
3552 + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
3553 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3555 + * This code is free software; you can redistribute it and/or modify it
3556 + * under the terms of the GNU General Public License version 2 only, as
3557 + * published by the Free Software Foundation. Oracle designates this
3558 + * particular file as subject to the "Classpath" exception as provided
3559 + * by Oracle in the LICENSE file that accompanied this code.
3561 + * This code is distributed in the hope that it will be useful, but WITHOUT
3562 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3563 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3564 + * version 2 for more details (a copy is included in the LICENSE file that
3565 + * accompanied this code).
3567 + * You should have received a copy of the GNU General Public License version
3568 + * 2 along with this work; if not, write to the Free Software Foundation,
3569 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3571 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3572 + * or visit www.oracle.com if you need additional information or have any
3576 +package sun.nio.fs;
3578 +import java.nio.file.*;
3579 +import java.nio.file.attribute.*;
3580 +import java.util.*;
3581 +import java.io.IOException;
3582 +import jdk.internal.misc.Unsafe;
3584 +import static sun.nio.fs.UnixConstants.*;
3585 +import static sun.nio.fs.SolarisConstants.*;
3586 +import static sun.nio.fs.SolarisNativeDispatcher.*;
3590 + * Solaris implementation of AclFileAttributeView with native support for
3591 + * NFSv4 ACLs on ZFS.
3594 +class SolarisAclFileAttributeView
3595 + extends AbstractAclFileAttributeView
3597 + private static final Unsafe unsafe = Unsafe.getUnsafe();
3599 + // Maximum number of entries allowed in an ACL
3600 + private static final int MAX_ACL_ENTRIES = 1024;
3603 + * typedef struct ace {
3605 + * uint32_t a_access_mask;
3606 + * uint16_t a_flags;
3607 + * uint16_t a_type;
3610 + private static final short SIZEOF_ACE_T = 12;
3611 + private static final short OFFSETOF_UID = 0;
3612 + private static final short OFFSETOF_MASK = 4;
3613 + private static final short OFFSETOF_FLAGS = 8;
3614 + private static final short OFFSETOF_TYPE = 10;
3616 + private final UnixPath file;
3617 + private final boolean followLinks;
3619 + SolarisAclFileAttributeView(UnixPath file, boolean followLinks) {
3621 + this.followLinks = followLinks;
3625 + * Encode the ACL to the given buffer
3627 + private static void encode(List<AclEntry> acl, long address) {
3628 + long offset = address;
3629 + for (AclEntry ace: acl) {
3632 + // map UserPrincipal to uid and flags
3633 + UserPrincipal who = ace.principal();
3634 + if (!(who instanceof UnixUserPrincipals.User))
3635 + throw new ProviderMismatchException();
3636 + UnixUserPrincipals.User user = (UnixUserPrincipals.User)who;
3638 + if (user.isSpecial()) {
3640 + if (who == UnixUserPrincipals.SPECIAL_OWNER)
3641 + flags |= ACE_OWNER;
3642 + else if (who == UnixUserPrincipals.SPECIAL_GROUP)
3643 + flags |= (ACE_GROUP | ACE_IDENTIFIER_GROUP);
3644 + else if (who == UnixUserPrincipals.SPECIAL_EVERYONE)
3645 + flags |= ACE_EVERYONE;
3647 + throw new AssertionError("Unable to map special identifier");
3649 + if (user instanceof UnixUserPrincipals.Group) {
3651 + flags |= ACE_IDENTIFIER_GROUP;
3659 + switch (ace.type()) {
3661 + type = ACE_ACCESS_ALLOWED_ACE_TYPE;
3664 + type = ACE_ACCESS_DENIED_ACE_TYPE;
3667 + type = ACE_SYSTEM_AUDIT_ACE_TYPE;
3670 + type = ACE_SYSTEM_ALARM_ACE_TYPE;
3673 + throw new AssertionError("Unable to map ACE type");
3676 + // map permissions
3677 + Set<AclEntryPermission> aceMask = ace.permissions();
3679 + if (aceMask.contains(AclEntryPermission.READ_DATA))
3680 + mask |= ACE_READ_DATA;
3681 + if (aceMask.contains(AclEntryPermission.WRITE_DATA))
3682 + mask |= ACE_WRITE_DATA;
3683 + if (aceMask.contains(AclEntryPermission.APPEND_DATA))
3684 + mask |= ACE_APPEND_DATA;
3685 + if (aceMask.contains(AclEntryPermission.READ_NAMED_ATTRS))
3686 + mask |= ACE_READ_NAMED_ATTRS;
3687 + if (aceMask.contains(AclEntryPermission.WRITE_NAMED_ATTRS))
3688 + mask |= ACE_WRITE_NAMED_ATTRS;
3689 + if (aceMask.contains(AclEntryPermission.EXECUTE))
3690 + mask |= ACE_EXECUTE;
3691 + if (aceMask.contains(AclEntryPermission.DELETE_CHILD))
3692 + mask |= ACE_DELETE_CHILD;
3693 + if (aceMask.contains(AclEntryPermission.READ_ATTRIBUTES))
3694 + mask |= ACE_READ_ATTRIBUTES;
3695 + if (aceMask.contains(AclEntryPermission.WRITE_ATTRIBUTES))
3696 + mask |= ACE_WRITE_ATTRIBUTES;
3697 + if (aceMask.contains(AclEntryPermission.DELETE))
3698 + mask |= ACE_DELETE;
3699 + if (aceMask.contains(AclEntryPermission.READ_ACL))
3700 + mask |= ACE_READ_ACL;
3701 + if (aceMask.contains(AclEntryPermission.WRITE_ACL))
3702 + mask |= ACE_WRITE_ACL;
3703 + if (aceMask.contains(AclEntryPermission.WRITE_OWNER))
3704 + mask |= ACE_WRITE_OWNER;
3705 + if (aceMask.contains(AclEntryPermission.SYNCHRONIZE))
3706 + mask |= ACE_SYNCHRONIZE;
3708 + // FIXME - it would be desirable to know here if the file is a
3709 + // directory or not. Solaris returns EINVAL if an ACE has a directory
3710 + // -only flag and the file is not a directory.
3711 + Set<AclEntryFlag> aceFlags = ace.flags();
3712 + if (aceFlags.contains(AclEntryFlag.FILE_INHERIT))
3713 + flags |= ACE_FILE_INHERIT_ACE;
3714 + if (aceFlags.contains(AclEntryFlag.DIRECTORY_INHERIT))
3715 + flags |= ACE_DIRECTORY_INHERIT_ACE;
3716 + if (aceFlags.contains(AclEntryFlag.NO_PROPAGATE_INHERIT))
3717 + flags |= ACE_NO_PROPAGATE_INHERIT_ACE;
3718 + if (aceFlags.contains(AclEntryFlag.INHERIT_ONLY))
3719 + flags |= ACE_INHERIT_ONLY_ACE;
3721 + unsafe.putInt(offset + OFFSETOF_UID, uid);
3722 + unsafe.putInt(offset + OFFSETOF_MASK, mask);
3723 + unsafe.putShort(offset + OFFSETOF_FLAGS, (short)flags);
3724 + unsafe.putShort(offset + OFFSETOF_TYPE, (short)type);
3726 + offset += SIZEOF_ACE_T;
3731 + * Decode the buffer, returning an ACL
3733 + private static List<AclEntry> decode(long address, int n) {
3734 + ArrayList<AclEntry> acl = new ArrayList<>(n);
3735 + for (int i=0; i<n; i++) {
3736 + long offset = address + i*SIZEOF_ACE_T;
3738 + int uid = unsafe.getInt(offset + OFFSETOF_UID);
3739 + int mask = unsafe.getInt(offset + OFFSETOF_MASK);
3740 + int flags = (int)unsafe.getShort(offset + OFFSETOF_FLAGS);
3741 + int type = (int)unsafe.getShort(offset + OFFSETOF_TYPE);
3743 + // map uid and flags to UserPrincipal
3744 + UnixUserPrincipals.User who = null;
3745 + if ((flags & ACE_OWNER) > 0) {
3746 + who = UnixUserPrincipals.SPECIAL_OWNER;
3747 + } else if ((flags & ACE_GROUP) > 0) {
3748 + who = UnixUserPrincipals.SPECIAL_GROUP;
3749 + } else if ((flags & ACE_EVERYONE) > 0) {
3750 + who = UnixUserPrincipals.SPECIAL_EVERYONE;
3751 + } else if ((flags & ACE_IDENTIFIER_GROUP) > 0) {
3752 + who = UnixUserPrincipals.fromGid(uid);
3754 + who = UnixUserPrincipals.fromUid(uid);
3757 + AclEntryType aceType = null;
3759 + case ACE_ACCESS_ALLOWED_ACE_TYPE:
3760 + aceType = AclEntryType.ALLOW;
3762 + case ACE_ACCESS_DENIED_ACE_TYPE:
3763 + aceType = AclEntryType.DENY;
3765 + case ACE_SYSTEM_AUDIT_ACE_TYPE:
3766 + aceType = AclEntryType.AUDIT;
3768 + case ACE_SYSTEM_ALARM_ACE_TYPE:
3769 + aceType = AclEntryType.ALARM;
3775 + Set<AclEntryPermission> aceMask = EnumSet.noneOf(AclEntryPermission.class);
3776 + if ((mask & ACE_READ_DATA) > 0)
3777 + aceMask.add(AclEntryPermission.READ_DATA);
3778 + if ((mask & ACE_WRITE_DATA) > 0)
3779 + aceMask.add(AclEntryPermission.WRITE_DATA);
3780 + if ((mask & ACE_APPEND_DATA ) > 0)
3781 + aceMask.add(AclEntryPermission.APPEND_DATA);
3782 + if ((mask & ACE_READ_NAMED_ATTRS) > 0)
3783 + aceMask.add(AclEntryPermission.READ_NAMED_ATTRS);
3784 + if ((mask & ACE_WRITE_NAMED_ATTRS) > 0)
3785 + aceMask.add(AclEntryPermission.WRITE_NAMED_ATTRS);
3786 + if ((mask & ACE_EXECUTE) > 0)
3787 + aceMask.add(AclEntryPermission.EXECUTE);
3788 + if ((mask & ACE_DELETE_CHILD ) > 0)
3789 + aceMask.add(AclEntryPermission.DELETE_CHILD);
3790 + if ((mask & ACE_READ_ATTRIBUTES) > 0)
3791 + aceMask.add(AclEntryPermission.READ_ATTRIBUTES);
3792 + if ((mask & ACE_WRITE_ATTRIBUTES) > 0)
3793 + aceMask.add(AclEntryPermission.WRITE_ATTRIBUTES);
3794 + if ((mask & ACE_DELETE) > 0)
3795 + aceMask.add(AclEntryPermission.DELETE);
3796 + if ((mask & ACE_READ_ACL) > 0)
3797 + aceMask.add(AclEntryPermission.READ_ACL);
3798 + if ((mask & ACE_WRITE_ACL) > 0)
3799 + aceMask.add(AclEntryPermission.WRITE_ACL);
3800 + if ((mask & ACE_WRITE_OWNER) > 0)
3801 + aceMask.add(AclEntryPermission.WRITE_OWNER);
3802 + if ((mask & ACE_SYNCHRONIZE) > 0)
3803 + aceMask.add(AclEntryPermission.SYNCHRONIZE);
3805 + Set<AclEntryFlag> aceFlags = EnumSet.noneOf(AclEntryFlag.class);
3806 + if ((flags & ACE_FILE_INHERIT_ACE) > 0)
3807 + aceFlags.add(AclEntryFlag.FILE_INHERIT);
3808 + if ((flags & ACE_DIRECTORY_INHERIT_ACE) > 0)
3809 + aceFlags.add(AclEntryFlag.DIRECTORY_INHERIT);
3810 + if ((flags & ACE_NO_PROPAGATE_INHERIT_ACE) > 0)
3811 + aceFlags.add(AclEntryFlag.NO_PROPAGATE_INHERIT);
3812 + if ((flags & ACE_INHERIT_ONLY_ACE) > 0)
3813 + aceFlags.add(AclEntryFlag.INHERIT_ONLY);
3815 + // build the ACL entry and add it to the list
3816 + AclEntry ace = AclEntry.newBuilder()
3818 + .setPrincipal(who)
3819 + .setPermissions(aceMask).setFlags(aceFlags).build();
3826 + // Returns true if NFSv4 ACLs not enabled on file system
3827 + private static boolean isAclsEnabled(int fd) {
3829 + long enabled = fpathconf(fd, _PC_ACL_ENABLED);
3830 + if (enabled == _ACL_ACE_ENABLED)
3832 + } catch (UnixException x) {
3838 + public List<AclEntry> getAcl()
3839 + throws IOException
3841 + // open file (will fail if file is a link and not following links)
3844 + fd = file.openForAttributeAccess(followLinks);
3845 + } catch (UnixException x) {
3846 + x.rethrowAsIOException(file);
3849 + long address = unsafe.allocateMemory(SIZEOF_ACE_T * MAX_ACL_ENTRIES);
3851 + // read ACL and decode it
3852 + int n = facl(fd, ACE_GETACL, MAX_ACL_ENTRIES, address);
3854 + return decode(address, n);
3855 + } catch (UnixException x) {
3856 + if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) {
3857 + throw new FileSystemException(file.getPathForExceptionMessage(),
3858 + null, x.getMessage() + " (file system does not support NFSv4 ACLs)");
3860 + x.rethrowAsIOException(file);
3861 + return null; // keep compiler happy
3863 + unsafe.freeMemory(address);
3866 + close(fd, e -> null);
3871 + public void setAcl(List<AclEntry> acl) throws IOException {
3872 + // open file (will fail if file is a link and not following links)
3875 + fd = file.openForAttributeAccess(followLinks);
3876 + } catch (UnixException x) {
3877 + x.rethrowAsIOException(file);
3880 + // SECURITY: need to copy list as can change during processing
3881 + acl = new ArrayList<AclEntry>(acl);
3882 + int n = acl.size();
3884 + long address = unsafe.allocateMemory(SIZEOF_ACE_T * n);
3886 + encode(acl, address);
3887 + facl(fd, ACE_SETACL, n, address);
3888 + } catch (UnixException x) {
3889 + if ((x.errno() == ENOSYS) || !isAclsEnabled(fd)) {
3890 + throw new FileSystemException(file.getPathForExceptionMessage(),
3891 + null, x.getMessage() + " (file system does not support NFSv4 ACLs)");
3893 + if (x.errno() == EINVAL && (n < 3))
3894 + throw new IOException("ACL must contain at least 3 entries");
3895 + x.rethrowAsIOException(file);
3897 + unsafe.freeMemory(address);
3900 + close(fd, e -> null);
3905 + public UserPrincipal getOwner()
3906 + throws IOException
3909 + UnixFileAttributes attrs =
3910 + UnixFileAttributes.get(file, followLinks);
3911 + return UnixUserPrincipals.fromUid(attrs.uid());
3912 + } catch (UnixException x) {
3913 + x.rethrowAsIOException(file);
3914 + return null; // keep compile happy
3919 + public void setOwner(UserPrincipal owner) throws IOException {
3920 + if (!(owner instanceof UnixUserPrincipals.User))
3921 + throw new ProviderMismatchException();
3922 + if (owner instanceof UnixUserPrincipals.Group)
3923 + throw new IOException("'owner' parameter is a group");
3924 + int uid = ((UnixUserPrincipals.User)owner).uid();
3927 + if (followLinks) {
3928 + lchown(file, uid, -1);
3930 + chown(file, uid, -1);
3932 + } catch (UnixException x) {
3933 + x.rethrowAsIOException(file);
3937 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template
3938 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template 1970-01-01 01:00:00.000000000 +0100
3939 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template 2024-12-29 15:20:25.112812200 +0100
3942 + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
3944 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3946 + * This code is free software; you can redistribute it and/or modify it
3947 + * under the terms of the GNU General Public License version 2 only, as
3948 + * published by the Free Software Foundation. Oracle designates this
3949 + * particular file as subject to the "Classpath" exception as provided
3950 + * by Oracle in the LICENSE file that accompanied this code.
3952 + * This code is distributed in the hope that it will be useful, but WITHOUT
3953 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3954 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3955 + * version 2 for more details (a copy is included in the LICENSE file that
3956 + * accompanied this code).
3958 + * You should have received a copy of the GNU General Public License version
3959 + * 2 along with this work; if not, write to the Free Software Foundation,
3960 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3962 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3963 + * or visit www.oracle.com if you need additional information or have any
3971 +#include <unistd.h>
3972 +#include <sys/acl.h>
3974 +#include <sys/stat.h>
3976 +/* On Solaris, "sun" is defined as a macro. Undefine to make package
3977 + declaration valid */
3980 +/* To be able to name the Java constants the same as the C constants without
3981 + having the preprocessor rewrite those identifiers, add PREFIX_ to all
3982 + identifiers matching a C constant. The PREFIX_ is filtered out in the
3987 +package sun.nio.fs;
3988 +class SolarisConstants {
3990 + private SolarisConstants() { }
3992 + static final int PREFIX_O_XATTR = O_XATTR;
3993 + static final int PREFIX__PC_XATTR_ENABLED = _PC_XATTR_ENABLED;
3994 + static final int PREFIX__PC_ACL_ENABLED = _PC_ACL_ENABLED;
3995 + static final int PREFIX__ACL_ACE_ENABLED = _ACL_ACE_ENABLED;
3996 + static final int PREFIX_ACE_GETACL = ACE_GETACL;
3997 + static final int PREFIX_ACE_SETACL = ACE_SETACL;
3998 + static final int PREFIX_ACE_ACCESS_ALLOWED_ACE_TYPE = ACE_ACCESS_ALLOWED_ACE_TYPE;
3999 + static final int PREFIX_ACE_ACCESS_DENIED_ACE_TYPE = ACE_ACCESS_DENIED_ACE_TYPE;
4000 + static final int PREFIX_ACE_SYSTEM_AUDIT_ACE_TYPE = ACE_SYSTEM_AUDIT_ACE_TYPE;
4001 + static final int PREFIX_ACE_SYSTEM_ALARM_ACE_TYPE = ACE_SYSTEM_ALARM_ACE_TYPE;
4002 + static final int PREFIX_ACE_READ_DATA = ACE_READ_DATA;
4003 + static final int PREFIX_ACE_LIST_DIRECTORY = ACE_LIST_DIRECTORY;
4004 + static final int PREFIX_ACE_WRITE_DATA = ACE_WRITE_DATA;
4005 + static final int PREFIX_ACE_ADD_FILE = ACE_ADD_FILE;
4006 + static final int PREFIX_ACE_APPEND_DATA = ACE_APPEND_DATA;
4007 + static final int PREFIX_ACE_ADD_SUBDIRECTORY = ACE_ADD_SUBDIRECTORY;
4008 + static final int PREFIX_ACE_READ_NAMED_ATTRS = ACE_READ_NAMED_ATTRS;
4009 + static final int PREFIX_ACE_WRITE_NAMED_ATTRS = ACE_WRITE_NAMED_ATTRS;
4010 + static final int PREFIX_ACE_EXECUTE = ACE_EXECUTE;
4011 + static final int PREFIX_ACE_DELETE_CHILD = ACE_DELETE_CHILD;
4012 + static final int PREFIX_ACE_READ_ATTRIBUTES = ACE_READ_ATTRIBUTES;
4013 + static final int PREFIX_ACE_WRITE_ATTRIBUTES = ACE_WRITE_ATTRIBUTES;
4014 + static final int PREFIX_ACE_DELETE = ACE_DELETE;
4015 + static final int PREFIX_ACE_READ_ACL = ACE_READ_ACL;
4016 + static final int PREFIX_ACE_WRITE_ACL = ACE_WRITE_ACL;
4017 + static final int PREFIX_ACE_WRITE_OWNER = ACE_WRITE_OWNER;
4018 + static final int PREFIX_ACE_SYNCHRONIZE = ACE_SYNCHRONIZE;
4019 + static final int PREFIX_ACE_FILE_INHERIT_ACE = ACE_FILE_INHERIT_ACE;
4020 + static final int PREFIX_ACE_DIRECTORY_INHERIT_ACE = ACE_DIRECTORY_INHERIT_ACE;
4021 + static final int PREFIX_ACE_NO_PROPAGATE_INHERIT_ACE = ACE_NO_PROPAGATE_INHERIT_ACE;
4022 + static final int PREFIX_ACE_INHERIT_ONLY_ACE = ACE_INHERIT_ONLY_ACE;
4023 + static final int PREFIX_ACE_SUCCESSFUL_ACCESS_ACE_FLAG = ACE_SUCCESSFUL_ACCESS_ACE_FLAG;
4024 + static final int PREFIX_ACE_FAILED_ACCESS_ACE_FLAG = ACE_FAILED_ACCESS_ACE_FLAG;
4025 + static final int PREFIX_ACE_IDENTIFIER_GROUP = ACE_IDENTIFIER_GROUP;
4026 + static final int PREFIX_ACE_OWNER = ACE_OWNER;
4027 + static final int PREFIX_ACE_GROUP = ACE_GROUP;
4028 + static final int PREFIX_ACE_EVERYONE = ACE_EVERYONE;
4030 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileStore.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileStore.java
4031 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileStore.java 1970-01-01 01:00:00.000000000 +0100
4032 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileStore.java 2024-12-29 15:20:25.113119081 +0100
4035 + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
4036 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4038 + * This code is free software; you can redistribute it and/or modify it
4039 + * under the terms of the GNU General Public License version 2 only, as
4040 + * published by the Free Software Foundation. Oracle designates this
4041 + * particular file as subject to the "Classpath" exception as provided
4042 + * by Oracle in the LICENSE file that accompanied this code.
4044 + * This code is distributed in the hope that it will be useful, but WITHOUT
4045 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4046 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4047 + * version 2 for more details (a copy is included in the LICENSE file that
4048 + * accompanied this code).
4050 + * You should have received a copy of the GNU General Public License version
4051 + * 2 along with this work; if not, write to the Free Software Foundation,
4052 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4054 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4055 + * or visit www.oracle.com if you need additional information or have any
4059 +package sun.nio.fs;
4061 +import java.nio.file.attribute.*;
4062 +import java.io.IOException;
4064 +import static sun.nio.fs.UnixNativeDispatcher.*;
4065 +import static sun.nio.fs.SolarisConstants.*;
4068 + * Solaris implementation of FileStore
4071 +class SolarisFileStore
4072 + extends UnixFileStore
4074 + private final boolean xattrEnabled;
4076 + SolarisFileStore(UnixPath file) throws IOException {
4078 + this.xattrEnabled = xattrEnabled();
4081 + SolarisFileStore(UnixFileSystem fs, UnixMountEntry entry) throws IOException {
4083 + this.xattrEnabled = xattrEnabled();
4086 + // returns true if extended attributes enabled
4087 + private boolean xattrEnabled() {
4090 + res = pathconf(file(), _PC_XATTR_ENABLED);
4091 + } catch (UnixException x) {
4094 + return (res != 0L);
4098 + UnixMountEntry findMountEntry() throws IOException {
4099 + // On Solaris iterate over the entries in the mount table to find device
4100 + for (UnixMountEntry entry: file().getFileSystem().getMountEntries()) {
4101 + if (entry.dev() == dev()) {
4105 + throw new IOException("Device not found in mnttab");
4109 + public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
4110 + if (type == AclFileAttributeView.class) {
4111 + // lookup fstypes.properties
4112 + FeatureStatus status = checkIfFeaturePresent("nfsv4acl");
4114 + case PRESENT : return true;
4115 + case NOT_PRESENT : return false;
4117 + // AclFileAttributeView available on ZFS
4118 + return (type().equals("zfs"));
4121 + if (type == UserDefinedFileAttributeView.class) {
4122 + // lookup fstypes.properties
4123 + FeatureStatus status = checkIfFeaturePresent("xattr");
4125 + case PRESENT : return true;
4126 + case NOT_PRESENT : return false;
4128 + // UserDefinedFileAttributeView available if extended
4129 + // attributes supported
4130 + return xattrEnabled;
4133 + return super.supportsFileAttributeView(type);
4137 + public boolean supportsFileAttributeView(String name) {
4138 + if (name.equals("acl"))
4139 + return supportsFileAttributeView(AclFileAttributeView.class);
4140 + if (name.equals("user"))
4141 + return supportsFileAttributeView(UserDefinedFileAttributeView.class);
4142 + return super.supportsFileAttributeView(name);
4145 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java
4146 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java 1970-01-01 01:00:00.000000000 +0100
4147 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystem.java 2024-12-29 15:20:25.113416368 +0100
4150 + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
4151 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4153 + * This code is free software; you can redistribute it and/or modify it
4154 + * under the terms of the GNU General Public License version 2 only, as
4155 + * published by the Free Software Foundation. Oracle designates this
4156 + * particular file as subject to the "Classpath" exception as provided
4157 + * by Oracle in the LICENSE file that accompanied this code.
4159 + * This code is distributed in the hope that it will be useful, but WITHOUT
4160 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4161 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4162 + * version 2 for more details (a copy is included in the LICENSE file that
4163 + * accompanied this code).
4165 + * You should have received a copy of the GNU General Public License version
4166 + * 2 along with this work; if not, write to the Free Software Foundation,
4167 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4169 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4170 + * or visit www.oracle.com if you need additional information or have any
4174 +package sun.nio.fs;
4176 +import java.nio.file.*;
4177 +import java.io.IOException;
4178 +import java.util.*;
4179 +import static sun.nio.fs.SolarisNativeDispatcher.*;
4182 + * Solaris implementation of FileSystem
4185 +class SolarisFileSystem extends UnixFileSystem {
4186 + private final boolean hasSolaris11Features;
4188 + SolarisFileSystem(UnixFileSystemProvider provider, String dir) {
4189 + super(provider, dir);
4191 + // check os.version
4192 + String osversion = System.getProperty("os.version");
4193 + String[] vers = Util.split(osversion, '.');
4194 + assert vers.length >= 2;
4195 + int majorVersion = Integer.parseInt(vers[0]);
4196 + int minorVersion = Integer.parseInt(vers[1]);
4197 + this.hasSolaris11Features =
4198 + (majorVersion > 5 || (majorVersion == 5 && minorVersion >= 11));
4202 + public WatchService newWatchService()
4203 + throws IOException
4205 + // FEN available since Solaris 11
4206 + if (hasSolaris11Features) {
4207 + return new SolarisWatchService(this);
4209 + return new PollingWatchService();
4214 + // lazy initialization of the list of supported attribute views
4215 + private static class SupportedFileFileAttributeViewsHolder {
4216 + static final Set<String> supportedFileAttributeViews =
4217 + supportedFileAttributeViews();
4218 + private static Set<String> supportedFileAttributeViews() {
4219 + Set<String> result = new HashSet<>();
4220 + result.addAll(standardFileAttributeViews());
4221 + // additional Solaris-specific views
4222 + result.add("acl");
4223 + result.add("user");
4224 + return Collections.unmodifiableSet(result);
4229 + public Set<String> supportedFileAttributeViews() {
4230 + return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews;
4234 + void copyNonPosixAttributes(int ofd, int nfd) {
4235 + SolarisUserDefinedFileAttributeView.copyExtendedAttributes(ofd, nfd);
4236 + // TDB: copy ACL from source to target
4240 + * Returns object to iterate over entries in /etc/mnttab
4243 + Iterable<UnixMountEntry> getMountEntries() {
4244 + ArrayList<UnixMountEntry> entries = new ArrayList<>();
4246 + UnixPath mnttab = new UnixPath(this, "/etc/mnttab");
4247 + long fp = fopen(mnttab, "r");
4250 + UnixMountEntry entry = new UnixMountEntry();
4251 + int res = getextmntent(fp, entry);
4254 + entries.add(entry);
4259 + } catch (UnixException x) {
4260 + // nothing we can do
4266 + FileStore getFileStore(UnixMountEntry entry) throws IOException {
4267 + return new SolarisFileStore(this, entry);
4270 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java
4271 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java 1970-01-01 01:00:00.000000000 +0100
4272 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java 2024-12-29 15:20:25.113708942 +0100
4275 + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
4276 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4278 + * This code is free software; you can redistribute it and/or modify it
4279 + * under the terms of the GNU General Public License version 2 only, as
4280 + * published by the Free Software Foundation. Oracle designates this
4281 + * particular file as subject to the "Classpath" exception as provided
4282 + * by Oracle in the LICENSE file that accompanied this code.
4284 + * This code is distributed in the hope that it will be useful, but WITHOUT
4285 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4286 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4287 + * version 2 for more details (a copy is included in the LICENSE file that
4288 + * accompanied this code).
4290 + * You should have received a copy of the GNU General Public License version
4291 + * 2 along with this work; if not, write to the Free Software Foundation,
4292 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4294 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4295 + * or visit www.oracle.com if you need additional information or have any
4299 +package sun.nio.fs;
4301 +import java.nio.file.*;
4302 +import java.nio.file.attribute.*;
4303 +import java.nio.file.spi.FileTypeDetector;
4304 +import java.io.IOException;
4305 +import jdk.internal.util.StaticProperty;
4308 + * Solaris implementation of FileSystemProvider
4311 +class SolarisFileSystemProvider extends UnixFileSystemProvider {
4312 + public SolarisFileSystemProvider() {
4317 + SolarisFileSystem newFileSystem(String dir) {
4318 + return new SolarisFileSystem(this, dir);
4322 + SolarisFileStore getFileStore(UnixPath path) throws IOException {
4323 + return new SolarisFileStore(path);
4328 + @SuppressWarnings("unchecked")
4329 + public <V extends FileAttributeView> V getFileAttributeView(Path obj,
4331 + LinkOption... options)
4333 + if (type == AclFileAttributeView.class) {
4334 + return (V) new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
4335 + Util.followLinks(options));
4337 + if (type == UserDefinedFileAttributeView.class) {
4338 + return(V) new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
4339 + Util.followLinks(options));
4341 + return super.getFileAttributeView(obj, type, options);
4345 + public DynamicFileAttributeView getFileAttributeView(Path obj,
4347 + LinkOption... options)
4349 + if (name.equals("acl"))
4350 + return new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
4351 + Util.followLinks(options));
4352 + if (name.equals("user"))
4353 + return new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
4354 + Util.followLinks(options));
4355 + return super.getFileAttributeView(obj, name, options);
4359 + FileTypeDetector getFileTypeDetector() {
4360 + Path userMimeTypes = Path.of(StaticProperty.userHome(), ".mime.types");
4361 + Path etcMimeTypes = Path.of("/etc/mime.types");
4363 + return chain(new MimeTypesFileTypeDetector(userMimeTypes),
4364 + new MimeTypesFileTypeDetector(etcMimeTypes));
4367 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java
4368 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java 1970-01-01 01:00:00.000000000 +0100
4369 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java 2024-12-29 15:20:25.113980994 +0100
4372 + * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
4373 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4375 + * This code is free software; you can redistribute it and/or modify it
4376 + * under the terms of the GNU General Public License version 2 only, as
4377 + * published by the Free Software Foundation. Oracle designates this
4378 + * particular file as subject to the "Classpath" exception as provided
4379 + * by Oracle in the LICENSE file that accompanied this code.
4381 + * This code is distributed in the hope that it will be useful, but WITHOUT
4382 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4383 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4384 + * version 2 for more details (a copy is included in the LICENSE file that
4385 + * accompanied this code).
4387 + * You should have received a copy of the GNU General Public License version
4388 + * 2 along with this work; if not, write to the Free Software Foundation,
4389 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4391 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4392 + * or visit www.oracle.com if you need additional information or have any
4396 +package sun.nio.fs;
4399 + * Solaris specific system calls.
4402 +class SolarisNativeDispatcher extends UnixNativeDispatcher {
4403 + private SolarisNativeDispatcher() { }
4406 + * int getextmntent(FILE *fp, struct extmnttab *mp, int len);
4408 + static native int getextmntent(long fp, UnixMountEntry entry)
4409 + throws UnixException;
4412 + * int facl(int filedes, int cmd, int nentries, void aclbufp)
4414 + static native int facl(int fd, int cmd, int nentries, long aclbufp)
4415 + throws UnixException;
4419 + private static native void init();
4422 + jdk.internal.loader.BootLoader.loadLibrary("nio");
4426 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
4427 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java 1970-01-01 01:00:00.000000000 +0100
4428 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java 2024-12-29 15:20:25.114250627 +0100
4431 + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
4432 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4434 + * This code is free software; you can redistribute it and/or modify it
4435 + * under the terms of the GNU General Public License version 2 only, as
4436 + * published by the Free Software Foundation. Oracle designates this
4437 + * particular file as subject to the "Classpath" exception as provided
4438 + * by Oracle in the LICENSE file that accompanied this code.
4440 + * This code is distributed in the hope that it will be useful, but WITHOUT
4441 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4442 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4443 + * version 2 for more details (a copy is included in the LICENSE file that
4444 + * accompanied this code).
4446 + * You should have received a copy of the GNU General Public License version
4447 + * 2 along with this work; if not, write to the Free Software Foundation,
4448 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4450 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4451 + * or visit www.oracle.com if you need additional information or have any
4455 +package sun.nio.fs;
4457 +class SolarisUserDefinedFileAttributeView
4458 + extends UnixUserDefinedFileAttributeView
4461 + SolarisUserDefinedFileAttributeView(UnixPath file, boolean followLinks) {
4462 + super(file, followLinks);
4466 + protected int maxNameLength() {
4471 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java
4472 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java 1970-01-01 01:00:00.000000000 +0100
4473 +++ jdk24u-jdk-24-29/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java 2024-12-29 15:20:25.114863500 +0100
4476 + * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
4477 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4479 + * This code is free software; you can redistribute it and/or modify it
4480 + * under the terms of the GNU General Public License version 2 only, as
4481 + * published by the Free Software Foundation. Oracle designates this
4482 + * particular file as subject to the "Classpath" exception as provided
4483 + * by Oracle in the LICENSE file that accompanied this code.
4485 + * This code is distributed in the hope that it will be useful, but WITHOUT
4486 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4487 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4488 + * version 2 for more details (a copy is included in the LICENSE file that
4489 + * accompanied this code).
4491 + * You should have received a copy of the GNU General Public License version
4492 + * 2 along with this work; if not, write to the Free Software Foundation,
4493 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4495 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4496 + * or visit www.oracle.com if you need additional information or have any
4500 +package sun.nio.fs;
4502 +import java.nio.file.*;
4503 +import java.util.*;
4504 +import java.io.IOException;
4505 +import jdk.internal.misc.Unsafe;
4507 +import static sun.nio.fs.UnixConstants.*;
4510 + * Solaris implementation of WatchService based on file events notification
4514 +class SolarisWatchService
4515 + extends AbstractWatchService
4517 + private static final Unsafe unsafe = Unsafe.getUnsafe();
4518 + private static int addressSize = unsafe.addressSize();
4520 + private static int dependsArch(int value32, int value64) {
4521 + return (addressSize == 4) ? value32 : value64;
4525 + * typedef struct port_event {
4526 + * int portev_events;
4527 + * ushort_t portev_source;
4528 + * ushort_t portev_pad;
4529 + * uintptr_t portev_object;
4530 + * void *portev_user;
4533 + private static final int SIZEOF_PORT_EVENT = dependsArch(16, 24);
4534 + private static final int OFFSETOF_EVENTS = 0;
4535 + private static final int OFFSETOF_SOURCE = 4;
4536 + private static final int OFFSETOF_OBJECT = 8;
4539 + * typedef struct file_obj {
4540 + * timestruc_t fo_atime;
4541 + * timestruc_t fo_mtime;
4542 + * timestruc_t fo_ctime;
4543 + * uintptr_t fo_pad[3];
4547 + private static final int SIZEOF_FILEOBJ = dependsArch(40, 80);
4548 + private static final int OFFSET_FO_NAME = dependsArch(36, 72);
4551 + private static final short PORT_SOURCE_USER = 3;
4552 + private static final short PORT_SOURCE_FILE = 7;
4554 + // user-watchable events
4555 + private static final int FILE_MODIFIED = 0x00000002;
4556 + private static final int FILE_ATTRIB = 0x00000004;
4557 + private static final int FILE_NOFOLLOW = 0x10000000;
4559 + // exception events
4560 + private static final int FILE_DELETE = 0x00000010;
4561 + private static final int FILE_RENAME_TO = 0x00000020;
4562 + private static final int FILE_RENAME_FROM = 0x00000040;
4563 + private static final int UNMOUNTED = 0x20000000;
4564 + private static final int MOUNTEDOVER = 0x40000000;
4566 + // background thread to read change events
4567 + private final Poller poller;
4569 + SolarisWatchService(UnixFileSystem fs) throws IOException {
4572 + port = portCreate();
4573 + } catch (UnixException x) {
4574 + throw new IOException(x.errorString());
4577 + this.poller = new Poller(fs, this, port);
4578 + this.poller.start();
4582 + WatchKey register(Path dir,
4583 + WatchEvent.Kind<?>[] events,
4584 + WatchEvent.Modifier... modifiers)
4585 + throws IOException
4587 + // delegate to poller
4588 + return poller.register(dir, events, modifiers);
4592 + void implClose() throws IOException {
4593 + // delegate to poller
4598 + * WatchKey implementation
4600 + private class SolarisWatchKey extends AbstractWatchKey
4601 + implements DirectoryNode
4603 + private final UnixFileKey fileKey;
4605 + // pointer to native file_obj object
4606 + private final long object;
4608 + // events (may be changed). set to null when watch key is invalid
4609 + private volatile Set<? extends WatchEvent.Kind<?>> events;
4611 + // map of entries in directory; created lazily; accessed only by
4613 + private Map<Path,EntryNode> children = new HashMap<>();
4615 + SolarisWatchKey(SolarisWatchService watcher,
4617 + UnixFileKey fileKey,
4619 + Set<? extends WatchEvent.Kind<?>> events)
4621 + super(dir, watcher);
4622 + this.fileKey = fileKey;
4623 + this.object = object;
4624 + this.events = events;
4627 + UnixPath getDirectory() {
4628 + return (UnixPath)watchable();
4631 + UnixFileKey getFileKey() {
4636 + public long object() {
4640 + void invalidate() {
4644 + Set<? extends WatchEvent.Kind<?>> events() {
4648 + void setEvents(Set<? extends WatchEvent.Kind<?>> events) {
4649 + this.events = events;
4652 + Map<Path,EntryNode> children() {
4657 + public boolean isValid() {
4658 + return events != null;
4662 + public void cancel() {
4664 + // delegate to poller
4665 + poller.cancel(this);
4670 + public void addChild(Path name, EntryNode node) {
4671 + children.put(name, node);
4675 + public void removeChild(Path name) {
4676 + children.remove(name);
4680 + public EntryNode getChild(Path name) {
4681 + return children.get(name);
4686 + * Background thread to read from port
4688 + private class Poller extends AbstractPoller {
4690 + // maximum number of events to read per call to port_getn
4691 + private static final int MAX_EVENT_COUNT = 128;
4693 + // events that map to ENTRY_DELETE
4694 + private static final int FILE_REMOVED =
4695 + (FILE_DELETE|FILE_RENAME_TO|FILE_RENAME_FROM);
4697 + // events that tell us not to re-associate the object
4698 + private static final int FILE_EXCEPTION =
4699 + (FILE_REMOVED|UNMOUNTED|MOUNTEDOVER);
4701 + // address of event buffers (used to receive events with port_getn)
4702 + private final long bufferAddress;
4704 + private final SolarisWatchService watcher;
4707 + private final int port;
4709 + // maps file key (dev/inode) to WatchKey
4710 + private final Map<UnixFileKey,SolarisWatchKey> fileKey2WatchKey;
4712 + // maps file_obj object to Node
4713 + private final Map<Long,Node> object2Node;
4716 + * Create a new instance
4718 + Poller(UnixFileSystem fs, SolarisWatchService watcher, int port) {
4719 + this.watcher = watcher;
4721 + this.bufferAddress =
4722 + unsafe.allocateMemory(SIZEOF_PORT_EVENT * MAX_EVENT_COUNT);
4723 + this.fileKey2WatchKey = new HashMap<UnixFileKey,SolarisWatchKey>();
4724 + this.object2Node = new HashMap<Long,Node>();
4728 + void wakeup() throws IOException {
4729 + // write to port to wakeup polling thread
4731 + portSend(port, 0);
4732 + } catch (UnixException x) {
4733 + throw new IOException(x.errorString());
4738 + Object implRegister(Path obj,
4739 + Set<? extends WatchEvent.Kind<?>> events,
4740 + WatchEvent.Modifier... modifiers)
4742 + // no modifiers supported at this time
4743 + if (modifiers.length > 0) {
4744 + for (WatchEvent.Modifier modifier: modifiers) {
4745 + if (modifier == null)
4746 + return new NullPointerException();
4747 + if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) &&
4748 + !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) &&
4749 + !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) {
4750 + return new UnsupportedOperationException("Modifier not supported");
4755 + UnixPath dir = (UnixPath)obj;
4757 + // check file is directory
4758 + UnixFileAttributes attrs = null;
4760 + attrs = UnixFileAttributes.get(dir, true);
4761 + } catch (UnixException x) {
4762 + return x.asIOException(dir);
4764 + if (!attrs.isDirectory()) {
4765 + return new NotDirectoryException(dir.getPathForExceptionMessage());
4768 + // if already registered then update the events and return existing key
4769 + UnixFileKey fileKey = attrs.fileKey();
4770 + SolarisWatchKey watchKey = fileKey2WatchKey.get(fileKey);
4771 + if (watchKey != null) {
4773 + updateEvents(watchKey, events);
4774 + } catch (UnixException x) {
4775 + return x.asIOException(dir);
4780 + // register directory
4783 + object = registerImpl(dir, (FILE_MODIFIED | FILE_ATTRIB));
4784 + } catch (UnixException x) {
4785 + return x.asIOException(dir);
4788 + // create watch key and insert it into maps
4789 + watchKey = new SolarisWatchKey(watcher, dir, fileKey, object, events);
4790 + object2Node.put(object, watchKey);
4791 + fileKey2WatchKey.put(fileKey, watchKey);
4793 + // register all entries in directory
4794 + registerChildren(dir, watchKey, false, false);
4799 + // release resources for single entry
4800 + void releaseChild(EntryNode node) {
4801 + long object = node.object();
4802 + if (object != 0L) {
4803 + object2Node.remove(object);
4804 + releaseObject(object, true);
4805 + node.setObject(0L);
4809 + // release resources for entries in directory
4810 + void releaseChildren(SolarisWatchKey key) {
4811 + for (EntryNode node: key.children().values()) {
4812 + releaseChild(node);
4816 + // cancel single key
4818 + void implCancelKey(WatchKey obj) {
4819 + SolarisWatchKey key = (SolarisWatchKey)obj;
4820 + if (key.isValid()) {
4821 + fileKey2WatchKey.remove(key.getFileKey());
4823 + // release resources for entries
4824 + releaseChildren(key);
4826 + // release resources for directory
4827 + long object = key.object();
4828 + object2Node.remove(object);
4829 + releaseObject(object, true);
4831 + // and finally invalidate the key
4836 + // close watch service
4838 + void implCloseAll() {
4839 + // release all native resources
4840 + for (Long object: object2Node.keySet()) {
4841 + releaseObject(object, true);
4844 + // invalidate all keys
4845 + for (Map.Entry<UnixFileKey,SolarisWatchKey> entry: fileKey2WatchKey.entrySet()) {
4846 + entry.getValue().invalidate();
4850 + object2Node.clear();
4851 + fileKey2WatchKey.clear();
4853 + // free global resources
4854 + unsafe.freeMemory(bufferAddress);
4855 + UnixNativeDispatcher.close(port, e -> null);
4859 + * Poller main loop. Blocks on port_getn waiting for events and then
4863 + public void run() {
4866 + int n = portGetn(port, bufferAddress, MAX_EVENT_COUNT);
4869 + long address = bufferAddress;
4870 + for (int i=0; i<n; i++) {
4871 + boolean shutdown = processEvent(address);
4874 + address += SIZEOF_PORT_EVENT;
4877 + } catch (UnixException x) {
4878 + x.printStackTrace();
4883 + * Process a single port_event
4885 + * Returns true if poller thread is requested to shutdown.
4887 + boolean processEvent(long address) {
4888 + // pe->portev_source
4889 + short source = unsafe.getShort(address + OFFSETOF_SOURCE);
4890 + // pe->portev_object
4891 + long object = unsafe.getAddress(address + OFFSETOF_OBJECT);
4892 + // pe->portev_events
4893 + int events = unsafe.getInt(address + OFFSETOF_EVENTS);
4895 + // user event is trigger to process pending requests
4896 + if (source != PORT_SOURCE_FILE) {
4897 + if (source == PORT_SOURCE_USER) {
4898 + // process any pending requests
4899 + boolean shutdown = processRequests();
4906 + // lookup object to get Node
4907 + Node node = object2Node.get(object);
4908 + if (node == null) {
4909 + // should not happen
4913 + // As a workaround for 6642290 and 6636438/6636412 we don't use
4914 + // FILE_EXCEPTION events to tell use not to register the file.
4915 + // boolean reregister = (events & FILE_EXCEPTION) == 0;
4916 + boolean reregister = true;
4918 + // If node is EntryNode then event relates to entry in directory
4919 + // If node is a SolarisWatchKey (DirectoryNode) then event relates
4920 + // to a watched directory.
4921 + boolean isDirectory = (node instanceof SolarisWatchKey);
4922 + if (isDirectory) {
4923 + processDirectoryEvents((SolarisWatchKey)node, events);
4925 + boolean ignore = processEntryEvents((EntryNode)node, events);
4927 + reregister = false;
4930 + // need to re-associate to get further events
4933 + events = FILE_MODIFIED | FILE_ATTRIB;
4934 + if (!isDirectory) events |= FILE_NOFOLLOW;
4935 + portAssociate(port,
4939 + } catch (UnixException x) {
4940 + // unable to re-register
4941 + reregister = false;
4945 + // object is not re-registered so release resources. If
4946 + // object is a watched directory then signal key
4947 + if (!reregister) {
4948 + // release resources
4949 + object2Node.remove(object);
4950 + releaseObject(object, false);
4952 + // if watch key then signal it
4953 + if (isDirectory) {
4954 + SolarisWatchKey key = (SolarisWatchKey)node;
4955 + fileKey2WatchKey.remove( key.getFileKey() );
4959 + // if entry then remove it from parent
4960 + EntryNode entry = (EntryNode)node;
4961 + SolarisWatchKey key = (SolarisWatchKey)entry.parent();
4962 + key.removeChild(entry.name());
4970 + * Process directory events. If directory is modified then re-scan
4971 + * directory to register any new entries
4973 + void processDirectoryEvents(SolarisWatchKey key, int mask) {
4974 + if ((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) {
4975 + registerChildren(key.getDirectory(), key,
4976 + key.events().contains(StandardWatchEventKinds.ENTRY_CREATE),
4977 + key.events().contains(StandardWatchEventKinds.ENTRY_DELETE));
4982 + * Process events for entries in registered directories. Returns {@code
4983 + * true} if events are ignored because the watch key has been cancelled.
4985 + boolean processEntryEvents(EntryNode node, int mask) {
4986 + SolarisWatchKey key = (SolarisWatchKey)node.parent();
4987 + Set<? extends WatchEvent.Kind<?>> events = key.events();
4988 + if (events == null) {
4989 + // key has been cancelled so ignore event
4994 + if (((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) &&
4995 + events.contains(StandardWatchEventKinds.ENTRY_MODIFY))
4997 + key.signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, node.name());
5005 + * Registers all entries in the given directory
5007 + * The {@code sendCreateEvents} and {@code sendDeleteEvents} parameters
5008 + * indicates if ENTRY_CREATE and ENTRY_DELETE events should be queued
5009 + * when new entries are found. When initially registering a directory
5010 + * they will always be false. When re-scanning a directory then it
5011 + * depends on if the events are enabled or not.
5013 + void registerChildren(UnixPath dir,
5014 + SolarisWatchKey parent,
5015 + boolean sendCreateEvents,
5016 + boolean sendDeleteEvents)
5018 + boolean isModifyEnabled =
5019 + parent.events().contains(StandardWatchEventKinds.ENTRY_MODIFY) ;
5021 + // reset visited flag on entries so that we can detect file deletes
5022 + for (EntryNode node: parent.children().values()) {
5023 + node.setVisited(false);
5026 + try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
5027 + for (Path entry: stream) {
5028 + Path name = entry.getFileName();
5030 + // skip entry if already registered
5031 + EntryNode node = parent.getChild(name);
5032 + if (node != null) {
5033 + node.setVisited(true);
5037 + // new entry found
5041 + boolean addNode = false;
5043 + // if ENTRY_MODIFY enabled then we register the entry for events
5044 + if (isModifyEnabled) {
5046 + UnixPath path = (UnixPath)entry;
5047 + int events = (FILE_NOFOLLOW | FILE_MODIFIED | FILE_ATTRIB);
5048 + object = registerImpl(path, events);
5050 + } catch (UnixException x) {
5051 + errno = x.errno();
5059 + node = new EntryNode(object, (UnixPath)entry.getFileName(), parent);
5060 + node.setVisited(true);
5061 + // tell the parent about it
5062 + parent.addChild(entry.getFileName(), node);
5064 + object2Node.put(object, node);
5067 + // send ENTRY_CREATE event for the new file
5068 + // send ENTRY_DELETE event for files that were deleted immediately
5069 + boolean deleted = (errno == ENOENT);
5070 + if (sendCreateEvents && (addNode || deleted))
5071 + parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name);
5072 + if (sendDeleteEvents && deleted)
5073 + parent.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, name);
5076 + } catch (DirectoryIteratorException | IOException x) {
5077 + // queue OVERFLOW event so that user knows to re-scan directory
5078 + parent.signalEvent(StandardWatchEventKinds.OVERFLOW, null);
5082 + // clean-up and send ENTRY_DELETE events for any entries that were
5084 + Iterator<Map.Entry<Path,EntryNode>> iterator =
5085 + parent.children().entrySet().iterator();
5086 + while (iterator.hasNext()) {
5087 + Map.Entry<Path,EntryNode> entry = iterator.next();
5088 + EntryNode node = entry.getValue();
5089 + if (!node.isVisited()) {
5090 + long object = node.object();
5091 + if (object != 0L) {
5092 + object2Node.remove(object);
5093 + releaseObject(object, true);
5095 + if (sendDeleteEvents)
5096 + parent.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, node.name());
5097 + iterator.remove();
5103 + * Update watch key's events. If ENTRY_MODIFY changes to be enabled
5104 + * then register each file in the directory; If ENTRY_MODIFY changed to
5105 + * be disabled then unregister each file.
5107 + void updateEvents(SolarisWatchKey key, Set<? extends WatchEvent.Kind<?>> events)
5108 + throws UnixException
5111 + // update events, remembering if ENTRY_MODIFY was previously
5112 + // enabled or disabled.
5113 + boolean oldModifyEnabled = key.events()
5114 + .contains(StandardWatchEventKinds.ENTRY_MODIFY);
5115 + key.setEvents(events);
5117 + // check if ENTRY_MODIFY has changed
5118 + boolean newModifyEnabled = events
5119 + .contains(StandardWatchEventKinds.ENTRY_MODIFY);
5120 + if (newModifyEnabled != oldModifyEnabled) {
5121 + UnixException ex = null;
5122 + for (EntryNode node: key.children().values()) {
5123 + if (newModifyEnabled) {
5125 + UnixPath path = key.getDirectory().resolve(node.name());
5126 + int ev = (FILE_NOFOLLOW | FILE_MODIFIED | FILE_ATTRIB);
5128 + long object = registerImpl(path, ev);
5129 + object2Node.put(object, node);
5130 + node.setObject(object);
5131 + } catch (UnixException x) {
5132 + // if file has been deleted then it will be detected
5133 + // as a FILE_MODIFIED event on the directory
5134 + if (x.errno() != ENOENT) {
5141 + releaseChild(node);
5145 + // an error occurred
5147 + releaseChildren(key);
5154 + * Calls port_associate to register the given path.
5155 + * Returns pointer to fileobj structure that is allocated for
5156 + * the registration.
5158 + long registerImpl(UnixPath dir, int events)
5159 + throws UnixException
5161 + // allocate memory for the path (file_obj->fo_name field)
5162 + byte[] path = dir.getByteArrayForSysCalls();
5163 + int len = path.length;
5164 + long name = unsafe.allocateMemory(len+1);
5165 + unsafe.copyMemory(path, Unsafe.ARRAY_BYTE_BASE_OFFSET, null,
5167 + unsafe.putByte(name + len, (byte)0);
5169 + // allocate memory for filedatanode structure - this is the object
5170 + // to port_associate
5171 + long object = unsafe.allocateMemory(SIZEOF_FILEOBJ);
5172 + unsafe.setMemory(null, object, SIZEOF_FILEOBJ, (byte)0);
5173 + unsafe.putAddress(object + OFFSET_FO_NAME, name);
5175 + // associate the object with the port
5177 + portAssociate(port,
5181 + } catch (UnixException x) {
5183 + if (x.errno() == EAGAIN) {
5184 + System.err.println("The maximum number of objects associated "+
5185 + "with the port has been reached");
5188 + unsafe.freeMemory(name);
5189 + unsafe.freeMemory(object);
5196 + * Frees all resources for an file_obj object; optionally remove
5197 + * association from port
5199 + void releaseObject(long object, boolean dissociate) {
5200 + // remove association
5203 + portDissociate(port, PORT_SOURCE_FILE, object);
5204 + } catch (UnixException x) {
5209 + // free native memory
5210 + long name = unsafe.getAddress(object + OFFSET_FO_NAME);
5211 + unsafe.freeMemory(name);
5212 + unsafe.freeMemory(object);
5217 + * A node with native (file_obj) resources
5219 + private static interface Node {
5224 + * A directory node with a map of the entries in the directory
5226 + private static interface DirectoryNode extends Node {
5227 + void addChild(Path name, EntryNode node);
5228 + void removeChild(Path name);
5229 + EntryNode getChild(Path name);
5233 + * An implementation of a node that is an entry in a directory.
5235 + private static class EntryNode implements Node {
5236 + private long object;
5237 + private final UnixPath name;
5238 + private final DirectoryNode parent;
5239 + private boolean visited;
5241 + EntryNode(long object, UnixPath name, DirectoryNode parent) {
5242 + this.object = object;
5244 + this.parent = parent;
5248 + public long object() {
5252 + void setObject(long ptr) {
5253 + this.object = ptr;
5260 + DirectoryNode parent() {
5264 + boolean isVisited() {
5268 + void setVisited(boolean v) {
5273 + // -- native methods --
5275 + private static native void init();
5277 + private static native int portCreate() throws UnixException;
5279 + private static native void portAssociate(int port, int source, long object, int events)
5280 + throws UnixException;
5282 + private static native void portDissociate(int port, int source, long object)
5283 + throws UnixException;
5285 + private static native void portSend(int port, int events)
5286 + throws UnixException;
5288 + private static native int portGetn(int port, long address, int max)
5289 + throws UnixException;
5292 + jdk.internal.loader.BootLoader.loadLibrary("nio");
5296 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjava/ProcessHandleImpl_solaris.c jdk24u-jdk-24-29/src/java.base/solaris/native/libjava/ProcessHandleImpl_solaris.c
5297 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjava/ProcessHandleImpl_solaris.c 1970-01-01 01:00:00.000000000 +0100
5298 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libjava/ProcessHandleImpl_solaris.c 2024-12-29 15:20:25.115220599 +0100
5301 + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
5302 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5304 + * This code is free software; you can redistribute it and/or modify it
5305 + * under the terms of the GNU General Public License version 2 only, as
5306 + * published by the Free Software Foundation. Oracle designates this
5307 + * particular file as subject to the "Classpath" exception as provided
5308 + * by Oracle in the LICENSE file that accompanied this code.
5310 + * This code is distributed in the hope that it will be useful, but WITHOUT
5311 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5312 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5313 + * version 2 for more details (a copy is included in the LICENSE file that
5314 + * accompanied this code).
5316 + * You should have received a copy of the GNU General Public License version
5317 + * 2 along with this work; if not, write to the Free Software Foundation,
5318 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5320 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5321 + * or visit www.oracle.com if you need additional information or have any
5327 +#include "ProcessHandleImpl_unix.h"
5329 +#include <procfs.h>
5332 + * Implementation of native ProcessHandleImpl functions for Solaris.
5333 + * See ProcessHandleImpl_unix.c for more details.
5336 +void os_initNative(JNIEnv *env, jclass clazz) {}
5338 +jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
5339 + jlongArray jparentArray, jlongArray jstimesArray) {
5340 + return unix_getChildren(env, jpid, jarray, jparentArray, jstimesArray);
5343 +pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid, jlong *total, jlong *start) {
5344 + return unix_getParentPidAndTimings(env, pid, total, start);
5347 +void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
5348 + unix_getCmdlineAndUserInfo(env, jinfo, pid);
5351 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_db/libjvm_db.c jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_db/libjvm_db.c
5352 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_db/libjvm_db.c 1970-01-01 01:00:00.000000000 +0100
5353 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_db/libjvm_db.c 2024-12-29 15:20:25.116182272 +0100
5356 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
5357 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5359 + * This code is free software; you can redistribute it and/or modify it
5360 + * under the terms of the GNU General Public License version 2 only, as
5361 + * published by the Free Software Foundation.
5363 + * This code is distributed in the hope that it will be useful, but WITHOUT
5364 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5365 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5366 + * version 2 for more details (a copy is included in the LICENSE file that
5367 + * accompanied this code).
5369 + * You should have received a copy of the GNU General Public License version
5370 + * 2 along with this work; if not, write to the Free Software Foundation,
5371 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5373 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5374 + * or visit www.oracle.com if you need additional information or have any
5380 +#include <stdlib.h>
5381 +#include <string.h>
5385 +#include "libjvm_db.h"
5386 +#include "JvmOffsets.h"
5388 +#define LIBJVM_SO "libjvm.so"
5390 +#if defined(i386) || defined(__i386) || defined(__amd64)
5392 +#define X86_COMPILER2
5393 +#endif /* COMPILER2 */
5397 + short vf_cnt; /* number of recognized java vframes */
5398 + short bci; /* current frame method byte code index */
5399 + int line; /* current frame method source line */
5400 + uint64_t new_fp; /* fp for the next frame */
5401 + uint64_t new_pc; /* pc for the next frame */
5402 + uint64_t new_sp; /* "raw" sp for the next frame (includes extension by interpreter/adapter */
5403 + char locinf; /* indicates there is valid location info */
5406 +int Jlookup_by_regs(jvm_agent_t* J, const prgregset_t regs, char *name,
5407 + size_t size, Jframe_t *jframe);
5409 +int main(int arg) { return arg; }
5411 +static int debug = 0;
5413 +static void failed(int err, const char * file, int line) {
5415 + fprintf(stderr, "failed %d at %s:%d\n", err, file, line);
5419 +static void warn(const char * file, int line, const char * msg) {
5421 + fprintf(stderr, "warning: %s at %s:%d\n", msg, file, line);
5425 +static void warn1(const char * file, int line, const char * msg, intptr_t arg1) {
5427 + fprintf(stderr, "warning: ");
5428 + fprintf(stderr, msg, arg1);
5429 + fprintf(stderr, " at %s:%d\n", file, line);
5433 +#define CHECK_FAIL(err) \
5434 + if (err != PS_OK) { failed(err, __FILE__, __LINE__); goto fail; }
5435 +#define WARN(msg) warn(__FILE__, __LINE__, msg)
5436 +#define WARN1(msg, arg1) warn1(__FILE__, __LINE__, msg, arg1)
5438 +typedef struct VMStructEntry {
5439 + const char * typeName; /* The type name containing the given field (example: "Klass") */
5440 + const char * fieldName; /* The field name within the type (example: "_name") */
5441 + uint64_t address; /* Address of field; only used for static fields */
5442 + /* ("offset" can not be reused because of apparent solstudio compiler bug */
5443 + /* in generation of initializer data) */
5446 +/* Prototyping inlined methods */
5448 +int sprintf(char *s, const char *format, ...);
5450 +#define SZ16 sizeof(int16_t)
5451 +#define SZ32 sizeof(int32_t)
5453 +#define COMP_METHOD_SIGN '*'
5455 +#define MAX_VFRAMES_CNT 256
5457 +typedef struct vframe {
5459 + int32_t sender_decode_offset;
5460 + int32_t methodIdx;
5465 +typedef struct frame {
5469 + uintptr_t sender_sp; // The unextended sp of the caller
5472 +typedef struct Nmethod_t {
5473 + struct jvm_agent* J;
5476 + uint64_t nm; /* _nmethod */
5480 + int32_t orig_pc_offset; /* _orig_pc_offset */
5481 + uint64_t instrs_beg; /* _code_offset */
5482 + uint64_t instrs_end;
5483 + uint64_t deopt_beg; /* _deoptimize_offset */
5484 + uint64_t scopes_data_beg; /* _scopes_data_begin */
5485 + int32_t scopes_data_end;
5486 + int32_t metadata_beg; /* _metadata_offset */
5487 + int32_t metadata_end;
5488 + int32_t scopes_pcs_beg; /* _scopes_pcs_offset */
5489 + int32_t scopes_pcs_end;
5492 + Vframe_t vframes[MAX_VFRAMES_CNT];
5496 + struct ps_prochandle* P;
5498 + uint64_t nmethod_vtbl;
5499 + uint64_t CodeBlob_vtbl;
5500 + uint64_t BufferBlob_vtbl;
5501 + uint64_t RuntimeStub_vtbl;
5502 + uint64_t Method_vtbl;
5504 + uint64_t Use_Compressed_Oops_address;
5505 + uint64_t Universe_narrow_oop_base_address;
5506 + uint64_t Universe_narrow_oop_shift_address;
5507 + uint64_t CodeCache_heaps_address;
5510 + uint8_t Use_Compressed_Oops;
5511 + uint64_t Universe_narrow_oop_base;
5512 + uint32_t Universe_narrow_oop_shift;
5513 + // Code cache heaps
5514 + int32_t Number_of_heaps;
5515 + uint64_t* Heap_low;
5516 + uint64_t* Heap_high;
5517 + uint64_t* Heap_segmap_low;
5518 + uint64_t* Heap_segmap_high;
5520 + int32_t SIZE_CodeCache_log2_segment;
5522 + uint64_t methodPtr;
5525 + Nmethod_t *N; /*Inlined methods support */
5531 +read_string(struct ps_prochandle *P,
5532 + char *buf, /* caller's buffer */
5533 + size_t size, /* upper limit on bytes to read */
5534 + uintptr_t addr) /* address in process */
5537 + while (size-- > 1 && err == PS_OK) {
5538 + err = ps_pread(P, addr, buf, 1);
5539 + if (*buf == '\0') {
5548 +static int read_compressed_pointer(jvm_agent_t* J, uint64_t base, uint32_t *ptr) {
5551 + err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t));
5556 +static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) {
5560 + switch (DATA_MODEL) {
5561 + case PR_MODEL_LP64:
5562 + err = ps_pread(J->P, base, ptr, sizeof(uint64_t));
5564 + case PR_MODEL_ILP32:
5565 + err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t));
5573 +static int read_string_pointer(jvm_agent_t* J, uint64_t base, const char ** stringp) {
5576 + char buffer[1024];
5579 + err = read_pointer(J, base, &ptr);
5582 + err = read_string(J->P, buffer, sizeof(buffer), ptr);
5584 + *stringp = strdup(buffer);
5592 +static int parse_vmstruct_entry(jvm_agent_t* J, uint64_t base, VMStructEntry* vmp) {
5596 + err = read_string_pointer(J, base + OFFSET_VMStructEntrytypeName, &vmp->typeName);
5598 + err = read_string_pointer(J, base + OFFSET_VMStructEntryfieldName, &vmp->fieldName);
5600 + err = read_pointer(J, base + OFFSET_VMStructEntryaddress, &vmp->address);
5606 + if (vmp->typeName != NULL) free((void*)vmp->typeName);
5607 + if (vmp->fieldName != NULL) free((void*)vmp->fieldName);
5611 +static int parse_vmstructs(jvm_agent_t* J) {
5612 + VMStructEntry vmVar;
5613 + VMStructEntry* vmp = &vmVar;
5614 + uint64_t gHotSpotVMStructs;
5615 + psaddr_t sym_addr;
5619 + /* Clear *vmp now in case we jump to fail: */
5620 + memset(vmp, 0, sizeof(VMStructEntry));
5622 + err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
5624 + err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
5626 + base = gHotSpotVMStructs;
5629 + while (err == PS_OK) {
5630 + memset(vmp, 0, sizeof(VMStructEntry));
5631 + err = parse_vmstruct_entry(J, base, vmp);
5632 + if (err != PS_OK || vmp->typeName == NULL) {
5636 + if (vmp->typeName[0] == 'C' && strcmp("CodeCache", vmp->typeName) == 0) {
5637 + /* Read _heaps field of type GrowableArray<CodeHeaps*>* */
5638 + if (strcmp("_heaps", vmp->fieldName) == 0) {
5639 + err = read_pointer(J, vmp->address, &J->CodeCache_heaps_address);
5641 + } else if (vmp->typeName[0] == 'U' && strcmp("Universe", vmp->typeName) == 0) {
5642 + if (strcmp("_narrow_oop._base", vmp->fieldName) == 0) {
5643 + J->Universe_narrow_oop_base_address = vmp->address;
5645 + if (strcmp("_narrow_oop._shift", vmp->fieldName) == 0) {
5646 + J->Universe_narrow_oop_shift_address = vmp->address;
5651 + base += SIZE_VMStructEntry;
5652 + if (vmp->typeName != NULL) free((void*)vmp->typeName);
5653 + if (vmp->fieldName != NULL) free((void*)vmp->fieldName);
5659 + if (vmp->typeName != NULL) free((void*)vmp->typeName);
5660 + if (vmp->fieldName != NULL) free((void*)vmp->fieldName);
5664 +static int find_symbol(jvm_agent_t* J, const char *name, uint64_t* valuep) {
5665 + psaddr_t sym_addr;
5668 + err = ps_pglobal_lookup(J->P, LIBJVM_SO, name, &sym_addr);
5669 + if (err != PS_OK) goto fail;
5670 + *valuep = sym_addr;
5677 +static int read_volatiles(jvm_agent_t* J) {
5679 + uint64_t array_data;
5680 + uint64_t code_heap_address;
5683 + err = find_symbol(J, "UseCompressedOops", &J->Use_Compressed_Oops_address);
5684 + if (err == PS_OK) {
5685 + err = ps_pread(J->P, J->Use_Compressed_Oops_address, &J->Use_Compressed_Oops, sizeof(uint8_t));
5688 + J->Use_Compressed_Oops = 0;
5691 + err = read_pointer(J, J->Universe_narrow_oop_base_address, &J->Universe_narrow_oop_base);
5693 + err = ps_pread(J->P, J->Universe_narrow_oop_shift_address, &J->Universe_narrow_oop_shift, sizeof(uint32_t));
5696 + /* CodeCache_heaps_address points to GrowableArray<CodeHeaps*>, read _data field
5697 + pointing to the first entry of type CodeCache* in the array */
5698 + err = read_pointer(J, J->CodeCache_heaps_address + OFFSET_GrowableArray_CodeHeap_data, &array_data);
5699 + /* Read _len field containing the number of code heaps */
5700 + err = ps_pread(J->P, J->CodeCache_heaps_address + OFFSET_GrowableArray_CodeHeap_len,
5701 + &J->Number_of_heaps, sizeof(J->Number_of_heaps));
5703 + /* Allocate memory for heap configurations */
5704 + J->Heap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
5705 + J->Heap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
5706 + J->Heap_segmap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
5707 + J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
5709 + /* Read code heap configurations */
5710 + for (i = 0; i < J->Number_of_heaps; ++i) {
5711 + /* Read address of heap */
5712 + err = read_pointer(J, array_data, &code_heap_address);
5715 + err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_memory +
5716 + OFFSET_VirtualSpace_low, &J->Heap_low[i]);
5718 + err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_memory +
5719 + OFFSET_VirtualSpace_high, &J->Heap_high[i]);
5721 + err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_segmap +
5722 + OFFSET_VirtualSpace_low, &J->Heap_segmap_low[i]);
5724 + err = read_pointer(J, code_heap_address + OFFSET_CodeHeap_segmap +
5725 + OFFSET_VirtualSpace_high, &J->Heap_segmap_high[i]);
5728 + /* Increment pointer to next entry */
5729 + array_data = array_data + POINTER_SIZE;
5732 + err = ps_pread(J->P, code_heap_address + OFFSET_CodeHeap_log2_segment_size,
5733 + &J->SIZE_CodeCache_log2_segment, sizeof(J->SIZE_CodeCache_log2_segment));
5742 +static int codeheap_contains(int heap_num, jvm_agent_t* J, uint64_t ptr) {
5743 + return (J->Heap_low[heap_num] <= ptr && ptr < J->Heap_high[heap_num]);
5746 +static int codecache_contains(jvm_agent_t* J, uint64_t ptr) {
5748 + for (i = 0; i < J->Number_of_heaps; ++i) {
5749 + if (codeheap_contains(i, J, ptr)) {
5756 +static uint64_t segment_for(int heap_num, jvm_agent_t* J, uint64_t p) {
5757 + return (p - J->Heap_low[heap_num]) >> J->SIZE_CodeCache_log2_segment;
5760 +static uint64_t block_at(int heap_num, jvm_agent_t* J, int i) {
5761 + return J->Heap_low[heap_num] + (i << J->SIZE_CodeCache_log2_segment);
5764 +static int find_start(jvm_agent_t* J, uint64_t ptr, uint64_t *startp) {
5768 + for (i = 0; i < J->Number_of_heaps; ++i) {
5770 + if (codeheap_contains(i, J, ptr)) {
5772 + uint64_t segment = segment_for(i, J, ptr);
5773 + uint64_t block = J->Heap_segmap_low[i];
5775 + err = ps_pread(J->P, block + segment, &tag, sizeof(tag));
5780 + err = ps_pread(J->P, block + segment, &tag, sizeof(tag));
5784 + block = block_at(i, J, segment);
5785 + err = ps_pread(J->P, block + OFFSET_HeapBlockHeader_used, &used, sizeof(used));
5788 + *startp = block + SIZE_HeapBlockHeader;
5798 +static int find_jlong_constant(jvm_agent_t* J, const char *name, uint64_t* valuep) {
5799 + psaddr_t sym_addr;
5800 + int err = ps_pglobal_lookup(J->P, LIBJVM_SO, name, &sym_addr);
5801 + if (err == PS_OK) {
5802 + err = ps_pread(J->P, sym_addr, valuep, sizeof(uint64_t));
5809 +jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers) {
5813 + if (vers != JVM_DB_VERSION) {
5818 + J = (jvm_agent_t*)calloc(sizeof(struct jvm_agent), 1);
5820 + debug = getenv("LIBJVMDB_DEBUG") != NULL;
5821 + if (debug) debug = 3;
5824 + fprintf(stderr, "Jagent_create: debug=%d\n", debug);
5825 +#ifdef X86_COMPILER2
5826 + fprintf(stderr, "Jagent_create: R_SP=%d, R_FP=%d, POINTER_SIZE=%d\n", R_SP, R_FP, POINTER_SIZE);
5827 +#endif /* X86_COMPILER2 */
5832 + // Initialize the initial previous frame
5834 + J->prev_fr.fp = 0;
5835 + J->prev_fr.pc = 0;
5836 + J->prev_fr.sp = 0;
5837 + J->prev_fr.sender_sp = 0;
5839 + err = find_symbol(J, "__1cHnmethodG__vtbl_", &J->nmethod_vtbl);
5841 + err = find_symbol(J, "__1cKBufferBlobG__vtbl_", &J->BufferBlob_vtbl);
5842 + if (err != PS_OK) J->BufferBlob_vtbl = 0;
5843 + err = find_symbol(J, "__1cICodeBlobG__vtbl_", &J->CodeBlob_vtbl);
5845 + err = find_symbol(J, "__1cLRuntimeStubG__vtbl_", &J->RuntimeStub_vtbl);
5847 + err = find_symbol(J, "__1cGMethodG__vtbl_", &J->Method_vtbl);
5850 + err = parse_vmstructs(J);
5852 + err = read_volatiles(J);
5858 + Jagent_destroy(J);
5862 +void Jagent_destroy(jvm_agent_t *J) {
5868 +static int is_method(jvm_agent_t* J, uint64_t methodPtr) {
5870 + int err = read_pointer(J, methodPtr, &klass);
5871 + if (err != PS_OK) goto fail;
5872 + return klass == J->Method_vtbl;
5879 +name_for_methodPtr(jvm_agent_t* J, uint64_t methodPtr, char * result, size_t size)
5882 + short signatureIndex;
5883 + uint64_t constantPool;
5884 + uint64_t constMethod;
5885 + uint64_t nameSymbol;
5886 + uint64_t signatureSymbol;
5887 + uint64_t klassPtr;
5888 + uint64_t klassSymbol;
5889 + short klassSymbolLength;
5890 + short nameSymbolLength;
5891 + short signatureSymbolLength;
5892 + char * nameString = NULL;
5893 + char * klassString = NULL;
5894 + char * signatureString = NULL;
5897 + err = read_pointer(J, methodPtr + OFFSET_Method_constMethod, &constMethod);
5899 + err = read_pointer(J, constMethod + OFFSET_ConstMethod_constants, &constantPool);
5902 + /* To get name string */
5903 + err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_name_index, &nameIndex, 2);
5905 + err = read_pointer(J, constantPool + nameIndex * POINTER_SIZE + SIZE_ConstantPool, &nameSymbol);
5907 + // The symbol is a CPSlot and has lower bit set to indicate metadata
5908 + nameSymbol &= (~1); // remove metadata lsb
5909 + err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_length, &nameSymbolLength, 2);
5911 + nameString = (char*)calloc(nameSymbolLength + 1, 1);
5912 + err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_body, nameString, nameSymbolLength);
5915 + /* To get signature string */
5916 + err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_signature_index, &signatureIndex, 2);
5918 + err = read_pointer(J, constantPool + signatureIndex * POINTER_SIZE + SIZE_ConstantPool, &signatureSymbol);
5920 + signatureSymbol &= (~1); // remove metadata lsb
5921 + err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_length, &signatureSymbolLength, 2);
5923 + signatureString = (char*)calloc(signatureSymbolLength + 1, 1);
5924 + err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_body, signatureString, signatureSymbolLength);
5927 + /* To get klass string */
5928 + err = read_pointer(J, constantPool + OFFSET_ConstantPool_pool_holder, &klassPtr);
5930 + err = read_pointer(J, klassPtr + OFFSET_Klass_name, &klassSymbol);
5932 + err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_length, &klassSymbolLength, 2);
5934 + klassString = (char*)calloc(klassSymbolLength + 1, 1);
5935 + err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_body, klassString, klassSymbolLength);
5939 + if (snprintf(result, size,
5943 + signatureString) >= size) {
5948 + if (nameString != NULL) free(nameString);
5949 + if (klassString != NULL) free(klassString);
5950 + if (signatureString != NULL) free(signatureString);
5956 + fprintf(stderr, "name_for_methodPtr: FAIL \n\n");
5958 + if (nameString != NULL) free(nameString);
5959 + if (klassString != NULL) free(klassString);
5960 + if (signatureString != NULL) free(signatureString);
5964 +static int nmethod_info(Nmethod_t *N)
5966 + jvm_agent_t *J = N->J;
5967 + uint64_t nm = N->nm;
5971 + fprintf(stderr, "\t nmethod_info: BEGIN \n");
5973 + /* Instructions */
5974 + err = read_pointer(J, nm + OFFSET_CodeBlob_code_begin, &N->instrs_beg);
5976 + err = read_pointer(J, nm + OFFSET_CodeBlob_code_end, &N->instrs_end);
5978 + err = read_pointer(J, nm + OFFSET_nmethod_deopt_handler_begin, &N->deopt_beg);
5980 + err = ps_pread(J->P, nm + OFFSET_nmethod_orig_pc_offset, &N->orig_pc_offset, SZ32);
5984 + err = ps_pread(J->P, nm + OFFSET_nmethod_metadata_offset, &N->metadata_beg, SZ32);
5986 + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->metadata_end, SZ32);
5990 + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32);
5992 + err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32);
5996 + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->scopes_data_beg, POINTER_SIZE);
6000 + N->scopes_data_end = N->scopes_pcs_beg;
6002 + fprintf(stderr, "\t nmethod_info: instrs_beg: %#x, instrs_end: %#x\n",
6003 + N->instrs_beg, N->instrs_end);
6005 + fprintf(stderr, "\t nmethod_info: deopt_beg: %#x \n",
6008 + fprintf(stderr, "\t nmethod_info: orig_pc_offset: %#x \n",
6009 + N->orig_pc_offset);
6011 + fprintf(stderr, "\t nmethod_info: metadata_beg: %#x, metadata_end: %#x\n",
6012 + N->metadata_beg, N->metadata_end);
6014 + fprintf(stderr, "\t nmethod_info: scopes_data_beg: %#x, scopes_data_end: %#x\n",
6015 + N->scopes_data_beg, N->scopes_data_end);
6017 + fprintf(stderr, "\t nmethod_info: scopes_pcs_beg: %#x, scopes_pcs_end: %#x\n",
6018 + N->scopes_pcs_beg, N->scopes_pcs_end);
6020 + fprintf(stderr, "\t nmethod_info: END \n\n");
6029 +raw_read_int(jvm_agent_t* J, uint64_t *buffer, int32_t *val)
6036 + // Constants for UNSIGNED5 coding of Pack200
6037 + // see compressedStream.hpp
6042 + L = (1<<BitsPerByte)-H,
6046 + err = ps_pread(J->P, (*buffer)++, &ch, sizeof(uint8_t));
6049 + fprintf(stderr, "\t\t\t raw_read_int: *buffer: %#llx, ch: %#x\n", *buffer, ch);
6053 + int32_t lg_H_i = lg_H;
6054 + // Read maximum of 5 total bytes (we've already read 1).
6055 + // See CompressedReadStream::read_int_mb
6056 + for ( i = 0; i < 4; i++) {
6057 + err = ps_pread(J->P, (*buffer)++, &ch, sizeof(uint8_t));
6059 + sum += ch << lg_H_i;
6075 +read_pair(jvm_agent_t* J, uint64_t *buffer, int32_t *bci, int32_t *line)
6078 + int32_t bci_delta;
6079 + int32_t line_delta;
6083 + fprintf(stderr, "\t\t read_pair: BEGIN\n");
6085 + err = ps_pread(J->P, (*buffer)++, &next, sizeof(uint8_t));
6090 + fprintf(stderr, "\t\t read_pair: END: next == 0\n");
6091 + return 1; /* stream terminated */
6093 + if (next == 0xFF) {
6095 + fprintf(stderr, "\t\t read_pair: END: next == 0xFF\n");
6097 + /* Escape character, regular compression used */
6099 + err = raw_read_int(J, buffer, &bci_delta);
6102 + err = raw_read_int(J, buffer, &line_delta);
6105 + *bci += bci_delta;
6106 + *line += line_delta;
6109 + fprintf(stderr, "\t\t read_pair: delta = (line %d: %d)\n",
6110 + line_delta, bci_delta);
6111 + fprintf(stderr, "\t\t read_pair: unpack= (line %d: %d)\n",
6115 + /* Single byte compression used */
6116 + *bci += next >> 3;
6117 + *line += next & 0x7;
6119 + fprintf(stderr, "\t\t read_pair: delta = (line %d: %d)\n",
6120 + next & 0x7, next >> 3);
6121 + fprintf(stderr, "\t\t read_pair: unpack= (line %d: %d)\n",
6126 + fprintf(stderr, "\t\t read_pair: END\n");
6131 + fprintf(stderr, "\t\t read_pair: FAIL\n");
6136 +line_number_from_bci(jvm_agent_t* J, Vframe_t *vf)
6139 + uint16_t code_size;
6140 + uint64_t code_end_delta;
6141 + uint64_t constMethod;
6142 + int8_t access_flags;
6143 + int32_t best_bci = 0;
6144 + int32_t stream_bci = 0;
6145 + int32_t stream_line = 0;
6150 + err = name_for_methodPtr(J, vf->method, name, 256);
6152 + fprintf(stderr, "\t line_number_from_bci: BEGIN, method name: %s, targ bci: %d\n",
6156 + err = read_pointer(J, vf->method + OFFSET_Method_constMethod, &constMethod);
6160 + err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_flags, &access_flags, sizeof(int8_t));
6163 + if (!(access_flags & ConstMethod_has_linenumber_table)) {
6165 + fprintf(stderr, "\t line_number_from_bci: END: !HAS_LINE_NUMBER_TABLE \n\n");
6169 + /* The line numbers are a short array of 2-tuples [start_pc, line_number].
6170 + * Not necessarily sorted and not necessarily one-to-one.
6173 + err = ps_pread(J->P, constMethod + OFFSET_ConstMethod_code_size, &code_size, SZ16);
6176 + /* inlined_table_start() */
6177 + code_end_delta = (uint64_t) (access_flags & AccessFlags_NATIVE) ? 2*POINTER_SIZE : 0;
6178 + buffer = constMethod + (uint64_t) SIZE_ConstMethod + (uint64_t) code_size + code_end_delta;
6181 + fprintf(stderr, "\t\t line_number_from_bci: method: %#llx, native: %d\n",
6182 + vf->method, (access_flags & AccessFlags_NATIVE));
6183 + fprintf(stderr, "\t\t line_number_from_bci: buffer: %#llx, code_size: %d\n",
6184 + buffer, (int) code_size);
6187 + while (read_pair(J, &buffer, &stream_bci, &stream_line) == 0) {
6188 + if (stream_bci == vf->bci) {
6189 + /* perfect match */
6191 + fprintf(stderr, "\t line_number_from_bci: END: exact line: %d \n\n", vf->line);
6192 + vf->line = stream_line;
6195 + /* update best_bci/line */
6196 + if (stream_bci < vf->bci && stream_bci >= best_bci) {
6197 + best_bci = stream_bci;
6198 + vf->line = stream_line;
6200 + fprintf(stderr, "\t line_number_from_bci: best_bci: %d, best_line: %d\n",
6201 + best_bci, vf->line);
6207 + fprintf(stderr, "\t line_number_from_bci: END: line: %d \n\n", vf->line);
6212 + fprintf(stderr, "\t line_number_from_bci: FAIL\n");
6217 +get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc)
6219 + int32_t pc_offset;
6222 + err = ps_pread(N->J->P, pc_desc + OFFSET_PcDesc_pc_offset, &pc_offset, SZ32);
6225 + *real_pc = N->instrs_beg + pc_offset;
6227 + fprintf(stderr, "\t\t get_real_pc: pc_offset: %lx, real_pc: %llx\n",
6228 + pc_offset, *real_pc);
6236 +/* Finds a PcDesc with real-pc equal to N->pc */
6237 +static int pc_desc_at(Nmethod_t *N)
6239 + uint64_t pc_diff = 999;
6244 + fprintf(stderr, "\t pc_desc_at: BEGIN\n");
6249 + for (offs = N->scopes_pcs_beg; offs < N->scopes_pcs_end; offs += SIZE_PcDesc) {
6251 + uint64_t best_pc_diff = 16; /* some approximation */
6252 + uint64_t real_pc = 0;
6254 + pd = N->nm + offs;
6255 + err = get_real_pc(N, pd, &real_pc);
6258 + pc_diff = real_pc - N->pc;
6260 + /* In general, this fragment should work */
6261 + if (pc_diff == 0) {
6264 + fprintf(stderr, "\t pc_desc_at: END: pc_desc: FOUND: %#lx \n\n", pd);
6268 + /* This fragment is to be able to find out an appropriate
6269 + * pc_desc entry even if pc_desc info is inaccurate.
6271 + if (best_pc_diff > pc_diff && pc_diff > 0) {
6272 + best_pc_diff = pc_diff;
6277 + fprintf(stderr, "\t pc_desc_at: END: pc_desc NOT FOUND");
6279 + fprintf(stderr, ", best pc_diff: %d\n\n", pc_diff);
6281 + fprintf(stderr, "\n\n");
6290 +scope_desc_at(Nmethod_t *N, int32_t decode_offset, Vframe_t *vf)
6296 + fprintf(stderr, "\t\t scope_desc_at: BEGIN \n");
6299 + buffer = N->scopes_data_beg + decode_offset;
6301 + err = raw_read_int(N->J, &buffer, &vf->sender_decode_offset);
6304 + err = raw_read_int(N->J, &buffer, &vf->methodIdx);
6307 + err = raw_read_int(N->J, &buffer, &vf->bci);
6311 + fprintf(stderr, "\t\t scope_desc_at: sender_decode_offset: %#x\n",
6312 + vf->sender_decode_offset);
6313 + fprintf(stderr, "\t\t scope_desc_at: methodIdx: %d\n", vf->methodIdx);
6314 + fprintf(stderr, "\t\t scope_desc_at: bci: %d\n", vf->bci);
6316 + fprintf(stderr, "\t\t scope_desc_at: END \n\n");
6324 +static int scopeDesc_chain(Nmethod_t *N) {
6325 + int32_t decode_offset = 0;
6329 + fprintf(stderr, "\t scopeDesc_chain: BEGIN\n");
6332 + err = ps_pread(N->J->P, N->pc_desc + OFFSET_PcDesc_scope_decode_offset,
6333 + &decode_offset, SZ32);
6336 + while (decode_offset > 0) {
6337 + Vframe_t *vf = &N->vframes[N->vf_cnt];
6340 + fprintf(stderr, "\t scopeDesc_chain: decode_offset: %#x\n", decode_offset);
6343 + err = scope_desc_at(N, decode_offset, vf);
6346 + if (vf->methodIdx > ((N->metadata_end - N->metadata_beg) / POINTER_SIZE)) {
6347 + fprintf(stderr, "\t scopeDesc_chain: (methodIdx > metadata length) !\n");
6350 + err = read_pointer(N->J, N->nm + N->metadata_beg + (vf->methodIdx-1)*POINTER_SIZE,
6356 + err = line_number_from_bci(N->J, vf);
6359 + fprintf(stderr, "\t scopeDesc_chain: method: %#8llx, line: %d\n",
6360 + vf->method, vf->line);
6363 + decode_offset = vf->sender_decode_offset;
6366 + fprintf(stderr, "\t scopeDesc_chain: END \n\n");
6372 + fprintf(stderr, "\t scopeDesc_chain: FAIL \n\n");
6379 +name_for_nmethod(jvm_agent_t* J,
6390 + int deoptimized = 0;
6393 + fprintf(stderr, "name_for_nmethod: BEGIN: nmethod: %#llx, pc: %#llx\n", nm, pc);
6395 + if (J->N == NULL) {
6396 + J->N = (Nmethod_t *) malloc(sizeof(Nmethod_t));
6398 + memset(J->N, 0, sizeof(Nmethod_t)); /* Initial stat: all values are zeros */
6403 + N->jframe = jframe;
6405 + err = nmethod_info(N);
6408 + fprintf(stderr, "name_for_nmethod: pc: %#llx, deopt_pc: %#llx\n",
6409 + pc, N->deopt_beg);
6412 + /* check for a deoptimized frame */
6413 + if ( pc == N->deopt_beg) {
6416 + fprintf(stderr, "name_for_nmethod: found deoptimized frame\n");
6418 + if (J->prev_fr.sender_sp != 0) {
6419 + base = J->prev_fr.sender_sp + N->orig_pc_offset;
6421 + base = J->curr_fr.sp + N->orig_pc_offset;
6423 + err = read_pointer(J, base, &N->pc);
6426 + fprintf(stderr, "name_for_nmethod: found deoptimized frame converting pc from %#8llx to %#8llx\n",
6432 + err = pc_desc_at(N);
6435 + if (N->pc_desc > 0) {
6436 + jframe->locinf = 1;
6437 + err = scopeDesc_chain(N);
6440 + result[0] = COMP_METHOD_SIGN;
6441 + vf = &N->vframes[0];
6442 + if (N->vf_cnt > 0) {
6443 + jframe->vf_cnt = N->vf_cnt;
6444 + jframe->bci = vf->bci;
6445 + jframe->line = vf->line;
6446 + err = name_for_methodPtr(J, N->vframes[0].method, result+1, size-1);
6449 + err = name_for_methodPtr(J, method, result+1, size-1);
6452 + if (deoptimized) {
6453 + strncat(result, " [deoptimized frame]; ", size - strlen(result) - 1);
6455 + strncat(result, " [compiled] ", size - strlen(result) - 1);
6458 + fprintf(stderr, "name_for_nmethod: END: method name: %s, vf_cnt: %d\n\n",
6459 + result, N->vf_cnt);
6464 + fprintf(stderr, "name_for_nmethod: FAIL \n\n");
6469 +name_for_imethod(jvm_agent_t* J,
6477 + uint64_t constMethod;
6478 + Vframe_t vframe = {0};
6479 + Vframe_t *vf = &vframe;
6482 + err = read_pointer(J, method + OFFSET_Method_constMethod, &constMethod);
6485 + bci = bcp - (constMethod + (uint64_t) SIZE_ConstMethod);
6488 + fprintf(stderr, "\t name_for_imethod: BEGIN: method: %#llx\n", method);
6490 + err = name_for_methodPtr(J, method, result, size);
6493 + fprintf(stderr, "\t name_for_imethod: method name: %s\n", result);
6496 + vf->method = method;
6498 + err = line_number_from_bci(J, vf);
6501 + jframe->bci = vf->bci;
6502 + jframe->line = vf->line;
6503 + jframe->locinf = 1;
6506 + fprintf(stderr, "\t name_for_imethod: END: bci: %d, line: %d\n\n",
6507 + vf->bci, vf->line);
6513 + fprintf(stderr, "\t name_for_imethod: FAIL\n");
6518 +name_for_codecache(jvm_agent_t* J, uint64_t fp, uint64_t pc, char * result,
6519 + size_t size, Jframe_t *jframe, int* is_interpreted)
6524 + *is_interpreted = 0;
6528 + err = find_start(J, pc, &start);
6531 + err = read_pointer(J, start, &vtbl);
6534 + if (vtbl == J->nmethod_vtbl) {
6537 + err = read_pointer(J, start + OFFSET_nmethod_method, &method);
6541 + fprintf(stderr, "name_for_codecache: start: %#8llx, pc: %#8llx, method: %#8llx \n",
6542 + start, pc, method);
6544 + err = name_for_nmethod(J, start, pc, method, result, size, jframe);
6546 + } else if (vtbl == J->BufferBlob_vtbl) {
6547 + const char * name;
6549 + err = read_string_pointer(J, start + OFFSET_CodeBlob_name, &name);
6552 + * Temporary usage of string "Interpreter".
6553 + * We need some other way to distinguish "StubRoutines"
6554 + * and regular interpreted frames.
6556 + if (err == PS_OK && strncmp(name, "Interpreter", 11) == 0) {
6557 + *is_interpreted = 1;
6558 + if (is_method(J, J->methodPtr)) {
6559 + return name_for_imethod(J, J->bcp, J->methodPtr, result, size, jframe);
6563 + if (err == PS_OK) {
6564 + strncpy(result, name, size);
6565 + free((void*)name);
6567 + strncpy(result, "<unknown BufferBlob>", size);
6569 + /* return PS_OK; */
6571 + const char * name;
6573 + err = read_string_pointer(J, start + OFFSET_CodeBlob_name, &name);
6574 + if (err == PS_OK) {
6575 + strncpy(result, name, size);
6576 + free((void*)name);
6578 + strncpy(result, "<unknown CodeBlob>", size);
6579 + WARN1("unknown CodeBlob: vtbl = 0x%x", vtbl);
6582 + result[size-1] = '\0';
6584 +#ifdef X86_COMPILER2
6585 + if (vtbl != J->RuntimeStub_vtbl) {
6586 + uint64_t trial_pc;
6588 + err = ps_pread(J->P, start + OFFSET_CodeBlob_frame_size,
6589 + &frame_size, SZ32);
6592 + // frame_size is in words, we want bytes.
6593 + frame_size *= POINTER_SIZE; /* word => byte conversion */
6596 + Because c2 doesn't use FP as a framepointer the value of sp/fp we receive
6597 + in the initial entry to a set of stack frames containing server frames
6598 + will pretty much be nonsense. We can detect that nonsense by looking to
6599 + see if the PC we received is correct if we look at the expected storage
6600 + location in relation to the FP (ie. POINTER_SIZE(FP) )
6603 + err = read_pointer(J, fp + POINTER_SIZE , &trial_pc);
6604 + if ( (err != PS_OK || trial_pc != pc) && frame_size > 0 ) {
6605 + // Either we couldn't even read at the "fp" or the pc didn't match
6606 + // both are sure clues that the fp is bogus. We no search the stack
6607 + // for a reasonable number of words trying to find the bogus fp
6608 + // and the current pc in adjacent words. The we will be able to
6609 + // deduce an approximation of the frame pointer and actually get
6610 + // the correct stack pointer. Which we can then unwind for the
6614 + uint64_t base = J->curr_fr.sp;
6615 + uint64_t prev_fp = 0;
6616 + for ( i = 0; i < frame_size * 5 ; i++, base += POINTER_SIZE ) {
6617 + err = read_pointer(J, base , &check);
6619 + if (check == fp) {
6620 + base += POINTER_SIZE;
6621 + err = read_pointer(J, base , &check);
6623 + if (check == pc) {
6625 + fprintf(stderr, "name_for_codecache: found matching fp/pc combo at 0x%llx\n", base - POINTER_SIZE);
6627 + prev_fp = base - 2 * POINTER_SIZE;
6632 + if ( prev_fp != 0 ) {
6633 + // real_sp is the sp we should have received for this frame
6634 + uint64_t real_sp = prev_fp + 2 * POINTER_SIZE;
6635 + // +POINTER_SIZE because callee owns the return address so caller's sp is +1 word
6636 + jframe->new_sp = real_sp + frame_size + POINTER_SIZE;
6637 + err = read_pointer(J, jframe->new_sp - POINTER_SIZE , &jframe->new_pc);
6639 + err = read_pointer(J, jframe->new_sp - 2*POINTER_SIZE, &jframe->new_fp);
6645 + /* A prototype to workaround FP absence */
6647 + * frame_size can be 0 for StubRoutines (1) frame.
6648 + * In this case it should work with fp as usual.
6650 + if (frame_size > 0) {
6651 + jframe->new_fp = J->prev_fr.fp + frame_size;
6652 + jframe->new_sp = jframe->new_fp + 2 * POINTER_SIZE;
6654 + memset(&J->curr_fr, 0, sizeof(Frame_t));
6655 + err = read_pointer(J, fp, &jframe->new_fp);
6658 + err = read_pointer(J, jframe->new_fp + POINTER_SIZE, &jframe->new_pc);
6662 + fprintf(stderr, "name_for_codecache: %s, frame_size=%#lx\n",
6663 + result, frame_size);
6664 + fprintf(stderr, "name_for_codecache: prev_fr.fp=%#lx, fp=%#lx\n",
6665 + J->prev_fr.fp, jframe->new_fp);
6668 +#endif /* X86_COMPILER2 */
6676 +int Jget_vframe(jvm_agent_t* J, int vframe_no,
6677 + char *name, size_t size, Jframe_t *jframe)
6679 + Nmethod_t *N = J->N;
6683 + if (vframe_no >= N->vf_cnt) {
6684 + (void) sprintf(name, "Wrong inlinedMethod%1d()", vframe_no);
6687 + vf = N->vframes + vframe_no;
6688 + name[0] = COMP_METHOD_SIGN;
6689 + err = name_for_methodPtr(J, vf->method, name + 1, size);
6692 + jframe->bci = vf->bci;
6693 + jframe->line = vf->line;
6695 + fprintf(stderr, "\t Jget_vframe: method name: %s, line: %d\n",
6702 + fprintf(stderr, "\t Jget_vframe: FAIL\n");
6707 +#define MAX_SYM_SIZE 256
6709 +int Jlookup_by_regs(jvm_agent_t* J, const prgregset_t regs, char *name,
6710 + size_t size, Jframe_t *jframe) {
6713 + /* arguments given to read_pointer need to be worst case sized */
6714 + uint64_t methodPtr = 0;
6715 + uint64_t sender_sp;
6717 + int is_interpreted = 0;
6718 + int result = PS_OK;
6725 + jframe->vf_cnt = 1;
6726 + jframe->new_fp = 0;
6727 + jframe->new_pc = 0;
6730 + jframe->locinf = 0;
6732 + read_volatiles(J);
6733 + pc = (uintptr_t) regs[R_PC];
6734 + J->curr_fr.pc = pc;
6735 + J->curr_fr.fp = regs[R_FP];
6736 + J->curr_fr.sp = regs[R_SP];
6739 + fprintf(stderr, "Jlookup_by_regs: BEGINs: fp=%#lx, pc=%#lx\n", regs[R_FP], pc);
6741 +#if defined(i386) || defined(__i386) || defined(__amd64)
6743 + fp = (uintptr_t) regs[R_FP];
6744 + if (J->prev_fr.fp == 0) {
6745 +#ifdef X86_COMPILER2
6746 + /* A workaround for top java frames */
6747 + J->prev_fr.fp = (uintptr_t)(regs[R_SP] - 2 * POINTER_SIZE);
6749 + J->prev_fr.fp = (uintptr_t)(regs[R_SP] - POINTER_SIZE);
6750 +#endif /* COMPILER2 */
6753 + printf("Jlookup_by_regs: J->prev_fr.fp = %#lx\n", J->prev_fr.fp);
6756 + if (read_pointer(J, fp + OFFSET_interpreter_frame_method, &methodPtr) != PS_OK) {
6759 + if (read_pointer(J, fp + OFFSET_interpreter_frame_sender_sp, &sender_sp) != PS_OK) {
6762 + if (read_pointer(J, fp + OFFSET_interpreter_frame_bcp_offset, &bcp) != PS_OK) {
6767 + J->methodPtr = methodPtr;
6770 + /* On x86 with C2 JVM: native frame may have wrong regs[R_FP]
6771 + * For example: JVM_SuspendThread frame points to the top interpreted frame.
6772 + * If we call is_method(J, methodPtr) before codecache_contains(J, pc)
6773 + * then we go over and omit both: nmethod and I2CAdapter frames.
6774 + * Note, that regs[R_PC] is always correct if frame defined correctly.
6775 + * So it is better to call codecache_contains(J, pc) from the beginning.
6777 +#ifndef X86_COMPILER2
6778 + if (is_method(J, J->methodPtr)) {
6779 + result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
6780 + /* If the methodPtr is a method then this is highly likely to be
6781 + an interpreter frame */
6782 + if (result >= 0) {
6783 + is_interpreted = 1;
6786 +#endif /* ! X86_COMPILER2 */
6788 + if (codecache_contains(J, pc)) {
6789 + result = name_for_codecache(J, fp, pc, name, size, jframe, &is_interpreted);
6791 +#ifdef X86_COMPILER2
6792 + else if (is_method(J, J->methodPtr)) {
6793 + result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
6794 + /* If the methodPtr is a method then this is highly likely to be
6795 + an interpreter frame */
6796 + if (result >= 0) {
6797 + is_interpreted = 1;
6800 +#endif /* X86_COMPILER2 */
6803 + fprintf(stderr, "Jlookup_by_regs: END with -1\n\n");
6807 + if (!is_interpreted) {
6810 + J->curr_fr.sender_sp = sender_sp;
6812 +#ifdef X86_COMPILER2
6813 + if (!J->curr_fr.fp) {
6814 + J->curr_fr.fp = (jframe->new_fp) ? jframe->new_fp : (uintptr_t)regs[R_FP];
6816 + if (!jframe->new_pc && jframe->new_fp) {
6817 + // This seems dubious
6818 + read_pointer(J, jframe->new_fp + POINTER_SIZE, &jframe->new_pc);
6821 + printf("Jlookup_by_regs: (update pc) jframe->new_fp: %#llx, jframe->new_pc: %#llx\n",
6822 + jframe->new_fp, jframe->new_pc);
6826 +#endif /* X86_COMPILER2 */
6827 + J->prev_fr = J->curr_fr;
6830 + fprintf(stderr, "Jlookup_by_regs: END\n\n");
6838 +void update_gregs(prgregset_t gregs, Jframe_t jframe) {
6839 +#ifdef X86_COMPILER2
6841 + 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]);
6844 + * A workaround for java C2 frames with unconventional FP.
6845 + * may have to modify regset with new values for FP/PC/SP when needed.
6847 + if (jframe.new_sp) {
6848 + *((uintptr_t *) &gregs[R_SP]) = (uintptr_t) jframe.new_sp;
6850 + // *((uintptr_t *) &gregs[R_SP]) = (uintptr_t) gregs[R_FP] + 2 * POINTER_SIZE;
6853 + if (jframe.new_fp) {
6854 + *((uintptr_t *) &gregs[R_FP]) = (uintptr_t) jframe.new_fp;
6856 + if (jframe.new_pc) {
6857 + *((uintptr_t *) &gregs[R_PC]) = (uintptr_t) jframe.new_pc;
6860 + 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]);
6862 +#endif /* X86_COMPILER2 */
6866 + * Iterates over java frames at current location given by 'gregs'.
6868 + * Returns -1 if no java frames are present or if an error is encountered.
6869 + * Returns the result of calling 'func' if the return value is non-zero.
6870 + * Returns 0 otherwise.
6872 +int Jframe_iter(jvm_agent_t *J, prgregset_t gregs, java_stack_f *func, void* cld) {
6873 + char buf[MAX_SYM_SIZE + 1];
6876 +#ifdef X86_COMPILER2
6878 + fprintf(stderr, "Jframe_iter: Entry sp = 0x%llx, fp = 0x%llx, pc = 0x%llx\n", gregs[R_SP], gregs[R_FP], gregs[R_PC]);
6880 +#endif /* X86_COMPILER2 */
6882 + memset(&jframe, 0, sizeof(Jframe_t));
6883 + memset(buf, 0, sizeof(buf));
6884 + res = Jlookup_by_regs(J, gregs, buf, sizeof(buf), &jframe);
6889 + res = func(cld, gregs, buf, (jframe.locinf)? jframe.bci : -1,
6890 + jframe.line, NULL);
6892 + update_gregs(gregs, jframe);
6895 + for (i = 1; i < jframe.vf_cnt; i++) {
6896 + Jget_vframe(J, i, buf, sizeof(buf), &jframe);
6897 + res = func(cld, gregs, buf, (jframe.locinf)? jframe.bci : -1,
6898 + jframe.line, NULL);
6900 + update_gregs(gregs, jframe);
6904 + update_gregs(gregs, jframe);
6907 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_db/libjvm_db.h jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_db/libjvm_db.h
6908 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_db/libjvm_db.h 1970-01-01 01:00:00.000000000 +0100
6909 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_db/libjvm_db.h 2024-12-29 15:20:25.116453296 +0100
6912 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
6913 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6915 + * This code is free software; you can redistribute it and/or modify it
6916 + * under the terms of the GNU General Public License version 2 only, as
6917 + * published by the Free Software Foundation.
6919 + * This code is distributed in the hope that it will be useful, but WITHOUT
6920 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6921 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6922 + * version 2 for more details (a copy is included in the LICENSE file that
6923 + * accompanied this code).
6925 + * You should have received a copy of the GNU General Public License version
6926 + * 2 along with this work; if not, write to the Free Software Foundation,
6927 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6929 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6930 + * or visit www.oracle.com if you need additional information or have any
6935 +#ifndef OS_SOLARIS_DTRACE_LIBJVM_DB_H
6936 +#define OS_SOLARIS_DTRACE_LIBJVM_DB_H
6938 +#include <proc_service.h>
6945 +typedef struct jvm_agent jvm_agent_t;
6947 +#define JVM_DB_VERSION 1
6949 +JNIEXPORT jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers);
6952 + * Called from Jframe_iter() for each java frame. If it returns 0, then
6953 + * Jframe_iter() proceeds to the next frame. Otherwise, the return value is
6954 + * immediately returned to the caller of Jframe_iter().
6957 + * 'cld' is client supplied data (to maintain iterator state, if any).
6958 + * 'name' is java method name.
6959 + * 'bci' is byte code index. it will be -1 if not available.
6960 + * 'line' is java source line number. it will be 0 if not available.
6961 + * 'handle' is an abstract client handle, reserved for future expansions
6964 +typedef int java_stack_f(void *cld, const prgregset_t regs, const char* name, int bci, int line, void *handle);
6967 + * Iterates over the java frames at the current location. Returns -1 if no java
6968 + * frames were found, or if there was some unrecoverable error. Otherwise,
6969 + * returns the last value returned from 'func'.
6971 +JNIEXPORT int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld);
6973 +JNIEXPORT void Jagent_destroy(jvm_agent_t *J);
6977 +#endif /* __cplusplus */
6979 +#endif // OS_SOLARIS_DTRACE_LIBJVM_DB_H
6980 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.c jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.c
6981 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.c 1970-01-01 01:00:00.000000000 +0100
6982 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.c 2024-12-29 15:20:25.117042942 +0100
6985 + * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
6986 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6988 + * This code is free software; you can redistribute it and/or modify it
6989 + * under the terms of the GNU General Public License version 2 only, as
6990 + * published by the Free Software Foundation.
6992 + * This code is distributed in the hope that it will be useful, but WITHOUT
6993 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6994 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6995 + * version 2 for more details (a copy is included in the LICENSE file that
6996 + * accompanied this code).
6998 + * You should have received a copy of the GNU General Public License version
6999 + * 2 along with this work; if not, write to the Free Software Foundation,
7000 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7002 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7003 + * or visit www.oracle.com if you need additional information or have any
7011 +#include <limits.h>
7013 +#include <signal.h>
7014 +#include <stdarg.h>
7016 +#include <stdlib.h>
7017 +#include <string.h>
7018 +#include <sys/types.h>
7019 +#include <sys/stat.h>
7020 +#include <thread.h>
7021 +#include <unistd.h>
7022 +#include "jvm_dtrace.h"
7024 +// NOTE: These constants are used in JVM code as well.
7025 +// KEEP JVM CODE IN SYNC if you are going to change these...
7027 +#define DTRACE_ALLOC_PROBES 0x1
7028 +#define DTRACE_METHOD_PROBES 0x2
7029 +#define DTRACE_MONITOR_PROBES 0x4
7030 +#define DTRACE_ALL_PROBES -1
7032 +// generic error messages
7033 +#define JVM_ERR_OUT_OF_MEMORY "out of memory (native heap)"
7034 +#define JVM_ERR_INVALID_PARAM "invalid input parameter(s)"
7035 +#define JVM_ERR_NULL_PARAM "input parameter is NULL"
7037 +// error messages for attach
7038 +#define JVM_ERR_CANT_OPEN_DOOR "cannot open door file"
7039 +#define JVM_ERR_CANT_CREATE_ATTACH_FILE "cannot create attach file"
7040 +#define JVM_ERR_DOOR_FILE_PERMISSION "door file is not secure"
7041 +#define JVM_ERR_CANT_SIGNAL "cannot send SIGQUIT to target"
7043 +// error messages for enable probe
7044 +#define JVM_ERR_DOOR_CMD_SEND "door command send failed"
7045 +#define JVM_ERR_DOOR_CANT_READ_STATUS "cannot read door command status"
7046 +#define JVM_ERR_DOOR_CMD_STATUS "door command error status"
7048 +// error message for detach
7049 +#define JVM_ERR_CANT_CLOSE_DOOR "cannot close door file"
7051 +#define RESTARTABLE(_cmd, _result) do { \
7054 + } while((_result == -1) && (errno == EINTR)); \
7062 +static int libjvm_dtrace_debug;
7063 +static void print_debug(const char* fmt,...) {
7064 + if (libjvm_dtrace_debug) {
7066 + va_start(alist, fmt);
7067 + fputs("libjvm_dtrace DEBUG: ", stderr);
7068 + vfprintf(stderr, fmt, alist);
7073 +/* Key for thread local error message */
7074 +static thread_key_t jvm_error_key;
7076 +/* init function for this library */
7077 +static void init_jvm_dtrace() {
7078 + /* check for env. var for debug mode */
7079 + libjvm_dtrace_debug = getenv("LIBJVM_DTRACE_DEBUG") != NULL;
7080 + /* create key for thread local error message */
7081 + if (thr_keycreate(&jvm_error_key, NULL) != 0) {
7082 + print_debug("can't create thread_key_t for jvm error key\n");
7087 +#pragma init(init_jvm_dtrace)
7089 +/* set thread local error message */
7090 +static void set_jvm_error(const char* msg) {
7091 + thr_setspecific(jvm_error_key, (void*)msg);
7094 +/* clear thread local error message */
7095 +static void clear_jvm_error() {
7096 + thr_setspecific(jvm_error_key, NULL);
7099 +/* file handling functions that can handle interrupt */
7101 +static int file_open(const char* path, int flag) {
7103 + RESTARTABLE(open(path, flag), ret);
7107 +static int file_close(int fd) {
7111 +static int file_read(int fd, char* buf, int len) {
7113 + RESTARTABLE(read(fd, buf, len), ret);
7117 +/* send SIGQUIT signal to given process */
7118 +static int send_sigquit(pid_t pid) {
7120 + RESTARTABLE(kill(pid, SIGQUIT), ret);
7124 +/* called to check permissions on attach file */
7125 +static int check_permission(const char* path) {
7131 + * Check that the path is owned by the effective uid/gid of this
7132 + * process. Also check that group/other access is not allowed.
7137 + res = stat64(path, &sb);
7139 + print_debug("stat failed for %s\n", path);
7143 + if ((sb.st_uid != uid) || (sb.st_gid != gid) ||
7144 + ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) != 0)) {
7145 + print_debug("well-known file %s is not secure\n", path);
7151 +#define ATTACH_FILE_PATTERN "/tmp/.attach_pid%d"
7153 +/* fill-in the name of attach file name in given buffer */
7154 +static void fill_attach_file_name(char* path, int len, pid_t pid) {
7155 + memset(path, 0, len);
7156 + sprintf(path, ATTACH_FILE_PATTERN, pid);
7159 +#define DOOR_FILE_PATTERN "/tmp/.java_pid%d"
7161 +/* open door file for the given JVM */
7162 +static int open_door(pid_t pid) {
7163 + char path[PATH_MAX + 1];
7166 + sprintf(path, DOOR_FILE_PATTERN, pid);
7167 + fd = file_open(path, O_RDONLY);
7169 + set_jvm_error(JVM_ERR_CANT_OPEN_DOOR);
7170 + print_debug("cannot open door file %s\n", path);
7173 + print_debug("opened door file %s\n", path);
7174 + if (check_permission(path) != 0) {
7175 + set_jvm_error(JVM_ERR_DOOR_FILE_PERMISSION);
7176 + print_debug("check permission failed for %s\n", path);
7183 +/* create attach file for given process */
7184 +static int create_attach_file(pid_t pid) {
7185 + char path[PATH_MAX + 1];
7187 + fill_attach_file_name(path, sizeof(path), pid);
7188 + fd = file_open(path, O_CREAT | O_RDWR);
7190 + set_jvm_error(JVM_ERR_CANT_CREATE_ATTACH_FILE);
7191 + print_debug("cannot create file %s\n", path);
7193 + print_debug("created attach file %s\n", path);
7198 +/* delete attach file for given process */
7199 +static void delete_attach_file(pid_t pid) {
7200 + char path[PATH_MAX + 1];
7201 + fill_attach_file_name(path, sizeof(path), pid);
7202 + int res = unlink(path);
7204 + print_debug("cannot delete attach file %s\n", path);
7206 + print_debug("deleted attach file %s\n", path);
7210 +/* attach to given JVM */
7211 +jvm_t* jvm_attach(pid_t pid) {
7213 + int door_fd, attach_fd, i = 0;
7215 + jvm = (jvm_t*) calloc(1, sizeof(jvm_t));
7216 + if (jvm == NULL) {
7217 + set_jvm_error(JVM_ERR_OUT_OF_MEMORY);
7218 + print_debug("calloc failed in %s at %d\n", __FILE__, __LINE__);
7224 + door_fd = open_door(pid);
7225 + if (door_fd < 0) {
7226 + print_debug("trying to create attach file\n");
7227 + if ((attach_fd = create_attach_file(pid)) < 0) {
7231 + /* send QUIT signal to the target so that it will
7232 + * check for the attach file.
7234 + if (send_sigquit(pid) != 0) {
7235 + set_jvm_error(JVM_ERR_CANT_SIGNAL);
7236 + print_debug("sending SIGQUIT failed\n");
7240 + /* give the target VM time to start the attach mechanism */
7243 + RESTARTABLE(poll(0, 0, 200), res);
7244 + door_fd = open_door(pid);
7246 + } while (i <= 50 && door_fd == -1);
7247 + if (door_fd < 0) {
7248 + print_debug("Unable to open door to process %d\n", pid);
7254 + if (attach_fd >= 0) {
7255 + file_close(attach_fd);
7256 + delete_attach_file(jvm->pid);
7258 + if (door_fd >= 0) {
7259 + jvm->door_fd = door_fd;
7260 + clear_jvm_error();
7268 +/* return the last thread local error message */
7269 +const char* jvm_get_last_error() {
7270 + const char* res = NULL;
7271 + thr_getspecific(jvm_error_key, (void**)&res);
7275 +/* detach the givenb JVM */
7276 +int jvm_detach(jvm_t* jvm) {
7279 + if (jvm->door_fd != -1) {
7280 + if (file_close(jvm->door_fd) != 0) {
7281 + set_jvm_error(JVM_ERR_CANT_CLOSE_DOOR);
7284 + clear_jvm_error();
7290 + set_jvm_error(JVM_ERR_NULL_PARAM);
7291 + print_debug("jvm_t* is NULL\n");
7297 + * A simple table to translate some known errors into reasonable
7303 +} const error_messages[] = {
7304 + { 100, "Bad request" },
7305 + { 101, "Protocol mismatch" },
7306 + { 102, "Resource failure" },
7307 + { 103, "Internal error" },
7308 + { 104, "Permission denied" },
7312 + * Lookup the given error code and return the appropriate
7313 + * message. If not found return NULL.
7315 +static const char* translate_error(int err) {
7316 + int table_size = sizeof(error_messages) / sizeof(error_messages[0]);
7319 + for (i=0; i<table_size; i++) {
7320 + if (err == error_messages[i].err) {
7321 + return error_messages[i].msg;
7328 + * Current protocol version
7330 +static const char* PROTOCOL_VERSION = "1";
7332 +#define RES_BUF_SIZE 128
7335 + * Enqueue attach-on-demand command to the given JVM
7338 +int enqueue_command(jvm_t* jvm, const char* cstr, int arg_count, const char** args) {
7340 + door_arg_t door_args;
7341 + char res_buffer[RES_BUF_SIZE];
7347 + * First we get the command string and create the start of the
7348 + * argument string to send to the target VM:
7351 + if (cstr == NULL) {
7352 + print_debug("command name is NULL\n");
7355 + size = strlen(PROTOCOL_VERSION) + strlen(cstr) + 2;
7356 + buf = (char*)malloc(size);
7357 + if (buf != NULL) {
7359 + strcpy(buf, PROTOCOL_VERSION);
7360 + pos += strlen(PROTOCOL_VERSION)+1;
7361 + strcpy(pos, cstr);
7363 + set_jvm_error(JVM_ERR_OUT_OF_MEMORY);
7364 + print_debug("malloc failed at %d in %s\n", __LINE__, __FILE__);
7369 + * Next we iterate over the arguments and extend the buffer
7370 + * to include them.
7372 + for (i=0; i<arg_count; i++) {
7374 + if (cstr != NULL) {
7375 + size_t len = strlen(cstr);
7376 + char* newbuf = (char*)realloc(buf, size+len+1);
7377 + if (newbuf == NULL) {
7378 + set_jvm_error(JVM_ERR_OUT_OF_MEMORY);
7379 + print_debug("realloc failed in %s at %d\n", __FILE__, __LINE__);
7383 + strcpy(buf+size, cstr);
7389 + * The arguments to the door function are in 'buf' so we now
7390 + * do the door call
7392 + door_args.data_ptr = buf;
7393 + door_args.data_size = size;
7394 + door_args.desc_ptr = NULL;
7395 + door_args.desc_num = 0;
7396 + door_args.rbuf = (char*)&res_buffer;
7397 + door_args.rsize = sizeof(res_buffer);
7399 + RESTARTABLE(door_call(jvm->door_fd, &door_args), rc);
7402 + * door_call failed
7405 + print_debug("door_call failed\n");
7408 + * door_call succeeded but the call didn't return the expected jint.
7410 + if (door_args.data_size < sizeof(int)) {
7411 + print_debug("Enqueue error - reason unknown as result is truncated!");
7413 + int* res = (int*)(door_args.data_ptr);
7415 + const char* msg = translate_error(*res);
7416 + if (msg == NULL) {
7417 + print_debug("Unable to enqueue command to target VM: %d\n", *res);
7419 + print_debug("Unable to enqueue command to target VM: %s\n", msg);
7423 + * The door call should return a file descriptor to one end of
7426 + if ((door_args.desc_ptr != NULL) &&
7427 + (door_args.desc_num == 1) &&
7428 + (door_args.desc_ptr->d_attributes & DOOR_DESCRIPTOR)) {
7429 + result = door_args.desc_ptr->d_data.d_desc.d_descriptor;
7431 + print_debug("Reply from enqueue missing descriptor!\n");
7438 + if (buf) free(buf);
7442 +/* read status code for a door command */
7443 +static int read_status(int fd) {
7448 + if (file_read(fd, &ch, sizeof(ch)) != sizeof(ch)) {
7449 + set_jvm_error(JVM_ERR_DOOR_CANT_READ_STATUS);
7450 + print_debug("door cmd status: read status failed\n");
7453 + buf[index++] = ch;
7455 + buf[index - 1] = '\0';
7458 + if (index == sizeof(buf)) {
7459 + set_jvm_error(JVM_ERR_DOOR_CANT_READ_STATUS);
7460 + print_debug("door cmd status: read status overflow\n");
7466 +static const char* ENABLE_DPROBES_CMD = "enabledprobes";
7468 +/* enable one or more DTrace probes for a given JVM */
7469 +int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types) {
7470 + int fd, status = 0;
7472 + const char* args[1];
7474 + int probe_type = 0, index;
7477 + if (jvm == NULL) {
7478 + set_jvm_error(JVM_ERR_NULL_PARAM);
7479 + print_debug("jvm_t* is NULL\n");
7483 + if (num_probe_types == 0 || probe_types == NULL ||
7484 + probe_types[0] == NULL) {
7485 + set_jvm_error(JVM_ERR_INVALID_PARAM);
7486 + print_debug("invalid probe type argument(s)\n");
7490 + for (index = 0; index < num_probe_types; index++) {
7491 + const char* p = probe_types[index];
7492 + if (strcmp(p, JVM_DTPROBE_OBJECT_ALLOC) == 0) {
7493 + probe_type |= DTRACE_ALLOC_PROBES;
7495 + } else if (strcmp(p, JVM_DTPROBE_METHOD_ENTRY) == 0 ||
7496 + strcmp(p, JVM_DTPROBE_METHOD_RETURN) == 0) {
7497 + probe_type |= DTRACE_METHOD_PROBES;
7499 + } else if (strcmp(p, JVM_DTPROBE_MONITOR_ENTER) == 0 ||
7500 + strcmp(p, JVM_DTPROBE_MONITOR_ENTERED) == 0 ||
7501 + strcmp(p, JVM_DTPROBE_MONITOR_EXIT) == 0 ||
7502 + strcmp(p, JVM_DTPROBE_MONITOR_WAIT) == 0 ||
7503 + strcmp(p, JVM_DTPROBE_MONITOR_WAITED) == 0 ||
7504 + strcmp(p, JVM_DTPROBE_MONITOR_NOTIFY) == 0 ||
7505 + strcmp(p, JVM_DTPROBE_MONITOR_NOTIFYALL) == 0) {
7506 + probe_type |= DTRACE_MONITOR_PROBES;
7508 + } else if (strcmp(p, JVM_DTPROBE_ALL) == 0) {
7509 + probe_type |= DTRACE_ALL_PROBES;
7517 + sprintf(buf, "%d", probe_type);
7520 + fd = enqueue_command(jvm, ENABLE_DPROBES_CMD, 1, args);
7522 + set_jvm_error(JVM_ERR_DOOR_CMD_SEND);
7526 + status = read_status(fd);
7527 + // non-zero status is error
7529 + set_jvm_error(JVM_ERR_DOOR_CMD_STATUS);
7530 + print_debug("%s command failed (status: %d) in target JVM\n",
7531 + ENABLE_DPROBES_CMD, status);
7535 + // read from stream until EOF
7536 + while (file_read(fd, &ch, sizeof(ch)) == sizeof(ch)) {
7537 + if (libjvm_dtrace_debug) {
7543 + clear_jvm_error();
7546 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h
7547 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h 1970-01-01 01:00:00.000000000 +0100
7548 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h 2024-12-29 15:20:25.117336462 +0100
7551 + * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
7552 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7554 + * This code is free software; you can redistribute it and/or modify it
7555 + * under the terms of the GNU General Public License version 2 only, as
7556 + * published by the Free Software Foundation.
7558 + * This code is distributed in the hope that it will be useful, but WITHOUT
7559 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7560 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7561 + * version 2 for more details (a copy is included in the LICENSE file that
7562 + * accompanied this code).
7564 + * You should have received a copy of the GNU General Public License version
7565 + * 2 along with this work; if not, write to the Free Software Foundation,
7566 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7568 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7569 + * or visit www.oracle.com if you need additional information or have any
7574 +#ifndef _JVM_DTRACE_H_
7575 +#define _JVM_DTRACE_H_
7578 + * Interface to dynamically turn on probes in Hotspot JVM. Currently,
7579 + * this interface can be used to dynamically enable certain DTrace
7580 + * probe points that are costly to have "always on".
7587 +#include <sys/types.h>
7591 +typedef struct _jvm_t jvm_t;
7594 +/* Attach to the given JVM process. Returns NULL on failure.
7595 + jvm_get_last_error() returns last error message. */
7596 +JNIEXPORT jvm_t* jvm_attach(pid_t pid);
7598 +/* Returns the last error message from this library or NULL if none. */
7599 +JNIEXPORT const char* jvm_get_last_error();
7601 +/* few well-known probe type constants for 'probe_types' param below */
7603 +#define JVM_DTPROBE_METHOD_ENTRY "method-entry"
7604 +#define JVM_DTPROBE_METHOD_RETURN "method-return"
7605 +#define JVM_DTPROBE_MONITOR_ENTER "monitor-contended-enter"
7606 +#define JVM_DTPROBE_MONITOR_ENTERED "monitor-contended-entered"
7607 +#define JVM_DTPROBE_MONITOR_EXIT "monitor-contended-exit"
7608 +#define JVM_DTPROBE_MONITOR_WAIT "monitor-wait"
7609 +#define JVM_DTPROBE_MONITOR_WAITED "monitor-waited"
7610 +#define JVM_DTPROBE_MONITOR_NOTIFY "monitor-notify"
7611 +#define JVM_DTPROBE_MONITOR_NOTIFYALL "monitor-notifyall"
7612 +#define JVM_DTPROBE_OBJECT_ALLOC "object-alloc"
7613 +#define JVM_DTPROBE_ALL "*"
7615 +/* Enable the specified DTrace probes of given probe types on
7616 + * the specified JVM. Returns >= 0 on success, -1 on failure.
7617 + * On success, this returns number of probe_types enabled.
7618 + * On failure, jvm_get_last_error() returns the last error message.
7620 +JNIEXPORT int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
7622 +/* Note: There is no jvm_disable_dtprobes function. Probes are automatically
7623 + * disabled when there are no more clients requiring those probes.
7626 +/* Detach the given JVM. Returns 0 on success, -1 on failure.
7627 + * jvm_get_last_error() returns the last error message.
7629 +JNIEXPORT int jvm_detach(jvm_t* jvm);
7635 +#endif /* _JVM_DTRACE_H_ */
7636 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnet/solaris_close.c jdk24u-jdk-24-29/src/java.base/solaris/native/libnet/solaris_close.c
7637 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnet/solaris_close.c 1970-01-01 01:00:00.000000000 +0100
7638 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libnet/solaris_close.c 2024-12-29 15:20:25.117676952 +0100
7641 + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
7642 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7644 + * This code is free software; you can redistribute it and/or modify it
7645 + * under the terms of the GNU General Public License version 2 only, as
7646 + * published by the Free Software Foundation. Oracle designates this
7647 + * particular file as subject to the "Classpath" exception as provided
7648 + * by Oracle in the LICENSE file that accompanied this code.
7650 + * This code is distributed in the hope that it will be useful, but WITHOUT
7651 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7652 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7653 + * version 2 for more details (a copy is included in the LICENSE file that
7654 + * accompanied this code).
7656 + * You should have received a copy of the GNU General Public License version
7657 + * 2 along with this work; if not, write to the Free Software Foundation,
7658 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7660 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7661 + * or visit www.oracle.com if you need additional information or have any
7666 +#include <sys/socket.h>
7667 +#include <stropts.h>
7668 +#include <unistd.h>
7670 +#include "net_util.h"
7672 +/* Support for restartable system calls on Solaris. */
7674 +#define RESTARTABLE_RETURN_INT(_cmd) do { \
7679 + } while((_result == -1) && (errno == EINTR)); \
7684 +int NET_Read(int s, void* buf, size_t len) {
7685 + RESTARTABLE_RETURN_INT(recv(s, buf, len, 0));
7688 +int NET_NonBlockingRead(int s, void* buf, size_t len) {
7689 + RESTARTABLE_RETURN_INT(recv(s, buf, len, MSG_DONTWAIT));
7692 +int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
7693 + struct sockaddr *from, socklen_t *fromlen) {
7694 + RESTARTABLE_RETURN_INT(recvfrom(s, buf, len, flags, from, fromlen));
7697 +int NET_Send(int s, void *msg, int len, unsigned int flags) {
7698 + RESTARTABLE_RETURN_INT(send(s, msg, len, flags));
7701 +int NET_SendTo(int s, const void *msg, int len, unsigned int flags,
7702 + const struct sockaddr *to, int tolen) {
7703 + RESTARTABLE_RETURN_INT(sendto(s, msg, len, flags, to, tolen));
7706 +int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
7707 + RESTARTABLE_RETURN_INT(connect(s, addr, addrlen));
7710 +int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) {
7711 + RESTARTABLE_RETURN_INT(accept(s, addr, addrlen));
7714 +int NET_SocketClose(int fd) {
7718 +int NET_Dup2(int fd, int fd2) {
7719 + return dup2(fd, fd2);
7722 +int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
7723 + RESTARTABLE_RETURN_INT(poll(ufds, nfds, timeout));
7726 +int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) {
7728 + jlong prevNanoTime = nanoTimeStamp;
7729 + jlong nanoTimeout = (jlong) timeout * NET_NSEC_PER_MSEC;
7730 + struct pollfd pfd;
7732 + pfd.events = POLLIN;
7735 + result = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC);
7736 + if (result < 0 && errno == EINTR) {
7737 + jlong newNanoTime = JVM_NanoTime(env, 0);
7738 + nanoTimeout -= newNanoTime - prevNanoTime;
7739 + if (nanoTimeout < NET_NSEC_PER_MSEC)
7741 + prevNanoTime = newNanoTime;
7747 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c
7748 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c 1970-01-01 01:00:00.000000000 +0100
7749 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c 2024-12-29 15:20:25.118056807 +0100
7752 + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
7753 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7755 + * This code is free software; you can redistribute it and/or modify it
7756 + * under the terms of the GNU General Public License version 2 only, as
7757 + * published by the Free Software Foundation. Oracle designates this
7758 + * particular file as subject to the "Classpath" exception as provided
7759 + * by Oracle in the LICENSE file that accompanied this code.
7761 + * This code is distributed in the hope that it will be useful, but WITHOUT
7762 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7763 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7764 + * version 2 for more details (a copy is included in the LICENSE file that
7765 + * accompanied this code).
7767 + * You should have received a copy of the GNU General Public License version
7768 + * 2 along with this work; if not, write to the Free Software Foundation,
7769 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7771 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7772 + * or visit www.oracle.com if you need additional information or have any
7776 +#include <sys/types.h>
7777 +#include <sys/stat.h>
7778 +#include <devpoll.h>
7783 +#include "jni_util.h"
7787 +#include "nio_util.h"
7789 +#include "sun_nio_ch_DevPollArrayWrapper.h"
7791 +JNIEXPORT jint JNICALL
7792 +Java_sun_nio_ch_DevPollArrayWrapper_init(JNIEnv *env, jobject this)
7794 + int wfd = open("/dev/poll", O_RDWR);
7796 + JNU_ThrowIOExceptionWithLastError(env, "Error opening driver");
7802 +JNIEXPORT void JNICALL
7803 +Java_sun_nio_ch_DevPollArrayWrapper_register(JNIEnv *env, jobject this,
7804 + jint wfd, jint fd, jint mask)
7806 + struct pollfd a[1];
7810 + a[0].events = mask;
7813 + n = write(wfd, &a[0], sizeof(a));
7814 + if (n != sizeof(a)) {
7816 + JNU_ThrowIOExceptionWithLastError(env, "Error writing pollfds");
7818 + JNU_ThrowIOException(env, "Unexpected number of bytes written");
7823 +JNIEXPORT void JNICALL
7824 +Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple(JNIEnv *env, jobject this,
7825 + jint wfd, jlong address,
7828 + unsigned char *pollBytes = (unsigned char *)jlong_to_ptr(address);
7829 + unsigned char *pollEnd = pollBytes + sizeof(struct pollfd) * len;
7830 + while (pollBytes < pollEnd) {
7831 + int bytesWritten = write(wfd, pollBytes, (int)(pollEnd - pollBytes));
7832 + if (bytesWritten < 0) {
7833 + JNU_ThrowIOExceptionWithLastError(env, "Error writing pollfds");
7836 + pollBytes += bytesWritten;
7840 +JNIEXPORT jint JNICALL
7841 +Java_sun_nio_ch_DevPollArrayWrapper_poll0(JNIEnv *env, jobject this,
7842 + jlong address, jint numfds,
7843 + jlong timeout, jint wfd)
7846 + void *pfd = (void *) jlong_to_ptr(address);
7850 + a.dp_nfds = numfds;
7851 + a.dp_timeout = (int)timeout;
7852 + result = ioctl(wfd, DP_POLL, &a);
7854 + if (errno == EINTR) {
7855 + return IOS_INTERRUPTED;
7857 + JNU_ThrowIOExceptionWithLastError(env, "Error reading driver");
7858 + return IOS_THROWN;
7863 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/ch/SolarisEventPort.c jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/ch/SolarisEventPort.c
7864 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/ch/SolarisEventPort.c 1970-01-01 01:00:00.000000000 +0100
7865 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/ch/SolarisEventPort.c 2024-12-29 15:20:25.118352849 +0100
7868 + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
7869 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7871 + * This code is free software; you can redistribute it and/or modify it
7872 + * under the terms of the GNU General Public License version 2 only, as
7873 + * published by the Free Software Foundation. Oracle designates this
7874 + * particular file as subject to the "Classpath" exception as provided
7875 + * by Oracle in the LICENSE file that accompanied this code.
7877 + * This code is distributed in the hope that it will be useful, but WITHOUT
7878 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7879 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7880 + * version 2 for more details (a copy is included in the LICENSE file that
7881 + * accompanied this code).
7883 + * You should have received a copy of the GNU General Public License version
7884 + * 2 along with this work; if not, write to the Free Software Foundation,
7885 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7887 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7888 + * or visit www.oracle.com if you need additional information or have any
7892 +#include <stdlib.h>
7894 +#include <sys/types.h>
7898 +#include "jni_util.h"
7902 +#include "nio_util.h"
7904 +#include "sun_nio_ch_SolarisEventPort.h"
7906 +JNIEXPORT jint JNICALL
7907 +Java_sun_nio_ch_SolarisEventPort_port_1create
7908 + (JNIEnv* env, jclass clazz)
7910 + int port = port_create();
7912 + JNU_ThrowIOExceptionWithLastError(env, "port_create");
7914 + return (jint)port;
7917 +JNIEXPORT void JNICALL
7918 +Java_sun_nio_ch_SolarisEventPort_port_1close
7919 + (JNIEnv* env, jclass clazz, jint port)
7921 + int res = close(port);
7922 + if (res < 0 && res != EINTR) {
7923 + JNU_ThrowIOExceptionWithLastError(env, "close failed");
7927 +JNIEXPORT jboolean JNICALL
7928 +Java_sun_nio_ch_SolarisEventPort_port_1associate
7929 + (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress, jint events)
7931 + uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress);
7932 + if (port_associate((int)port, (int)source, object, (int)events, NULL) == 0) {
7935 + if (errno != EBADFD)
7936 + JNU_ThrowIOExceptionWithLastError(env, "port_associate");
7941 +JNIEXPORT jboolean JNICALL
7942 +Java_sun_nio_ch_SolarisEventPort_port_1dissociate
7943 + (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress)
7945 + uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress);
7947 + if (port_dissociate((int)port, (int)source, object) == 0) {
7950 + if (errno != ENOENT)
7951 + JNU_ThrowIOExceptionWithLastError(env, "port_dissociate");
7956 +JNIEXPORT void JNICALL
7957 +Java_sun_nio_ch_SolarisEventPort_port_1send(JNIEnv* env, jclass clazz,
7958 + jint port, jint events)
7960 + if (port_send((int)port, (int)events, NULL) == -1) {
7961 + JNU_ThrowIOExceptionWithLastError(env, "port_send");
7965 +JNIEXPORT jint JNICALL
7966 +Java_sun_nio_ch_SolarisEventPort_port_1get(JNIEnv* env, jclass clazz,
7967 + jint port, jlong eventAddress)
7970 + port_event_t* ev = (port_event_t*)jlong_to_ptr(eventAddress);
7972 + res = port_get((int)port, ev, NULL);
7974 + if (errno == EINTR) {
7975 + return IOS_INTERRUPTED;
7977 + JNU_ThrowIOExceptionWithLastError(env, "port_get failed");
7978 + return IOS_THROWN;
7984 +JNIEXPORT jint JNICALL
7985 +Java_sun_nio_ch_SolarisEventPort_port_1getn(JNIEnv* env, jclass clazz,
7986 + jint port, jlong arrayAddress, jint max, jlong timeout)
7990 + port_event_t* list = (port_event_t*)jlong_to_ptr(arrayAddress);
7994 + if (timeout >= 0L) {
7995 + ts.tv_sec = timeout / 1000;
7996 + ts.tv_nsec = 1000000 * (timeout % 1000);
8002 + res = port_getn((int)port, list, (uint_t)max, &n, tsp);
8003 + if (res == -1 && errno != ETIME) {
8004 + if (errno == EINTR) {
8005 + return IOS_INTERRUPTED;
8007 + JNU_ThrowIOExceptionWithLastError(env, "port_getn failed");
8008 + return IOS_THROWN;
8014 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/fs/SolarisNativeDispatcher.c jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/fs/SolarisNativeDispatcher.c
8015 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/fs/SolarisNativeDispatcher.c 1970-01-01 01:00:00.000000000 +0100
8016 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/fs/SolarisNativeDispatcher.c 2024-12-29 15:20:25.118707919 +0100
8019 + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
8020 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8022 + * This code is free software; you can redistribute it and/or modify it
8023 + * under the terms of the GNU General Public License version 2 only, as
8024 + * published by the Free Software Foundation. Oracle designates this
8025 + * particular file as subject to the "Classpath" exception as provided
8026 + * by Oracle in the LICENSE file that accompanied this code.
8028 + * This code is distributed in the hope that it will be useful, but WITHOUT
8029 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8030 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8031 + * version 2 for more details (a copy is included in the LICENSE file that
8032 + * accompanied this code).
8034 + * You should have received a copy of the GNU General Public License version
8035 + * 2 along with this work; if not, write to the Free Software Foundation,
8036 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8038 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8039 + * or visit www.oracle.com if you need additional information or have any
8044 +#include "jni_util.h"
8048 +#include <strings.h>
8050 +#include <sys/acl.h>
8051 +#include <sys/mnttab.h>
8052 +#include <sys/mkdev.h>
8056 +#include "sun_nio_fs_SolarisNativeDispatcher.h"
8058 +static jfieldID entry_name;
8059 +static jfieldID entry_dir;
8060 +static jfieldID entry_fstype;
8061 +static jfieldID entry_options;
8062 +static jfieldID entry_dev;
8064 +static void throwUnixException(JNIEnv* env, int errnum) {
8065 + jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
8068 + (*env)->Throw(env, x);
8072 +JNIEXPORT void JNICALL
8073 +Java_sun_nio_fs_SolarisNativeDispatcher_init(JNIEnv *env, jclass clazz) {
8074 + clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
8075 + CHECK_NULL(clazz);
8076 + entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
8077 + CHECK_NULL(entry_name);
8078 + entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
8079 + CHECK_NULL(entry_dir);
8080 + entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
8081 + CHECK_NULL(entry_fstype);
8082 + entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
8083 + CHECK_NULL(entry_options);
8084 + entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J");
8085 + CHECK_NULL(entry_dev);
8088 +JNIEXPORT jint JNICALL
8089 +Java_sun_nio_fs_SolarisNativeDispatcher_facl(JNIEnv* env, jclass this, jint fd,
8090 + jint cmd, jint nentries, jlong address)
8092 + void* aclbufp = jlong_to_ptr(address);
8095 + n = facl((int)fd, (int)cmd, (int)nentries, aclbufp);
8097 + throwUnixException(env, errno);
8102 +JNIEXPORT jint JNICALL
8103 +Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent(JNIEnv* env, jclass this,
8104 + jlong value, jobject entry)
8106 + struct extmnttab ent;
8107 + FILE* fp = jlong_to_ptr(value);
8116 + if (getextmntent(fp, &ent, 0))
8118 + name = ent.mnt_special;
8119 + dir = ent.mnt_mountp;
8120 + fstype = ent.mnt_fstype;
8121 + options = ent.mnt_mntopts;
8122 + dev = makedev(ent.mnt_major, ent.mnt_minor);
8123 + if (dev == NODEV) {
8124 + throwUnixException(env, errno);
8128 + len = strlen(name);
8129 + bytes = (*env)->NewByteArray(env, len);
8130 + if (bytes == NULL)
8132 + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
8133 + (*env)->SetObjectField(env, entry, entry_name, bytes);
8135 + len = strlen(dir);
8136 + bytes = (*env)->NewByteArray(env, len);
8137 + if (bytes == NULL)
8139 + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
8140 + (*env)->SetObjectField(env, entry, entry_dir, bytes);
8142 + len = strlen(fstype);
8143 + bytes = (*env)->NewByteArray(env, len);
8144 + if (bytes == NULL)
8146 + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
8147 + (*env)->SetObjectField(env, entry, entry_fstype, bytes);
8149 + len = strlen(options);
8150 + bytes = (*env)->NewByteArray(env, len);
8151 + if (bytes == NULL)
8153 + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
8154 + (*env)->SetObjectField(env, entry, entry_options, bytes);
8157 + (*env)->SetLongField(env, entry, entry_dev, (jlong)dev);
8161 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/fs/SolarisWatchService.c jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/fs/SolarisWatchService.c
8162 --- jdk24u-jdk-24-29.orig/src/java.base/solaris/native/libnio/fs/SolarisWatchService.c 1970-01-01 01:00:00.000000000 +0100
8163 +++ jdk24u-jdk-24-29/src/java.base/solaris/native/libnio/fs/SolarisWatchService.c 2024-12-29 15:20:25.118985012 +0100
8166 + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
8167 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8169 + * This code is free software; you can redistribute it and/or modify it
8170 + * under the terms of the GNU General Public License version 2 only, as
8171 + * published by the Free Software Foundation. Oracle designates this
8172 + * particular file as subject to the "Classpath" exception as provided
8173 + * by Oracle in the LICENSE file that accompanied this code.
8175 + * This code is distributed in the hope that it will be useful, but WITHOUT
8176 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8177 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8178 + * version 2 for more details (a copy is included in the LICENSE file that
8179 + * accompanied this code).
8181 + * You should have received a copy of the GNU General Public License version
8182 + * 2 along with this work; if not, write to the Free Software Foundation,
8183 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8185 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8186 + * or visit www.oracle.com if you need additional information or have any
8191 +#include "jni_util.h"
8195 +#include <stdlib.h>
8197 +#include <sys/types.h>
8198 +#include <port.h> // Solaris 10
8200 +#include "sun_nio_fs_SolarisWatchService.h"
8202 +static void throwUnixException(JNIEnv* env, int errnum) {
8203 + jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
8206 + (*env)->Throw(env, x);
8210 +JNIEXPORT void JNICALL
8211 +Java_sun_nio_fs_SolarisWatchService_init(JNIEnv *env, jclass clazz)
8215 +JNIEXPORT jint JNICALL
8216 +Java_sun_nio_fs_SolarisWatchService_portCreate
8217 + (JNIEnv* env, jclass clazz)
8219 + int port = port_create();
8221 + throwUnixException(env, errno);
8223 + return (jint)port;
8226 +JNIEXPORT void JNICALL
8227 +Java_sun_nio_fs_SolarisWatchService_portAssociate
8228 + (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress, jint events)
8230 + uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress);
8232 + if (port_associate((int)port, (int)source, object, (int)events, NULL) == -1) {
8233 + throwUnixException(env, errno);
8237 +JNIEXPORT void JNICALL
8238 +Java_sun_nio_fs_SolarisWatchService_portDissociate
8239 + (JNIEnv* env, jclass clazz, jint port, jint source, jlong objectAddress)
8241 + uintptr_t object = (uintptr_t)jlong_to_ptr(objectAddress);
8243 + if (port_dissociate((int)port, (int)source, object) == -1) {
8244 + throwUnixException(env, errno);
8248 +JNIEXPORT void JNICALL
8249 +Java_sun_nio_fs_SolarisWatchService_portSend(JNIEnv* env, jclass clazz,
8250 + jint port, jint events)
8252 + if (port_send((int)port, (int)events, NULL) == -1) {
8253 + throwUnixException(env, errno);
8257 +JNIEXPORT jint JNICALL
8258 +Java_sun_nio_fs_SolarisWatchService_portGetn(JNIEnv* env, jclass clazz,
8259 + jint port, jlong arrayAddress, jint max)
8262 + port_event_t* list = (port_event_t*)jlong_to_ptr(arrayAddress);
8264 + if (port_getn((int)port, list, (uint_t)max, &n, NULL) == -1) {
8265 + throwUnixException(env, errno);
8269 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/classes/java/lang/ProcessImpl.java jdk24u-jdk-24-29/src/java.base/unix/classes/java/lang/ProcessImpl.java
8270 --- jdk24u-jdk-24-29.orig/src/java.base/unix/classes/java/lang/ProcessImpl.java 2024-12-29 15:19:42.811393248 +0100
8271 +++ jdk24u-jdk-24-29/src/java.base/unix/classes/java/lang/ProcessImpl.java 2024-12-29 15:20:25.077023951 +0100
8273 private /* final */ InputStream stdout;
8274 private /* final */ InputStream stderr;
8276 + // only used on Solaris
8277 + private /* final */ DeferredCloseInputStream stdout_inner_stream;
8279 private static enum LaunchMechanism {
8280 // order IS important!
8283 return lm; // All options are valid for Linux
8287 if (lm != LaunchMechanism.VFORK) {
8288 return lm; // All but VFORK are valid
8290 @@ -352,6 +356,44 @@
8295 + stdin = (fds[0] == -1) ?
8296 + ProcessBuilder.NullOutputStream.INSTANCE :
8297 + new BufferedOutputStream(
8298 + new FileOutputStream(newFileDescriptor(fds[0])));
8300 + stdout = (fds[1] == -1 || forceNullOutputStream) ?
8301 + ProcessBuilder.NullInputStream.INSTANCE :
8302 + new BufferedInputStream(
8303 + stdout_inner_stream =
8304 + new DeferredCloseInputStream(
8305 + newFileDescriptor(fds[1])));
8307 + stderr = (fds[2] == -1) ?
8308 + ProcessBuilder.NullInputStream.INSTANCE :
8309 + new DeferredCloseInputStream(newFileDescriptor(fds[2]));
8312 + * For each subprocess forked a corresponding reaper task
8313 + * is submitted. That task is the only thread which waits
8314 + * for the subprocess to terminate and it doesn't hold any
8315 + * locks while doing so. This design allows waitFor() and
8316 + * exitStatus() to be safely executed in parallel (and they
8317 + * need no native code).
8319 + ProcessHandleImpl.completion(pid, true).handle((exitcode, throwable) -> {
8322 + this.exitcode = (exitcode == null) ? -1 : exitcode.intValue();
8323 + this.hasExited = true;
8324 + condition.signalAll();
8333 stdin = (fds[0] == -1) ?
8334 ProcessBuilder.NullOutputStream.INSTANCE :
8335 @@ -468,6 +510,32 @@
8336 try { stderr.close(); } catch (IOException ignored) {}
8340 + // There is a risk that pid will be recycled, causing us to
8341 + // kill the wrong process! So we only terminate processes
8342 + // that appear to still be running. Even with this check,
8343 + // there is an unavoidable race condition here, but the window
8344 + // is very small, and OSes try hard to not recycle pids too
8345 + // soon, so this is quite safe.
8349 + processHandle.destroyProcess(force);
8355 + if (stdout_inner_stream != null)
8356 + stdout_inner_stream.closeDeferred(stdout);
8357 + if (stderr instanceof DeferredCloseInputStream)
8358 + ((DeferredCloseInputStream) stderr)
8359 + .closeDeferred(stderr);
8360 + } catch (IOException e) {
8365 default: throw new AssertionError("Unsupported platform: " + OperatingSystem.current());
8368 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/net/PortConfig.java jdk24u-jdk-24-29/src/java.base/unix/classes/sun/net/PortConfig.java
8369 --- jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/net/PortConfig.java 2024-12-29 15:19:42.821359283 +0100
8370 +++ jdk24u-jdk-24-29/src/java.base/unix/classes/sun/net/PortConfig.java 2024-12-29 15:20:25.077389238 +0100
8372 defaultLower = 32768;
8373 defaultUpper = 61000;
8376 + defaultLower = 32768;
8377 + defaultUpper = 65535;
8380 defaultLower = 49152;
8381 defaultUpper = 65535;
8382 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template jdk24u-jdk-24-29/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
8383 --- jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template 2024-12-29 15:19:42.816253450 +0100
8384 +++ jdk24u-jdk-24-29/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template 2024-12-29 15:20:25.077809589 +0100
8386 #include <sys/clonefile.h>
8389 +/* On Solaris, "sun" is defined as a macro. Undefine to make package
8390 + declaration valid */
8393 /* To be able to name the Java constants the same as the C constants without
8394 having the preprocessor rewrite those identifiers, add PREFIX_ to all
8395 identifiers matching a C constant. The PREFIX_ is filtered out in the
8396 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/security/provider/NativePRNG.java jdk24u-jdk-24-29/src/java.base/unix/classes/sun/security/provider/NativePRNG.java
8397 --- jdk24u-jdk-24-29.orig/src/java.base/unix/classes/sun/security/provider/NativePRNG.java 2024-12-29 15:19:42.820781612 +0100
8398 +++ jdk24u-jdk-24-29/src/java.base/unix/classes/sun/security/provider/NativePRNG.java 2024-12-29 15:20:25.078279522 +0100
8400 import sun.security.util.Debug;
8403 - * Native PRNG implementation for Linux/MacOS.
8404 + * Native PRNG implementation for Solaris/Linux/MacOS.
8406 * It obtains seed and random numbers by reading system files such as
8407 * the special device files /dev/random and /dev/urandom. This
8408 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/io_util_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/io_util_md.c
8409 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/io_util_md.c 2024-12-29 15:19:42.799027886 +0100
8410 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/io_util_md.c 2024-12-29 15:20:25.081380287 +0100
8416 +#include <sys/filio.h>
8419 #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
8420 #include <sys/ioctl.h>
8422 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/java_props_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/java_props_md.c
8423 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/java_props_md.c 2024-12-29 15:19:42.798452654 +0100
8424 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/java_props_md.c 2024-12-29 15:20:25.081812604 +0100
8425 @@ -323,6 +323,27 @@
8430 + if (strcmp(p,"eucJP") == 0) {
8431 + /* For Solaris use customized vendor defined character
8432 + * customized EUC-JP converter
8434 + *std_encoding = "eucJP-open";
8435 + } else if (strcmp(p, "Big5") == 0 || strcmp(p, "BIG5") == 0) {
8437 + * Remap the encoding string to Big5_Solaris which augments
8438 + * the default converter for Solaris Big5 locales to include
8439 + * seven additional ideographic characters beyond those included
8440 + * in the Java "Big5" converter.
8442 + *std_encoding = "Big5_Solaris";
8443 + } else if (strcmp(p, "Big5-HKSCS") == 0) {
8445 + * Solaris uses HKSCS2001
8447 + *std_encoding = "Big5-HKSCS-2001";
8452 * For the case on MacOS X where encoding is set to US-ASCII, but we
8453 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
8454 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c 2024-12-29 15:19:42.798670317 +0100
8455 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c 2024-12-29 15:20:25.078980612 +0100
8457 #include <sys/stat.h>
8458 #include <sys/wait.h>
8460 +/* For POSIX-compliant getpwuid_r on Solaris */
8461 +#if defined(__solaris__)
8462 +#define _POSIX_PTHREAD_SEMANTICS
8467 +#include <procfs.h>
8471 #include <sys/procfs.h>
8473 @@ -122,13 +130,18 @@
8474 #define WTERMSIG(status) ((status)&0x7F)
8478 /* The child exited because of a signal.
8479 * The best value to return is 0x80 + signal number,
8480 * because that is what all Unix shells do, and because
8481 * it allows callers to distinguish between process exit and
8482 * process death by signal.
8484 + * Unfortunately, the historical behavior on Solaris is to return
8485 + * the signal number, and we preserve this for compatibility. */
8486 +#define WTERMSIG_RETURN(status) WTERMSIG(status)
8488 #define WTERMSIG_RETURN(status) (WTERMSIG(status) + 0x80)
8491 /* Field id for jString 'command' in java.lang.ProcessHandleImpl.Info */
8492 jfieldID ProcessHandleImpl_Info_commandID;
8494 * The following functions are for Linux
8497 -#if defined (__linux__)
8498 +#if defined(__solaris__) || defined (__linux__)
8501 * Return pids of active processes, and optionally parent pids and
8502 @@ -598,13 +611,13 @@
8506 -#endif // defined (__linux__)
8507 +#endif // defined(__solaris__) || defined (__linux__)
8510 - * The following functions are for AIX.
8511 + * The following functions are common on Solaris and AIX.
8515 +#if defined(__solaris__) || defined(_AIX)
8518 * Helper function to get the 'psinfo_t' data from "/proc/%d/psinfo".
8519 @@ -661,8 +674,24 @@
8521 void unix_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
8524 + char exePath[PATH_MAX];
8525 char prargs[PRARGSZ + 1];
8526 jstring cmdexe = NULL;
8530 + * On Solaris, the full path to the executable command is the link in
8531 + * /proc/<pid>/paths/a.out. But it is only readable for processes we own.
8533 +#if defined(__solaris__)
8534 + snprintf(fn, sizeof fn, "/proc/%d/path/a.out", pid);
8535 + if ((ret = readlink(fn, exePath, PATH_MAX - 1)) > 0) {
8536 + // null terminate and create String to store for command
8537 + exePath[ret] = '\0';
8538 + CHECK_NULL(cmdexe = JNU_NewStringPlatform(env, exePath));
8543 * Now try to open /proc/%d/psinfo
8545 prargs[0] == '\0' ? NULL : prargs);
8548 -#endif // defined(_AIX)
8549 +#endif // defined(__solaris__) || defined(_AIX)
8550 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h
8551 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h 2024-12-29 15:19:42.800171161 +0100
8552 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h 2024-12-29 15:20:25.079311294 +0100
8554 * Declaration of ProcessHandleImpl functions common on all Unix platforms.
8555 * 'unix_' functions have a single implementation in ProcessHandleImpl_unix.c
8556 * 'os_' prefixed functions have different, os-specific implementations in the
8557 - * various ProcessHandleImpl_{linux,macosx,aix}.c files.
8558 + * various ProcessHandleImpl_{linux,macosx,solaris,aix}.c files.
8559 * See ProcessHandleImpl_unix.c for more details.
8562 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessImpl_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessImpl_md.c
8563 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/ProcessImpl_md.c 2024-12-29 15:19:42.801137282 +0100
8564 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/ProcessImpl_md.c 2024-12-29 15:20:25.079869534 +0100
8565 @@ -230,7 +230,14 @@
8569 - return ":/bin:/usr/bin";
8571 + /* These really are the Solaris defaults! */
8572 + return (geteuid() == 0 || getuid() == 0) ?
8573 + "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
8574 + "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:";
8576 + return ":/bin:/usr/bin"; /* glibc */
8584 /* vfork(2) is deprecated on Darwin */
8586 +#ifndef __solaris__
8588 vforkChild(ChildStuff *c) {
8589 volatile pid_t resultPid;
8591 startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
8593 /* vfork(2) is deprecated on Darwin*/
8595 + #ifndef __solaris__
8597 return vforkChild(c);
8599 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/TimeZone_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/TimeZone_md.c
8600 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/TimeZone_md.c 2024-12-29 15:19:42.797893702 +0100
8601 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/TimeZone_md.c 2024-12-29 15:20:25.080640575 +0100
8606 +#if defined(__solaris__)
8607 +#include <libscf.h>
8611 #include "jni_util.h"
8612 #include "TimeZone_md.h"
8613 #include "path_util.h"
8615 +#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
8616 #define fileopen fopen
8617 #define filegets fgets
8618 #define fileclose fclose
8621 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
8622 static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
8625 static const char popularZones[][4] = {"UTC", "GMT"};
8627 -#if defined(__linux__) || defined(MACOSX)
8628 +#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
8629 static char *isFileIdentical(char* buf, size_t size, char *pathname);
8632 @@ -168,6 +173,13 @@
8634 if ((strcmp(dp->d_name, "ROC") == 0)
8635 || (strcmp(dp->d_name, "posixrules") == 0)
8636 +#if defined(__solaris__)
8638 + * Skip the "src" and "tab" directories on Solaris.
8640 + || (strcmp(dp->d_name, "src") == 0)
8641 + || (strcmp(dp->d_name, "tab") == 0)
8643 || (strcmp(dp->d_name, "localtime") == 0)) {
8647 return possibleMatch;
8650 +#if defined(__linux__) || defined(MACOSX)
8653 * Performs Linux specific mapping and returns a zone ID
8654 * if found. Otherwise, NULL is returned.
8655 @@ -350,6 +364,183 @@
8659 +#elif defined(__solaris__)
8662 + * Performs Solaris dependent mapping. Returns a zone ID if
8663 + * found. Otherwise, NULL is returned. Solaris libc looks up
8664 + * "/etc/default/init" to get the default TZ value if TZ is not defined
8665 + * as an environment variable.
8668 +getPlatformTimeZoneID()
8674 + * Try the TZ entry in /etc/default/init.
8676 + if ((fp = fileopen(SYS_INIT_FILE, "r")) != NULL) {
8678 + char quote = '\0';
8680 + while (filegets(line, sizeof(line), fp) != NULL) {
8685 + /* quick check for comment lines */
8689 + if (strncmp(p, "TZ=", 3) == 0) {
8691 + while (*p == ' ' || *p == '\t') p++;
8693 + if (c == '"' || c == '\'') {
8699 + * PSARC/2001/383: quoted string support
8701 + for (s = p; (c = *s) != '\0' && c != '\n'; s++) {
8702 + /* No '\\' is supported here. */
8707 + if (c == ' ' && quote == '\0') {
8711 + if (quote != '\0') {
8712 + jio_fprintf(stderr, "ZoneInfo: unterminated time zone name in /etc/TIMEZONE\n");
8719 + (void) fileclose(fp);
8724 +#define TIMEZONE_FMRI "svc:/system/timezone:default"
8725 +#define TIMEZONE_PG "timezone"
8726 +#define LOCALTIME_PROP "localtime"
8729 +cleanupScf(scf_handle_t *h,
8730 + scf_snapshot_t *snap,
8731 + scf_instance_t *inst,
8732 + scf_propertygroup_t *pg,
8733 + scf_property_t *prop,
8736 + if (buf != NULL) {
8739 + if (snap != NULL) {
8740 + scf_snapshot_destroy(snap);
8742 + if (val != NULL) {
8743 + scf_value_destroy(val);
8745 + if (prop != NULL) {
8746 + scf_property_destroy(prop);
8749 + scf_pg_destroy(pg);
8751 + if (inst != NULL) {
8752 + scf_instance_destroy(inst);
8755 + scf_handle_destroy(h);
8760 + * Returns a zone ID of Solaris when the TZ value is "localtime".
8761 + * First, it tries scf. If scf fails, it looks for the same file as
8762 + * /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
8765 +getSolarisDefaultZoneID() {
8767 + struct stat64 statbuf;
8772 + /* scf specific variables */
8773 + scf_handle_t *h = NULL;
8774 + scf_snapshot_t *snap = NULL;
8775 + scf_instance_t *inst = NULL;
8776 + scf_propertygroup_t *pg = NULL;
8777 + scf_property_t *prop = NULL;
8778 + scf_value_t *val = NULL;
8780 + if ((h = scf_handle_create(SCF_VERSION)) != NULL
8781 + && scf_handle_bind(h) == 0
8782 + && (inst = scf_instance_create(h)) != NULL
8783 + && (snap = scf_snapshot_create(h)) != NULL
8784 + && (pg = scf_pg_create(h)) != NULL
8785 + && (prop = scf_property_create(h)) != NULL
8786 + && (val = scf_value_create(h)) != NULL
8787 + && scf_handle_decode_fmri(h, TIMEZONE_FMRI, NULL, NULL, inst,
8788 + NULL, NULL, SCF_DECODE_FMRI_REQUIRE_INSTANCE) == 0
8789 + && scf_instance_get_snapshot(inst, "running", snap) == 0
8790 + && scf_instance_get_pg_composed(inst, snap, TIMEZONE_PG, pg) == 0
8791 + && scf_pg_get_property(pg, LOCALTIME_PROP, prop) == 0
8792 + && scf_property_get_value(prop, val) == 0) {
8795 + /* Gets the length of the zone ID string */
8796 + len = scf_value_get_astring(val, NULL, 0);
8798 + tz = malloc(++len); /* +1 for a null byte */
8799 + if (tz != NULL && scf_value_get_astring(val, tz, len) != -1) {
8800 + cleanupScf(h, snap, inst, pg, prop, val, NULL);
8805 + cleanupScf(h, snap, inst, pg, prop, val, tz);
8807 + RESTARTABLE(stat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
8811 + size = (size_t) statbuf.st_size;
8812 + buf = malloc(size);
8813 + if (buf == NULL) {
8816 + RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
8818 + free((void *) buf);
8822 + RESTARTABLE(read(fd, buf, size), res);
8823 + if (res != (ssize_t) size) {
8825 + free((void *) buf);
8829 + tz = findZoneinfoFile(buf, size, ZONEINFO_DIR);
8830 + free((void *) buf);
8834 +#endif /* defined(__solaris__) */
8837 static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
8839 @@ -516,6 +707,15 @@
8840 free((void *) freetz);
8843 +#if defined(__solaris__)
8844 + /* Solaris might use localtime, so handle it here. */
8845 + if (strcmp(tz, "localtime") == 0) {
8846 + javatz = getSolarisDefaultZoneID();
8847 + if (freetz != NULL) {
8848 + free((void *) freetz);
8852 if (freetz == NULL) {
8853 /* strdup if we are still working on getenv result. */
8854 javatz = strdup(tz);
8855 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/UnixFileSystem_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libjava/UnixFileSystem_md.c
8856 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjava/UnixFileSystem_md.c 2024-12-29 15:19:42.800013063 +0100
8857 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjava/UnixFileSystem_md.c 2024-12-29 15:20:25.081032028 +0100
8860 #define statvfs statvfs64
8863 +#if defined(__solaris__) && !defined(NAME_MAX)
8864 + #define NAME_MAX MAXNAMLEN
8867 /* -- Field IDs -- */
8870 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjsig/jsig.c jdk24u-jdk-24-29/src/java.base/unix/native/libjsig/jsig.c
8871 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libjsig/jsig.c 2024-12-29 15:19:42.802260109 +0100
8872 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libjsig/jsig.c 2024-12-29 15:20:25.082548929 +0100
8878 +/* Our redeclarations of the system functions must not have a less
8879 + * restrictive linker scoping, so we have to declare them as JNIEXPORT
8880 + * before including signal.h */
8881 +#include "sys/signal.h"
8882 +JNIEXPORT void (*signal(int sig, void (*disp)(int)))(int);
8883 +JNIEXPORT void (*sigset(int sig, void (*disp)(int)))(int);
8884 +JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
8889 #include <pthread.h>
8892 #include <stdbool.h>
8895 +#define MAX_SIGNALS (SIGRTMAX+1)
8897 +/* On solaris, MAX_SIGNALS is a macro, not a constant, so we must allocate sact dynamically. */
8898 +static struct sigaction *sact = (struct sigaction *)NULL; /* saved signal handlers */
8900 #define MAX_SIGNALS NSIG
8902 static struct sigaction sact[MAX_SIGNALS]; /* saved signal handlers */
8905 static sigset_t jvmsigs; /* Signals used by jvm. */
8908 static bool jvm_signal_installed = false;
8911 +/* assume called within signal_lock */
8912 +static void allocate_sact() {
8914 + if (sact == NULL) {
8915 + sact = (struct sigaction *)malloc((MAX_SIGNALS) * (size_t)sizeof(struct sigaction));
8916 + if (sact == NULL) {
8917 + printf("%s\n", "libjsig.so unable to allocate memory");
8920 + memset(sact, 0, (MAX_SIGNALS) * (size_t)sizeof(struct sigaction));
8925 static void signal_lock() {
8926 pthread_mutex_lock(&mutex);
8927 /* When the jvm is installing its set of signal handlers, threads
8928 @@ -130,7 +161,18 @@
8929 sact[sig].sa_handler = disp;
8931 sact[sig].sa_mask = set;
8932 - sact[sig].sa_flags = 0;
8935 + sact[sig].sa_flags = SA_NODEFER;
8936 + if (sig != SIGILL && sig != SIGTRAP && sig != SIGPWR) {
8937 + sact[sig].sa_flags |= SA_RESETHAND;
8940 + sact[sig].sa_flags = 0;
8943 + sact[sig].sa_flags = 0;
8947 static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
8954 sigused = sigismember(&jvmsigs, sig);
8955 if (jvm_signal_installed && sigused) {
8956 @@ -150,6 +193,13 @@
8957 oldhandler = sact[sig].sa_handler;
8958 save_signal_handler(sig, disp, is_sigset);
8961 + if (is_sigset && sigblocked) {
8962 + /* We won't honor the SIG_HOLD request to change the signal mask */
8963 + oldhandler = SIG_HOLD;
8969 } else if (jvm_signal_installing) {
8975 sigused = sigismember(&jvmsigs, sig);
8976 if (jvm_signal_installed && sigused) {
8977 /* jvm has installed its signal handler for this signal. */
8981 JNIEXPORT struct sigaction *JVM_get_signal_action(int sig) {
8983 /* Does race condition make sense here? */
8984 if (sigismember(&jvmsigs, sig)) {
8986 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/Inet4AddressImpl.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/Inet4AddressImpl.c
8987 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/Inet4AddressImpl.c 2024-12-29 15:19:42.807755457 +0100
8988 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/Inet4AddressImpl.c 2024-12-29 15:20:25.082989651 +0100
8990 if (gethostname(hostname, sizeof(hostname)) != 0) {
8991 strcpy(hostname, "localhost");
8993 +#if defined(__solaris__)
8994 + // try to resolve hostname via nameservice
8995 + // if it is known but getnameinfo fails, hostname will still be the
8996 + // value from gethostname
8997 + struct addrinfo hints, *res;
8999 // make sure string is null-terminated
9000 hostname[NI_MAXHOST] = '\0';
9001 + memset(&hints, 0, sizeof(hints));
9002 + hints.ai_flags = AI_CANONNAME;
9003 + hints.ai_family = AF_INET;
9005 + if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
9006 + getnameinfo(res->ai_addr, res->ai_addrlen, hostname, sizeof(hostname),
9007 + NULL, 0, NI_NAMEREQD);
9008 + freeaddrinfo(res);
9011 + // make sure string is null-terminated
9012 + hostname[NI_MAXHOST] = '\0';
9015 return (*env)->NewStringUTF(env, hostname);
9017 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/Inet6AddressImpl.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/Inet6AddressImpl.c
9018 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/Inet6AddressImpl.c 2024-12-29 15:19:42.807567093 +0100
9019 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/Inet6AddressImpl.c 2024-12-29 15:20:25.083450543 +0100
9021 if (gethostname(hostname, sizeof(hostname)) != 0) {
9022 strcpy(hostname, "localhost");
9024 +#if defined(__solaris__)
9025 + // try to resolve hostname via nameservice
9026 + // if it is known but getnameinfo fails, hostname will still be the
9027 + // value from gethostname
9028 + struct addrinfo hints, *res;
9030 // make sure string is null-terminated
9031 hostname[NI_MAXHOST] = '\0';
9032 + memset(&hints, 0, sizeof(hints));
9033 + hints.ai_flags = AI_CANONNAME;
9034 + hints.ai_family = AF_UNSPEC;
9036 + if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
9037 + getnameinfo(res->ai_addr, res->ai_addrlen, hostname, sizeof(hostname),
9038 + NULL, 0, NI_NAMEREQD);
9039 + freeaddrinfo(res);
9042 + // make sure string is null-terminated
9043 + hostname[NI_MAXHOST] = '\0';
9046 return (*env)->NewStringUTF(env, hostname);
9048 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/net_util_md.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/net_util_md.c
9049 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/net_util_md.c 2024-12-29 15:19:42.807165082 +0100
9050 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/net_util_md.c 2024-12-29 15:20:25.085524331 +0100
9052 #include <sys/utsname.h>
9055 +#if defined(__solaris__)
9056 +#include <inet/nd.h>
9057 +#include <limits.h>
9058 +#include <stropts.h>
9059 +#include <sys/filio.h>
9060 +#include <sys/sockio.h>
9064 #include <sys/sysctl.h>
9066 @@ -50,12 +58,114 @@
9067 #define IPV6_FLOWINFO_SEND 33
9070 +#if defined(__solaris__) && !defined(MAXINT)
9071 +#define MAXINT INT_MAX
9075 + * EXCLBIND socket options only on Solaris
9077 +#if defined(__solaris__) && !defined(TCP_EXCLBIND)
9078 +#define TCP_EXCLBIND 0x21
9080 +#if defined(__solaris__) && !defined(UDP_EXCLBIND)
9081 +#define UDP_EXCLBIND 0x0101
9085 NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
9086 const char *defaultDetail) {
9087 JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail);
9091 +static int init_tcp_max_buf, init_udp_max_buf;
9092 +static int tcp_max_buf;
9093 +static int udp_max_buf;
9094 +static int useExclBind = 0;
9097 + * Get the specified parameter from the specified driver. The value
9098 + * of the parameter is assumed to be an 'int'. If the parameter
9099 + * cannot be obtained return -1
9101 +int net_getParam(char *driver, char *param)
9103 + struct strioctl stri;
9108 + s = open (driver, O_RDWR);
9112 + strncpy (buf, param, sizeof(buf));
9113 + stri.ic_cmd = ND_GET;
9114 + stri.ic_timout = 0;
9116 + stri.ic_len = sizeof(buf);
9117 + if (ioctl (s, I_STR, &stri) < 0) {
9120 + value = atoi(buf);
9127 + * Iterative way to find the max value that SO_SNDBUF or SO_RCVBUF
9128 + * for Solaris versions that do not support the ioctl() in net_getParam().
9129 + * Ugly, but only called once (for each sotype).
9131 + * As an optimization, we make a guess using the default values for Solaris
9132 + * assuming they haven't been modified with ndd.
9135 +#define MAX_TCP_GUESS 1024 * 1024
9136 +#define MAX_UDP_GUESS 2 * 1024 * 1024
9138 +#define FAIL_IF_NOT_ENOBUFS if (errno != ENOBUFS) return -1
9140 +static int findMaxBuf(int fd, int opt, int sotype) {
9143 + int initial_guess;
9146 + if (sotype == SOCK_DGRAM) {
9147 + initial_guess = MAX_UDP_GUESS;
9149 + initial_guess = MAX_TCP_GUESS;
9152 + if (setsockopt(fd, SOL_SOCKET, opt, &initial_guess, sizeof(int)) == 0) {
9154 + if (setsockopt(fd, SOL_SOCKET, opt, &initial_guess,sizeof(int)) < 0) {
9155 + FAIL_IF_NOT_ENOBUFS;
9156 + return initial_guess - 1;
9158 + a = initial_guess;
9160 + FAIL_IF_NOT_ENOBUFS;
9161 + b = initial_guess - 1;
9164 + int mid = a + (b-a)/2;
9165 + if (setsockopt(fd, SOL_SOCKET, opt, &mid, sizeof(int)) == 0) {
9169 + FAIL_IF_NOT_ENOBUFS;
9179 NET_ThrowNew(JNIEnv *env, int errorNumber, char *msg) {
9181 @@ -133,6 +243,50 @@
9186 + * On Solaris 8 it's possible to create INET6 sockets even
9187 + * though IPv6 is not enabled on all interfaces. Thus we
9188 + * query the number of IPv6 addresses to verify that IPv6
9189 + * has been configured on at least one interface.
9191 + * On Linux it doesn't matter - if IPv6 is built-in the
9192 + * kernel then IPv6 addresses will be bound automatically
9193 + * to all interfaces.
9199 + struct lifnum numifs;
9201 + numifs.lifn_family = AF_INET6;
9202 + numifs.lifn_flags = 0;
9203 + if (ioctl(fd, SIOCGLIFNUM, (char *)&numifs) < 0) {
9205 + * SIOCGLIFNUM failed - assume IPv6 not configured
9211 + * If no IPv6 addresses then return false. If count > 0
9212 + * it's possible that all IPv6 addresses are "down" but
9213 + * that's okay as they may be brought "up" while the
9216 + if (numifs.lifn_count == 0) {
9222 + /* SIOCGLIFNUM not defined in build environment ??? */
9227 +#endif /* __solaris */
9230 * OK we may have the stack available in the kernel,
9231 * we should also check if the APIs are available.
9232 @@ -197,6 +351,26 @@
9236 +void parseExclusiveBindProperty(JNIEnv *env) {
9238 + jstring s, flagSet;
9242 + s = (*env)->NewStringUTF(env, "sun.net.useExclusiveBind");
9244 + iCls = (*env)->FindClass(env, "java/lang/System");
9246 + mid = (*env)->GetStaticMethodID(env, iCls, "getProperty",
9247 + "(Ljava/lang/String;)Ljava/lang/String;");
9249 + flagSet = (*env)->CallStaticObjectMethod(env, iCls, mid, s);
9250 + if (flagSet != NULL) {
9256 JNIEXPORT jint JNICALL
9257 NET_EnableFastTcpLoopback(int fd) {
9259 @@ -438,6 +612,65 @@
9260 *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK);
9264 + * SOL_SOCKET/{SO_SNDBUF,SO_RCVBUF} - On Solaris we may need to clamp
9265 + * the value when it exceeds the system limit.
9268 + if (level == SOL_SOCKET) {
9269 + if (opt == SO_SNDBUF || opt == SO_RCVBUF) {
9272 + int *bufsize, maxbuf;
9275 + /* Attempt with the original size */
9276 + ret = setsockopt(fd, level, opt, arg, len);
9277 + if ((ret == 0) || (ret == -1 && errno != ENOBUFS))
9280 + /* Exceeded system limit so clamp and retry */
9282 + arglen = sizeof(sotype);
9283 + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype,
9289 + * We try to get tcp_maxbuf (and udp_max_buf) using
9290 + * an ioctl() that isn't available on all versions of Solaris.
9291 + * If that fails, we use the search algorithm in findMaxBuf()
9293 + if (!init_tcp_max_buf && sotype == SOCK_STREAM) {
9294 + tcp_max_buf = net_getParam("/dev/tcp", "tcp_max_buf");
9295 + if (tcp_max_buf == -1) {
9296 + tcp_max_buf = findMaxBuf(fd, opt, SOCK_STREAM);
9297 + if (tcp_max_buf == -1) {
9301 + init_tcp_max_buf = 1;
9302 + } else if (!init_udp_max_buf && sotype == SOCK_DGRAM) {
9303 + udp_max_buf = net_getParam("/dev/udp", "udp_max_buf");
9304 + if (udp_max_buf == -1) {
9305 + udp_max_buf = findMaxBuf(fd, opt, SOCK_DGRAM);
9306 + if (udp_max_buf == -1) {
9310 + init_udp_max_buf = 1;
9313 + maxbuf = (sotype == SOCK_STREAM) ? tcp_max_buf : udp_max_buf;
9314 + bufsize = (int *)arg;
9315 + if (*bufsize > maxbuf) {
9316 + *bufsize = maxbuf;
9323 if (level == SOL_SOCKET) {
9324 if (opt == SO_SNDBUF || opt == SO_RCVBUF) {
9325 @@ -552,10 +785,20 @@
9327 * Linux allows a socket to bind to 127.0.0.255 which must be
9330 + * On Solaris with IPv6 enabled we must use an exclusive
9331 + * bind to guarantee a unique port number across the IPv4 and
9332 + * IPv6 port spaces.
9336 NET_Bind(int fd, SOCKETADDRESS *sa, int len)
9338 +#if defined(__solaris__)
9340 + int exclbind = -1;
9346 @@ -572,8 +815,61 @@
9350 +#if defined(__solaris__)
9352 + * Solaris has separate IPv4 and IPv6 port spaces so we
9353 + * use an exclusive bind when SO_REUSEADDR is not used to
9354 + * give the illusion of a unified port space.
9355 + * This also avoids problems with IPv6 sockets connecting
9356 + * to IPv4 mapped addresses whereby the socket conversion
9357 + * results in a late bind that fails because the
9358 + * corresponding IPv4 port is in use.
9360 + alen = sizeof(arg);
9362 + if (useExclBind ||
9363 + getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&arg, &alen) == 0)
9365 + if (useExclBind || arg == 0) {
9367 + * SO_REUSEADDR is disabled or sun.net.useExclusiveBind
9368 + * property is true so enable TCP_EXCLBIND or
9371 + alen = sizeof(arg);
9372 + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg, &alen) == 0)
9374 + if (arg == SOCK_STREAM) {
9375 + level = IPPROTO_TCP;
9376 + exclbind = TCP_EXCLBIND;
9378 + level = IPPROTO_UDP;
9379 + exclbind = UDP_EXCLBIND;
9384 + setsockopt(fd, level, exclbind, (char *)&arg, sizeof(arg));
9390 rv = bind(fd, &sa->sa, len);
9392 +#if defined(__solaris__)
9395 + /* Restore *_EXCLBIND if the bind fails */
9396 + if (exclbind != -1) {
9398 + setsockopt(fd, level, exclbind, (char *)&arg,
9408 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/net_util_md.h jdk24u-jdk-24-29/src/java.base/unix/native/libnet/net_util_md.h
9409 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/net_util_md.h 2024-12-29 15:19:42.806649976 +0100
9410 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/net_util_md.h 2024-12-29 15:20:25.085892248 +0100
9412 #ifndef SO_REUSEPORT
9414 #define SO_REUSEPORT 15
9415 +#elif defined(__solaris__)
9416 +#define SO_REUSEPORT 0x100e
9417 #elif defined(AIX) || defined(MACOSX)
9418 #define SO_REUSEPORT 0x0200
9421 void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
9422 const char *defaultDetail);
9425 +int net_getParam(char *driver, char *param);
9428 #endif /* NET_UTILS_MD_H */
9429 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/NetworkInterface.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/NetworkInterface.c
9430 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/NetworkInterface.c 2024-12-29 15:19:42.806960856 +0100
9431 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/NetworkInterface.c 2024-12-29 15:20:25.084326876 +0100
9433 #include <strings.h>
9436 +#if defined(__solaris__)
9437 +#include <stropts.h>
9438 +#include <sys/dlpi.h>
9439 +#include <sys/sockio.h>
9442 #if defined(_ALLBSD_SOURCE)
9443 #include <net/ethernet.h>
9444 #include <net/if_dl.h>
9447 #if defined(__linux__)
9448 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
9449 +#elif defined(__solaris__)
9450 + #ifndef SIOCGLIFHWADDR
9451 + #define SIOCGLIFHWADDR _IOWR('i', 192, struct lifreq)
9453 + #define DEV_PREFIX "/dev/"
9457 @@ -135,6 +146,11 @@
9458 const struct in_addr *addr, unsigned char *buf);
9459 static int getMTU(JNIEnv *env, int sock, const char *ifname);
9461 +#if defined(__solaris__)
9462 +static int getMacFromDevice(JNIEnv *env, const char *ifname,
9463 + unsigned char *retbuf);
9466 /******************* Java entry points *****************************/
9469 @@ -1658,6 +1674,372 @@
9474 +#if defined(__solaris__)
9477 + * Opens a socket for further ioctl calls. Tries AF_INET socket first and
9478 + * if it fails return AF_INET6 socket.
9480 +static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
9481 + int sock, alreadyV6 = 0;
9482 + struct lifreq if2;
9484 + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
9485 + if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT) {
9486 + if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
9487 + JNU_ThrowByNameWithMessageAndLastError
9488 + (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
9492 + } else { // errno is not NOSUPPORT
9493 + JNU_ThrowByNameWithMessageAndLastError
9494 + (env, JNU_JAVANETPKG "SocketException", "IPV4 Socket creation failed");
9499 + // Solaris requires that we have an IPv6 socket to query an interface
9500 + // without an IPv4 address - check it here. POSIX 1 require the kernel to
9501 + // return ENOTTY if the call is inappropriate for a device e.g. the NETMASK
9502 + // for a device having IPv6 only address but not all devices follow the
9503 + // standard so fall back on any error. It's not an ecologically friendly
9504 + // gesture but more reliable.
9506 + memset((char *)&if2, 0, sizeof(if2));
9507 + strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
9508 + if (ioctl(sock, SIOCGLIFNETMASK, (char *)&if2) < 0) {
9510 + if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
9511 + JNU_ThrowByNameWithMessageAndLastError
9512 + (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
9522 + * Enumerates and returns all IPv4 interfaces on Solaris.
9524 +static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
9525 + struct lifconf ifc;
9526 + struct lifreq *ifreqP;
9527 + struct lifnum numifs;
9531 + // call SIOCGLIFNUM to get the interface count
9532 + numifs.lifn_family = AF_INET;
9533 + numifs.lifn_flags = 0;
9534 + if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) {
9535 + JNU_ThrowByNameWithMessageAndLastError
9536 + (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNUM) failed");
9540 + // call SIOCGLIFCONF to enumerate the interfaces
9541 + ifc.lifc_len = numifs.lifn_count * sizeof(struct lifreq);
9542 + CHECKED_MALLOC3(buf, char *, ifc.lifc_len);
9543 + ifc.lifc_buf = buf;
9544 + ifc.lifc_family = AF_INET;
9545 + ifc.lifc_flags = 0;
9546 + if (ioctl(sock, SIOCGLIFCONF, (char *)&ifc) < 0) {
9547 + JNU_ThrowByNameWithMessageAndLastError
9548 + (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFCONF) failed");
9553 + // iterate through each interface
9554 + ifreqP = ifc.lifc_req;
9555 + for (i = 0; i < numifs.lifn_count; i++, ifreqP++) {
9556 + struct sockaddr addr, *broadaddrP = NULL;
9558 + // ignore non IPv4 addresses
9559 + if (ifreqP->lifr_addr.ss_family != AF_INET) {
9563 + // save socket address
9564 + memcpy(&addr, &(ifreqP->lifr_addr), sizeof(struct sockaddr));
9566 + // determine broadcast address, if applicable
9567 + if ((ioctl(sock, SIOCGLIFFLAGS, ifreqP) == 0) &&
9568 + ifreqP->lifr_flags & IFF_BROADCAST) {
9570 + // restore socket address to ifreqP
9571 + memcpy(&(ifreqP->lifr_addr), &addr, sizeof(struct sockaddr));
9573 + // query broadcast address and set pointer to it
9574 + if (ioctl(sock, SIOCGLIFBRDADDR, ifreqP) == 0) {
9575 + broadaddrP = (struct sockaddr *)&(ifreqP->lifr_broadaddr);
9579 + // add to the list
9580 + ifs = addif(env, sock, ifreqP->lifr_name, ifs,
9581 + &addr, broadaddrP, AF_INET, (short)ifreqP->lifr_addrlen);
9583 + // if an exception occurred we return immediately
9584 + if ((*env)->ExceptionOccurred(env)) {
9596 + * Enumerates and returns all IPv6 interfaces on Solaris.
9598 +static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
9599 + struct lifconf ifc;
9600 + struct lifreq *ifreqP;
9601 + struct lifnum numifs;
9605 + // call SIOCGLIFNUM to get the interface count
9606 + numifs.lifn_family = AF_INET6;
9607 + numifs.lifn_flags = 0;
9608 + if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) {
9609 + JNU_ThrowByNameWithMessageAndLastError
9610 + (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNUM) failed");
9614 + // call SIOCGLIFCONF to enumerate the interfaces
9615 + ifc.lifc_len = numifs.lifn_count * sizeof(struct lifreq);
9616 + CHECKED_MALLOC3(buf, char *, ifc.lifc_len);
9617 + ifc.lifc_buf = buf;
9618 + ifc.lifc_family = AF_INET6;
9619 + ifc.lifc_flags = 0;
9620 + if (ioctl(sock, SIOCGLIFCONF, (char *)&ifc) < 0) {
9621 + JNU_ThrowByNameWithMessageAndLastError
9622 + (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFCONF) failed");
9627 + // iterate through each interface
9628 + ifreqP = ifc.lifc_req;
9629 + for (i = 0; i < numifs.lifn_count; i++, ifreqP++) {
9631 + // ignore non IPv6 addresses
9632 + if (ifreqP->lifr_addr.ss_family != AF_INET6) {
9636 + // set scope ID to interface index
9637 + ((struct sockaddr_in6 *)&(ifreqP->lifr_addr))->sin6_scope_id =
9638 + getIndex(sock, ifreqP->lifr_name);
9640 + // add to the list
9641 + ifs = addif(env, sock, ifreqP->lifr_name, ifs,
9642 + (struct sockaddr *)&(ifreqP->lifr_addr),
9643 + NULL, AF_INET6, (short)ifreqP->lifr_addrlen);
9645 + // if an exception occurred we return immediately
9646 + if ((*env)->ExceptionOccurred(env)) {
9658 + * Try to get the interface index.
9659 + * (Not supported on Solaris 2.6 or 7)
9661 +static int getIndex(int sock, const char *name) {
9662 + struct lifreq if2;
9663 + memset((char *)&if2, 0, sizeof(if2));
9664 + strncpy(if2.lifr_name, name, sizeof(if2.lifr_name) - 1);
9666 + if (ioctl(sock, SIOCGLIFINDEX, (char *)&if2) < 0) {
9670 + return if2.lifr_index;
9674 + * Solaris specific DLPI code to get hardware address from a device.
9675 + * Unfortunately, at least up to Solaris X, you have to have special
9676 + * privileges (i.e. be root).
9678 +static int getMacFromDevice
9679 + (JNIEnv *env, const char *ifname, unsigned char *retbuf)
9681 + char style1dev[MAXPATHLEN];
9683 + dl_phys_addr_req_t dlpareq;
9684 + dl_phys_addr_ack_t *dlpaack;
9685 + dl_error_ack_t *dlerack;
9686 + struct strbuf msg;
9690 + // Device is in /dev. e.g.: /dev/bge0
9691 + strcpy(style1dev, DEV_PREFIX);
9692 + strcat(style1dev, ifname);
9693 + if ((fd = open(style1dev, O_RDWR)) < 0) {
9694 + // Can't open it. We probably are missing the privilege.
9695 + // We'll have to try something else
9699 + dlpareq.dl_primitive = DL_PHYS_ADDR_REQ;
9700 + dlpareq.dl_addr_type = DL_CURR_PHYS_ADDR;
9702 + msg.buf = (char *)&dlpareq;
9703 + msg.len = DL_PHYS_ADDR_REQ_SIZE;
9705 + if (putmsg(fd, &msg, NULL, 0) < 0) {
9706 + JNU_ThrowByNameWithMessageAndLastError
9707 + (env, JNU_JAVANETPKG "SocketException", "putmsg() failed");
9711 + dlpaack = (dl_phys_addr_ack_t *)buf;
9713 + msg.buf = (char *)buf;
9715 + msg.maxlen = sizeof (buf);
9716 + if (getmsg(fd, &msg, NULL, &flags) < 0) {
9717 + JNU_ThrowByNameWithMessageAndLastError
9718 + (env, JNU_JAVANETPKG "SocketException", "getmsg() failed");
9722 + if (dlpaack->dl_primitive == DL_ERROR_ACK) {
9723 + dlerack = (dl_error_ack_t *)buf;
9724 + if (dlerack->dl_error_primitive != DL_PHYS_ADDR_REQ) {
9725 + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
9726 + "Couldn't obtain physical address\n");
9729 + if (dlerack->dl_errno == DL_UNSUPPORTED) {
9730 + // fallback to lookup in the ARP table
9735 + if (msg.len < DL_PHYS_ADDR_ACK_SIZE || dlpaack->dl_primitive != DL_PHYS_ADDR_ACK) {
9736 + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
9737 + "Couldn't obtain phys addr\n");
9741 + memcpy(retbuf, &buf[dlpaack->dl_addr_offset], dlpaack->dl_addr_length);
9742 + return dlpaack->dl_addr_length;
9746 + * Gets the Hardware address (usually MAC address) for the named interface.
9747 + * On return puts the data in buf, and returns the length, in byte, of the
9748 + * MAC address. Returns -1 if there is no hardware address on that interface.
9750 +static int getMacAddress
9751 + (JNIEnv *env, const char *ifname, const struct in_addr *addr,
9752 + unsigned char *buf)
9754 + struct lifreq if2;
9757 + if ((sock = openSocketWithFallback(env, ifname)) < 0) {
9761 + // First, try the new (S11) SIOCGLIFHWADDR ioctl(). If that fails
9762 + // try the old way.
9763 + memset((char *)&if2, 0, sizeof(if2));
9764 + strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
9766 + if (ioctl(sock, SIOCGLIFHWADDR, &if2) != -1) {
9767 + struct sockaddr_dl *sp;
9768 + sp = (struct sockaddr_dl *)&if2.lifr_addr;
9769 + memcpy(buf, &sp->sdl_data[0], sp->sdl_alen);
9771 + return sp->sdl_alen;
9774 + // On Solaris we have to use DLPI, but it will only work if we have
9775 + // privileged access (i.e. root). If that fails, we try a lookup
9776 + // in the ARP table, which requires an IPv4 address.
9777 + if (((len = getMacFromDevice(env, ifname, buf)) == 0) && (addr != NULL)) {
9778 + struct arpreq arpreq;
9779 + struct sockaddr_in *sin;
9780 + struct sockaddr_in ipAddr;
9784 + sin = (struct sockaddr_in *)&arpreq.arp_pa;
9785 + memset((char *)&arpreq, 0, sizeof(struct arpreq));
9786 + ipAddr.sin_port = 0;
9787 + ipAddr.sin_family = AF_INET;
9788 + memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr));
9789 + memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in));
9790 + arpreq.arp_flags= ATF_PUBL;
9792 + if (ioctl(sock, SIOCGARP, &arpreq) < 0) {
9797 + memcpy(buf, &arpreq.arp_ha.sa_data[0], len);
9801 + // all bytes to 0 means no hardware address
9802 + for (i = 0; i < len; i++) {
9810 +static int getMTU(JNIEnv *env, int sock, const char *ifname) {
9811 + struct lifreq if2;
9812 + memset((char *)&if2, 0, sizeof(if2));
9813 + strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
9815 + if (ioctl(sock, SIOCGLIFMTU, (char *)&if2) < 0) {
9816 + JNU_ThrowByNameWithMessageAndLastError
9817 + (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFMTU) failed");
9821 + return if2.lifr_mtu;
9824 +static int getFlags(int sock, const char *ifname, int *flags) {
9825 + struct lifreq if2;
9826 + memset((char *)&if2, 0, sizeof(if2));
9827 + strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
9829 + if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) {
9833 + *flags = if2.lifr_flags;
9837 +#endif /* __solaris__ */
9840 #if defined(_ALLBSD_SOURCE)
9842 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/portconfig.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/portconfig.c
9843 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/portconfig.c 2024-12-29 15:19:42.806342822 +0100
9844 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/portconfig.c 2024-12-29 15:20:25.086236752 +0100
9850 +#elif defined(__solaris__)
9852 + range->higher = net_getParam("/dev/tcp", "tcp_largest_anon_port");
9853 + range->lower = net_getParam("/dev/tcp", "tcp_smallest_anon_port");
9856 #elif defined(_ALLBSD_SOURCE)
9859 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/SdpSupport.c jdk24u-jdk-24-29/src/java.base/unix/native/libnet/SdpSupport.c
9860 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnet/SdpSupport.c 2024-12-29 15:19:42.806496029 +0100
9861 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnet/SdpSupport.c 2024-12-29 15:20:25.084699140 +0100
9863 #include <sys/socket.h>
9866 -#if defined(__linux__)
9867 +#if defined(__solaris__)
9868 + #if !defined(PROTO_SDP)
9869 + #define PROTO_SDP 257
9871 +#elif defined(__linux__)
9872 #if !defined(AF_INET_SDP)
9873 #define AF_INET_SDP 27
9879 -#if defined(__linux__)
9880 +#if defined(__solaris__)
9881 + int domain = ipv6_available() ? AF_INET6 : AF_INET;
9882 + s = socket(domain, SOCK_STREAM, PROTO_SDP);
9883 +#elif defined(__linux__)
9885 * IPv6 not supported by SDP on Linux
9887 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
9888 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c 2024-12-29 15:19:42.804792171 +0100
9889 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c 2024-12-29 15:20:25.086663187 +0100
9891 jint fd = fdval(env, fdo);
9894 +#if defined(__solaris__)
9895 + rv = connect(fd, 0, 0);
9897 #if defined(__APPLE__)
9898 // On macOS systems we use disconnectx
9899 rv = disconnectx(fd, SAE_ASSOCID_ANY, SAE_CONNID_ANY);
9902 #endif // defined(_ALLBSD_SOURCE) || defined(_AIX)
9904 +#endif // defined(__solaris__)
9907 handleSocketError(env, errno);
9909 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/NativeThread.c jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/NativeThread.c
9910 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/NativeThread.c 2024-12-29 15:19:42.803462858 +0100
9911 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/NativeThread.c 2024-12-29 15:20:25.087041088 +0100
9914 /* Also defined in net/aix_close.c */
9915 #define INTERRUPT_SIGNAL (SIGRTMAX - 1)
9916 +#elif defined(__solaris__)
9917 + #include <thread.h>
9918 + #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
9919 #elif defined(_ALLBSD_SOURCE)
9920 /* Also defined in net/bsd_close.c */
9921 #define INTERRUPT_SIGNAL SIGIO
9923 JNIEXPORT jlong JNICALL
9924 Java_sun_nio_ch_NativeThread_current0(JNIEnv *env, jclass cl)
9927 + return (jlong)thr_self();
9929 return (jlong)pthread_self();
9933 JNIEXPORT void JNICALL
9934 Java_sun_nio_ch_NativeThread_signal0(JNIEnv *env, jclass cl, jlong thread)
9938 + ret = thr_kill((thread_t)thread, INTERRUPT_SIGNAL);
9940 ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
9943 if (ret != 0 && ret != ESRCH)
9945 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/Net.c jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/Net.c
9946 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/Net.c 2024-12-29 15:19:42.803820428 +0100
9947 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/Net.c 2024-12-29 15:20:25.087600281 +0100
9951 #include <sys/ioctl.h>
9952 +#include <sys/filio.h>
9953 #include <sys/types.h>
9954 #include <sys/socket.h>
9957 JNIEXPORT jboolean JNICALL
9958 Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
9960 -#if defined(__linux__) || defined(__APPLE__)
9961 +#if defined(__linux__) || defined(__APPLE__) || defined(__solaris__)
9962 /* IPv6 sockets can join IPv4 multicast groups */
9966 JNIEXPORT jboolean JNICALL
9967 Java_sun_nio_ch_Net_canJoin6WithIPv4Group0(JNIEnv* env, jclass cl)
9969 -#if defined(__APPLE__)
9970 +#if defined(__APPLE__) || defined(__solaris__)
9971 /* IPV6_ADD_MEMBERSHIP can be used to join IPv4 multicast groups */
9974 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/nio_util.h jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/nio_util.h
9975 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/ch/nio_util.h 2024-12-29 15:19:42.803622089 +0100
9976 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnio/ch/nio_util.h 2024-12-29 15:20:25.087923220 +0100
9978 #ifndef SO_REUSEPORT
9980 #define SO_REUSEPORT 15
9981 +#elif defined(__solaris__)
9982 +#define SO_REUSEPORT 0x100e
9983 #elif defined(AIX) || defined(MACOSX)
9984 #define SO_REUSEPORT 0x0200
9986 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c jdk24u-jdk-24-29/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
9987 --- jdk24u-jdk-24-29.orig/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c 2024-12-29 15:19:42.805599838 +0100
9988 +++ jdk24u-jdk-24-29/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c 2024-12-29 15:20:25.088482155 +0100
9990 #include <sys/xattr.h>
9993 -/* For POSIX-compliant getpwuid_r */
9994 +/* For POSIX-compliant getpwuid_r, getgrgid_r on Solaris */
9995 +#if defined(__solaris__)
9996 +#define _POSIX_PTHREAD_SEMANTICS
10001 +#ifdef __solaris__
10002 +#include <strings.h>
10006 #include <sys/syscall.h>
10007 #include <sys/sysmacros.h> // makedev macros
10008 @@ -339,7 +346,8 @@
10010 /* system calls that might not be available at run time */
10012 -#if defined(_ALLBSD_SOURCE)
10013 +#if defined(__solaris__) || defined(_ALLBSD_SOURCE)
10014 + /* Solaris 64-bit does not have openat64/fstatat64 */
10015 my_openat_func = (openat_func*) openat;
10016 my_fstatat_func = (fstatat_func*) fstatat;
10018 diff -Nru jdk24u-jdk-24-29.orig/src/java.base/windows/native/libnet/net_util_md.c jdk24u-jdk-24-29/src/java.base/windows/native/libnet/net_util_md.c
10019 --- jdk24u-jdk-24-29.orig/src/java.base/windows/native/libnet/net_util_md.c 2024-12-29 15:19:42.725450635 +0100
10020 +++ jdk24u-jdk-24-29/src/java.base/windows/native/libnet/net_util_md.c 2024-12-29 15:20:25.088970363 +0100
10021 @@ -125,6 +125,8 @@
10026 +void parseExclusiveBindProperty(JNIEnv *env) {}
10029 * Since winsock doesn't have the equivalent of strerror(errno)
10030 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/awt/FontConfiguration.java jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/awt/FontConfiguration.java
10031 --- jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/awt/FontConfiguration.java 2024-12-29 15:19:42.498908998 +0100
10032 +++ jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/awt/FontConfiguration.java 2024-12-29 15:20:25.089738571 +0100
10033 @@ -1401,6 +1401,22 @@
10037 + if (OSInfo.getOSType() == OSInfo.OSType.SOLARIS) {
10038 + for (int ii = 0; ii < table_awtfontpaths.length; ii++) {
10039 + if (table_awtfontpaths[ii] == 0) {
10040 + String script = getString(table_scriptIDs[ii]);
10041 + if (script.contains("dingbats") ||
10042 + script.contains("symbol")) {
10045 + System.err.println("\nError: "
10046 + + "<awtfontpath."
10048 + + "> entry is missing!!!");
10054 System.err.println("!!THERE ARE " + errors + " ERROR(S) IN "
10055 + "THE FONTCONFIG FILE, PLEASE CHECK ITS CONTENT!!\n");
10056 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/awt/OSInfo.java jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/awt/OSInfo.java
10057 --- jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/awt/OSInfo.java 2024-12-29 15:19:42.497824796 +0100
10058 +++ jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/awt/OSInfo.java 2024-12-29 15:20:25.090179979 +0100
10060 public static enum OSType {
10068 // Map OperatingSystem enum values to OSType enum values.
10069 case WINDOWS -> WINDOWS;
10070 case LINUX -> LINUX;
10071 + case SOLARIS -> SOLARIS;
10072 case MACOS -> MACOSX;
10074 default -> UNKNOWN;
10075 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/font/FontUtilities.java jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/font/FontUtilities.java
10076 --- jdk24u-jdk-24-29.orig/src/java.desktop/share/classes/sun/font/FontUtilities.java 2024-12-29 15:19:42.571921436 +0100
10077 +++ jdk24u-jdk-24-29/src/java.desktop/share/classes/sun/font/FontUtilities.java 2024-12-29 15:20:25.090698071 +0100
10080 public final class FontUtilities {
10082 + public static boolean isSolaris;
10084 public static boolean isLinux;
10086 public static boolean isMacOSX;
10088 @SuppressWarnings("deprecation") // PlatformLogger.setLevel is deprecated.
10089 private static void initStatic() {
10091 + isSolaris = OSInfo.getOSType() == OSInfo.OSType.SOLARIS;
10093 isLinux = OSInfo.getOSType() == OSInfo.OSType.LINUX;
10095 isMacOSX = OSInfo.getOSType() == OSInfo.OSType.MACOSX;
10096 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/share/native/libjsound/SoundDefs.h jdk24u-jdk-24-29/src/java.desktop/share/native/libjsound/SoundDefs.h
10097 --- jdk24u-jdk-24-29.orig/src/java.desktop/share/native/libjsound/SoundDefs.h 2024-12-29 15:19:41.638215839 +0100
10098 +++ jdk24u-jdk-24-29/src/java.desktop/share/native/libjsound/SoundDefs.h 2024-12-29 15:20:25.091180642 +0100
10101 // types for X_PLATFORM
10102 #define X_WINDOWS 1
10105 -#define X_MACOSX 4
10106 +#define X_SOLARIS 2
10109 +#define X_MACOSX 5
10111 // **********************************
10112 // Make sure you set X_PLATFORM defines correctly.
10116 // following is needed for _LP64
10117 -#if ((X_PLATFORM == X_LINUX) || (X_PLATFORM == X_MACOSX))
10118 +#if ((X_PLATFORM == X_SOLARIS) || (X_PLATFORM == X_LINUX) || (X_PLATFORM == X_MACOSX))
10119 #include <sys/types.h>
10122 @@ -114,6 +115,11 @@
10126 +#if X_PLATFORM == X_SOLARIS
10131 #if X_PLATFORM == X_LINUX
10132 #define INLINE inline
10134 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643.java jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643.java
10135 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643.java 1970-01-01 01:00:00.000000000 +0100
10136 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643.java 2024-12-29 15:20:25.119440146 +0100
10139 + * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
10140 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10142 + * This code is free software; you can redistribute it and/or modify it
10143 + * under the terms of the GNU General Public License version 2 only, as
10144 + * published by the Free Software Foundation. Oracle designates this
10145 + * particular file as subject to the "Classpath" exception as provided
10146 + * by Oracle in the LICENSE file that accompanied this code.
10148 + * This code is distributed in the hope that it will be useful, but WITHOUT
10149 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10150 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10151 + * version 2 for more details (a copy is included in the LICENSE file that
10152 + * accompanied this code).
10154 + * You should have received a copy of the GNU General Public License version
10155 + * 2 along with this work; if not, write to the Free Software Foundation,
10156 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10158 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10159 + * or visit www.oracle.com if you need additional information or have any
10165 +import java.nio.CharBuffer;
10166 +import java.nio.ByteBuffer;
10167 +import java.nio.charset.*;
10168 +import sun.nio.cs.*;
10170 +public abstract class X11CNS11643 extends Charset {
10171 + private final int plane;
10172 + public X11CNS11643 (int plane, String name) {
10173 + super(name, null);
10176 + this.plane = 0; // CS1
10180 + this.plane = plane;
10183 + throw new IllegalArgumentException
10184 + ("Only planes 1, 2, and 3 supported");
10188 + public CharsetEncoder newEncoder() {
10189 + return new Encoder(this, plane);
10192 + public CharsetDecoder newDecoder() {
10193 + return new Decoder(this, plane);
10196 + public boolean contains(Charset cs) {
10197 + return cs instanceof X11CNS11643;
10200 + private class Encoder extends EUC_TW.Encoder {
10201 + private int plane;
10202 + public Encoder(Charset cs, int plane) {
10204 + this.plane = plane;
10207 + private byte[] bb = new byte[4];
10208 + public boolean canEncode(char c) {
10212 + int nb = toEUC(c, bb);
10217 + p = (bb[1] & 0xff) - 0xa0;
10218 + return (p == plane);
10221 + public boolean isLegalReplacement(byte[] repl) {
10225 + protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
10226 + char[] sa = src.array();
10227 + int sp = src.arrayOffset() + src.position();
10228 + int sl = src.arrayOffset() + src.limit();
10229 + byte[] da = dst.array();
10230 + int dp = dst.arrayOffset() + dst.position();
10231 + int dl = dst.arrayOffset() + dst.limit();
10234 + while (sp < sl) {
10236 + if ( c > '\u007f'&& c < '\uFFFE') {
10237 + int nb = toEUC(c, bb);
10241 + p = (bb[1] & 0xff) - 0xa0;
10242 + if (p == plane) {
10244 + return CoderResult.OVERFLOW;
10246 + da[dp++] = (byte)(bb[0] & 0x7f);
10247 + da[dp++] = (byte)(bb[1] & 0x7f);
10249 + da[dp++] = (byte)(bb[2] & 0x7f);
10250 + da[dp++] = (byte)(bb[3] & 0x7f);
10257 + return CoderResult.unmappableForLength(1);
10259 + return CoderResult.UNDERFLOW;
10261 + src.position(sp - src.arrayOffset());
10262 + dst.position(dp - dst.arrayOffset());
10267 + private class Decoder extends EUC_TW.Decoder {
10269 + private String table;
10270 + protected Decoder(Charset cs, int plane) {
10273 + this.plane = plane;
10274 + else if (plane == 2 || plane == 3)
10275 + this.plane = plane - 1;
10277 + throw new IllegalArgumentException
10278 + ("Only planes 1, 2, and 3 supported");
10281 + //we only work on array backed buffer.
10282 + protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
10283 + byte[] sa = src.array();
10284 + int sp = src.arrayOffset() + src.position();
10285 + int sl = src.arrayOffset() + src.limit();
10287 + char[] da = dst.array();
10288 + int dp = dst.arrayOffset() + dst.position();
10289 + int dl = dst.arrayOffset() + dst.limit();
10292 + while (sp < sl) {
10293 + if ( sl - sp < 2) {
10294 + return CoderResult.UNDERFLOW;
10296 + int b1 = (sa[sp] & 0xff) | 0x80;
10297 + int b2 = (sa[sp + 1] & 0xff) | 0x80;
10298 + char[] cc = toUnicode(b1, b2, plane);
10299 + // plane3 has non-bmp characters(added), x11cnsp3
10300 + // however does not support them
10301 + if (cc == null || cc.length == 2)
10302 + return CoderResult.unmappableForLength(2);
10304 + return CoderResult.OVERFLOW;
10305 + da[dp++] = cc[0];
10308 + return CoderResult.UNDERFLOW;
10310 + src.position(sp - src.arrayOffset());
10311 + dst.position(dp - dst.arrayOffset());
10316 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P1.java jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P1.java
10317 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P1.java 1970-01-01 01:00:00.000000000 +0100
10318 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P1.java 2024-12-29 15:20:25.119686371 +0100
10321 + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
10322 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10324 + * This code is free software; you can redistribute it and/or modify it
10325 + * under the terms of the GNU General Public License version 2 only, as
10326 + * published by the Free Software Foundation. Oracle designates this
10327 + * particular file as subject to the "Classpath" exception as provided
10328 + * by Oracle in the LICENSE file that accompanied this code.
10330 + * This code is distributed in the hope that it will be useful, but WITHOUT
10331 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10332 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10333 + * version 2 for more details (a copy is included in the LICENSE file that
10334 + * accompanied this code).
10336 + * You should have received a copy of the GNU General Public License version
10337 + * 2 along with this work; if not, write to the Free Software Foundation,
10338 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10340 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10341 + * or visit www.oracle.com if you need additional information or have any
10348 +public class X11CNS11643P1 extends X11CNS11643 {
10349 + public X11CNS11643P1() {
10350 + super(1, "X11CNS11643P1");
10353 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P2.java jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P2.java
10354 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P2.java 1970-01-01 01:00:00.000000000 +0100
10355 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P2.java 2024-12-29 15:20:25.119930934 +0100
10358 + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
10359 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10361 + * This code is free software; you can redistribute it and/or modify it
10362 + * under the terms of the GNU General Public License version 2 only, as
10363 + * published by the Free Software Foundation. Oracle designates this
10364 + * particular file as subject to the "Classpath" exception as provided
10365 + * by Oracle in the LICENSE file that accompanied this code.
10367 + * This code is distributed in the hope that it will be useful, but WITHOUT
10368 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10369 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10370 + * version 2 for more details (a copy is included in the LICENSE file that
10371 + * accompanied this code).
10373 + * You should have received a copy of the GNU General Public License version
10374 + * 2 along with this work; if not, write to the Free Software Foundation,
10375 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10377 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10378 + * or visit www.oracle.com if you need additional information or have any
10384 +public class X11CNS11643P2 extends X11CNS11643 {
10385 + public X11CNS11643P2() {
10386 + super(2, "X11CNS11643P2");
10389 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P3.java jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P3.java
10390 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/classes/sun/font/X11CNS11643P3.java 1970-01-01 01:00:00.000000000 +0100
10391 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/classes/sun/font/X11CNS11643P3.java 2024-12-29 15:20:25.120165403 +0100
10394 + * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
10395 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10397 + * This code is free software; you can redistribute it and/or modify it
10398 + * under the terms of the GNU General Public License version 2 only, as
10399 + * published by the Free Software Foundation. Oracle designates this
10400 + * particular file as subject to the "Classpath" exception as provided
10401 + * by Oracle in the LICENSE file that accompanied this code.
10403 + * This code is distributed in the hope that it will be useful, but WITHOUT
10404 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10405 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10406 + * version 2 for more details (a copy is included in the LICENSE file that
10407 + * accompanied this code).
10409 + * You should have received a copy of the GNU General Public License version
10410 + * 2 along with this work; if not, write to the Free Software Foundation,
10411 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10413 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10414 + * or visit www.oracle.com if you need additional information or have any
10420 +public class X11CNS11643P3 extends X11CNS11643 {
10421 + public X11CNS11643P3() {
10422 + super(3, "X11CNS11643P3");
10425 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/data/fontconfig/fontconfig.properties jdk24u-jdk-24-29/src/java.desktop/solaris/data/fontconfig/fontconfig.properties
10426 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/data/fontconfig/fontconfig.properties 1970-01-01 01:00:00.000000000 +0100
10427 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/data/fontconfig/fontconfig.properties 2024-12-29 15:20:25.106221085 +0100
10431 +# Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
10432 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10434 +# This code is free software; you can redistribute it and/or modify it
10435 +# under the terms of the GNU General Public License version 2 only, as
10436 +# published by the Free Software Foundation. Oracle designates this
10437 +# particular file as subject to the "Classpath" exception as provided
10438 +# by Oracle in the LICENSE file that accompanied this code.
10440 +# This code is distributed in the hope that it will be useful, but WITHOUT
10441 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10442 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10443 +# version 2 for more details (a copy is included in the LICENSE file that
10444 +# accompanied this code).
10446 +# You should have received a copy of the GNU General Public License version
10447 +# 2 along with this work; if not, write to the Free Software Foundation,
10448 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10450 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10451 +# or visit www.oracle.com if you need additional information or have any
10459 +# Component Font Mappings
10461 +allfonts.chinese-gb2312=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10462 +allfonts.chinese-gbk=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10463 +allfonts.chinese-gb18030-0=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10464 +allfonts.chinese-gb18030-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10465 +allfonts.chinese-cns11643-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10466 +allfonts.chinese-cns11643-2=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10467 +allfonts.chinese-cns11643-3=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10468 +allfonts.chinese-big5=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10469 +allfonts.chinese-hkscs=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10470 +allfonts.dingbats=-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific
10471 +allfonts.japanese-x0212=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10472 +allfonts.korean=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10473 +allfonts.korean-johab=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10474 +allfonts.symbol=-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol
10475 +allfonts.bengali=-misc-lohit bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1
10476 +allfonts.gujarati=-misc-lohit gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1
10477 +allfonts.hindi=-misc-lohit hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1
10478 +allfonts.kannada=-misc-lohit kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1
10479 +allfonts.malayalam=-misc-lohit malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1
10480 +allfonts.marathi=-misc-lohit marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1
10481 +allfonts.tamil=-misc-lohit tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1
10482 +allfonts.telugu=-misc-lohit telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1
10483 +allfonts.dejavusans=-misc-dejavu sans-medium-r-normal--0-0-0-0-p-0-iso10646-1
10485 +serif.plain.arabic=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10486 +serif.plain.cyrillic-iso8859-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10487 +serif.plain.cyrillic-cp1251=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10488 +serif.plain.cyrillic-koi8-r=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10489 +serif.plain.greek=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10490 +serif.plain.hebrew=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10491 +serif.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10492 +serif.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10493 +serif.plain.latin-1=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10494 +serif.plain.latin-2=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10495 +serif.plain.latin-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10496 +serif.plain.latin-7=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10497 +serif.plain.latin-9=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10498 +serif.plain.thai=-monotype-angsana new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10500 +serif.bold.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10501 +serif.bold.cyrillic-iso8859-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10502 +serif.bold.cyrillic-cp1251=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10503 +serif.bold.cyrillic-koi8-r=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10504 +serif.bold.greek=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10505 +serif.bold.hebrew=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10506 +serif.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10507 +serif.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10508 +serif.bold.latin-1=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10509 +serif.bold.latin-2=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10510 +serif.bold.latin-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10511 +serif.bold.latin-7=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10512 +serif.bold.latin-9=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10513 +serif.bold.thai=-monotype-angsana new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10515 +serif.italic.arabic=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10516 +serif.italic.cyrillic-iso8859-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10517 +serif.italic.cyrillic-cp1251=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10518 +serif.italic.cyrillic-koi8-r=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10519 +serif.italic.greek=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10520 +serif.italic.hebrew=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10521 +serif.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10522 +serif.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10523 +serif.italic.latin-1=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10524 +serif.italic.latin-2=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10525 +serif.italic.latin-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10526 +serif.italic.latin-7=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10527 +serif.italic.latin-9=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10528 +serif.italic.thai=-monotype-angsana new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10530 +serif.bolditalic.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10531 +serif.bolditalic.cyrillic-iso8859-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10532 +serif.bolditalic.cyrillic-cp1251=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10533 +serif.bolditalic.cyrillic-koi8-r=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10534 +serif.bolditalic.greek=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10535 +serif.bolditalic.hebrew=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10536 +serif.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10537 +serif.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10538 +serif.bolditalic.latin-1=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10539 +serif.bolditalic.latin-2=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10540 +serif.bolditalic.latin-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10541 +serif.bolditalic.latin-7=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10542 +serif.bolditalic.latin-9=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10543 +serif.bolditalic.thai=-monotype-angsana new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10545 +sansserif.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10546 +sansserif.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10547 +sansserif.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10548 +sansserif.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10549 +sansserif.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10550 +sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10551 +sansserif.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10552 +sansserif.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10553 +sansserif.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10554 +sansserif.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10555 +sansserif.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10556 +sansserif.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10557 +sansserif.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10558 +sansserif.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10560 +sansserif.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10561 +sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10562 +sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10563 +sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10564 +sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10565 +sansserif.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10566 +sansserif.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10567 +sansserif.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10568 +sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10569 +sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10570 +sansserif.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10571 +sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10572 +sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10573 +sansserif.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10575 +sansserif.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10576 +sansserif.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10577 +sansserif.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10578 +sansserif.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10579 +sansserif.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10580 +sansserif.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10581 +sansserif.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10582 +sansserif.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10583 +sansserif.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10584 +sansserif.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10585 +sansserif.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10586 +sansserif.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10587 +sansserif.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10588 +sansserif.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10590 +sansserif.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10591 +sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10592 +sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10593 +sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10594 +sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10595 +sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10596 +sansserif.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10597 +sansserif.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10598 +sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10599 +sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10600 +sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10601 +sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10602 +sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10603 +sansserif.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10605 +monospaced.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10606 +monospaced.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10607 +monospaced.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10608 +monospaced.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10609 +monospaced.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10610 +monospaced.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10611 +monospaced.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10612 +monospaced.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10613 +monospaced.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10614 +monospaced.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10615 +monospaced.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10616 +monospaced.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10617 +monospaced.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10618 +monospaced.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10620 +monospaced.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10621 +monospaced.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10622 +monospaced.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10623 +monospaced.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10624 +monospaced.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10625 +monospaced.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10626 +monospaced.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10627 +monospaced.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10628 +monospaced.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10629 +monospaced.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10630 +monospaced.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10631 +monospaced.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10632 +monospaced.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10633 +monospaced.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10635 +monospaced.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10636 +monospaced.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10637 +monospaced.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10638 +monospaced.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10639 +monospaced.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10640 +monospaced.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10641 +monospaced.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10642 +monospaced.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10643 +monospaced.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10644 +monospaced.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10645 +monospaced.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10646 +monospaced.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10647 +monospaced.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10648 +monospaced.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10650 +monospaced.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10651 +monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10652 +monospaced.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10653 +monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10654 +monospaced.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10655 +monospaced.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10656 +monospaced.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10657 +monospaced.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10658 +monospaced.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10659 +monospaced.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10660 +monospaced.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10661 +monospaced.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10662 +monospaced.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10663 +monospaced.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10665 +dialog.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10666 +dialog.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10667 +dialog.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10668 +dialog.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10669 +dialog.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10670 +dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10671 +dialog.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10672 +dialog.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10673 +dialog.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10674 +dialog.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10675 +dialog.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10676 +dialog.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10677 +dialog.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10678 +dialog.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10680 +dialog.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10681 +dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10682 +dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10683 +dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10684 +dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10685 +dialog.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10686 +dialog.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10687 +dialog.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10688 +dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10689 +dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10690 +dialog.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10691 +dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10692 +dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10693 +dialog.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10695 +dialog.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10696 +dialog.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10697 +dialog.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10698 +dialog.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10699 +dialog.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10700 +dialog.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10701 +dialog.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10702 +dialog.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10703 +dialog.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10704 +dialog.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10705 +dialog.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10706 +dialog.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10707 +dialog.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10708 +dialog.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10710 +dialog.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10711 +dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10712 +dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10713 +dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10714 +dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10715 +dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10716 +dialog.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10717 +dialog.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10718 +dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10719 +dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10720 +dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10721 +dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10722 +dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10723 +dialog.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10725 +dialoginput.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10726 +dialoginput.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10727 +dialoginput.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10728 +dialoginput.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10729 +dialoginput.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10730 +dialoginput.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10731 +dialoginput.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10732 +dialoginput.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10733 +dialoginput.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10734 +dialoginput.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10735 +dialoginput.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10736 +dialoginput.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10737 +dialoginput.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10738 +dialoginput.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10740 +dialoginput.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10741 +dialoginput.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10742 +dialoginput.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10743 +dialoginput.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10744 +dialoginput.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10745 +dialoginput.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10746 +dialoginput.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10747 +dialoginput.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10748 +dialoginput.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10749 +dialoginput.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10750 +dialoginput.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10751 +dialoginput.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10752 +dialoginput.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10753 +dialoginput.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10755 +dialoginput.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
10756 +dialoginput.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10757 +dialoginput.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10758 +dialoginput.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10759 +dialoginput.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10760 +dialoginput.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10761 +dialoginput.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10762 +dialoginput.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10763 +dialoginput.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10764 +dialoginput.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10765 +dialoginput.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10766 +dialoginput.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10767 +dialoginput.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10768 +dialoginput.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
10770 +dialoginput.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
10771 +dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10772 +dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10773 +dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10774 +dialoginput.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10775 +dialoginput.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10776 +dialoginput.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10777 +dialoginput.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
10778 +dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10779 +dialoginput.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10780 +dialoginput.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10781 +dialoginput.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10782 +dialoginput.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10783 +dialoginput.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
10785 +# Search Sequences
10787 +sequence.allfonts=latin-1
10789 +sequence.allfonts.Big5=latin-1,chinese-big5
10791 +sequence.allfonts.Big5-HKSCS-2001=latin-1,chinese-big5,chinese-hkscs
10793 +sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1
10795 +sequence.allfonts.GB2312=latin-1,chinese-gb2312
10797 +sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212
10799 +sequence.allfonts.EUC-KR=latin-1,korean
10801 +sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3
10803 +sequence.allfonts.GBK=latin-1,chinese-gbk
10805 +sequence.allfonts.GB18030=latin-1,chinese-gb18030-0,chinese-gb18030-1
10807 +sequence.allfonts.ISO-8859-2=latin-2,latin-1
10809 +sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1
10811 +sequence.allfonts.ISO-8859-6=arabic,latin-1
10813 +sequence.allfonts.ISO-8859-7=latin-1,greek
10815 +sequence.allfonts.ISO-8859-8=latin-1,hebrew
10817 +sequence.allfonts.ISO-8859-9=latin-5,latin-1
10819 +sequence.allfonts.ISO-8859-13=latin-7,latin-1
10821 +sequence.allfonts.ISO-8859-15=latin-9
10823 +sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1
10825 +sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212
10827 +sequence.allfonts.TIS-620=latin-1,thai
10829 +sequence.allfonts.UTF-8=latin-1
10830 +sequence.allfonts.UTF-8.en=latin-1
10831 +sequence.allfonts.UTF-8.hi=latin-1,hindi
10832 +sequence.allfonts.UTF-8.be=latin-1,bengali
10833 +sequence.allfonts.UTF-8.te=latin-1,telugu
10834 +sequence.allfonts.UTF-8.mr=latin-1,marathi
10835 +sequence.allfonts.UTF-8.ta=latin-1,tamil
10836 +sequence.allfonts.UTF-8.gu=latin-1,gujarati
10837 +sequence.allfonts.UTF-8.kn=latin-1,kannada
10838 +sequence.allfonts.UTF-8.ma=latin-1,malayalam
10840 +sequence.allfonts.UTF-8.ko=latin-1,korean-johab,japanese-x0201,japanese-x0208,japanese-x0212
10842 +sequence.allfonts.UTF-8.th=latin-1,thai
10844 +sequence.allfonts.UTF-8.zh.CN=latin-1,chinese-gb18030-0,chinese-gb18030-1,chinese-big5,chinese-hkscs
10846 +sequence.allfonts.UTF-8.zh.HK=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1
10848 +sequence.allfonts.UTF-8.zh.TW=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1
10850 +# the fallback sequence omits the following character subsets:
10851 +# - chinese: all same file : just use chinese-gb18030-0
10852 +# - japanese-x0208: same files as japanese-x0201
10853 +# - japanese-x0212: same files as japanese-x0201
10854 +# - korean: same file as korean-johab
10855 +sequence.fallback=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
10856 + arabic,hebrew,thai,\
10857 + chinese-gb18030-0,\
10858 + japanese-x0201,korean-johab,\
10859 + hindi,bengali,telugu,marathi,tamil,gujarati,kannada,malayalam,\
10860 + dejavusans,dingbats,symbol
10864 +filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf
10865 +filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf
10866 +filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbd.ttf
10867 +filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf
10868 +filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf
10869 +filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf
10870 +filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbd.ttf
10871 +filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf
10872 +filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf
10873 +filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf
10874 +filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbd.ttf
10875 +filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf
10877 +filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf
10878 +filename.-monotype-angsana_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsai.ttf
10879 +filename.-monotype-angsana_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsab.ttf
10880 +filename.-monotype-angsana_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsaz.ttf
10881 +filename.-monotype-browallia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browa.ttf
10882 +filename.-monotype-browallia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browai.ttf
10883 +filename.-monotype-browallia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browab.ttf
10884 +filename.-monotype-browallia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browaz.ttf
10885 +filename.-monotype-cordia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordia.ttf
10886 +filename.-monotype-cordia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiai.ttf
10887 +filename.-monotype-cordia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiab.ttf
10888 +filename.-monotype-cordia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiaz.ttf
10890 +filename.-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipag.otf
10891 +filename.-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipam.otf
10892 +filename.-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/hanyang/h2gtrm.ttf
10893 +filename.-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/arphic/uming.ttf
10894 +filename.-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol=/usr/share/fonts/TrueType/core/symbol.ttf
10895 +filename.-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific=/usr/share/fonts/TrueType/core/wingdings.ttf
10896 +filename.-misc-lohit_bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Bengali.ttf
10897 +filename.-misc-lohit_gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Gujarati.ttf
10898 +filename.-misc-lohit_hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Hindi.ttf
10899 +filename.-misc-lohit_kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Kannada.ttf
10900 +filename.-misc-lohit_malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Malayalam.ttf
10901 +filename.-misc-lohit_marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Marathi.ttf
10902 +filename.-misc-lohit_tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Tamil.ttf
10903 +filename.-misc-lohit_telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Telugu.ttf
10904 +filename.-misc-dejavu_sans-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/dejavu/DejaVuSans.ttf
10906 +# AWT X11 font paths
10907 +awtfontpath.latin-1=/usr/share/fonts/TrueType/core
10908 +awtfontpath.latin-2=/usr/share/fonts/TrueType/core
10909 +awtfontpath.latin-5=/usr/share/fonts/TrueType/core
10910 +awtfontpath.latin-7=/usr/share/fonts/TrueType/core
10911 +awtfontpath.latin-9=/usr/share/fonts/TrueType/core
10912 +awtfontpath.hebrew=/usr/share/fonts/TrueType/core
10913 +awtfontpath.arabic=/usr/share/fonts/TrueType/core
10914 +awtfontpath.thai=/usr/share/fonts/TrueType/core
10915 +awtfontpath.greek=/usr/share/fonts/TrueType/core
10916 +awtfontpath.cyrillic-iso8859-5=/usr/share/fonts/TrueType/core
10917 +awtfontpath.cyrillic-cp1251=/usr/share/fonts/TrueType/core
10918 +awtfontpath.cyrillic-koi8-r=/usr/share/fonts/TrueType/core
10919 +awtfontpath.korean=/usr/share/fonts/TrueType/hanyang
10920 +awtfontpath.korean-johab=/usr/share/fonts/TrueType/hanyang
10921 +awtfontpath.japanese-x0201=/usr/share/fonts/TrueType/ipafont
10922 +awtfontpath.japanese-x0208=/usr/share/fonts/TrueType/ipafont
10923 +awtfontpath.japanese-x0212=/usr/share/fonts/TrueType/ipafont
10924 +awtfontpath.chinese-gbk=/usr/share/fonts/TrueType/arphic
10925 +awtfontpath.chinese-cns11643-1=/usr/share/fonts/TrueType/arphic
10926 +awtfontpath.chinese-cns11643-2=/usr/share/fonts/TrueType/arphic
10927 +awtfontpath.chinese-cns11643-3=/usr/share/fonts/TrueType/arphic
10928 +awtfontpath.chinese-big5=/usr/share/fonts/TrueType/arphic
10929 +awtfontpath.chinese-gb2312=/usr/share/fonts/TrueType/arphic
10930 +awtfontpath.chinese-gb18030-0=/usr/share/fonts/TrueType/arphic
10931 +awtfontpath.chinese-gb18030-1=/usr/share/fonts/TrueType/arphic
10932 +awtfontpath.chinese-hkscs=/usr/share/fonts/TrueType/arphic
10933 +awtfontpath.bengali=/usr/share/fonts/TrueType/lohit
10934 +awtfontpath.gujarati=/usr/share/fonts/TrueType/lohit
10935 +awtfontpath.hindi=/usr/share/fonts/TrueType/lohit
10936 +awtfontpath.kannada=/usr/share/fonts/TrueType/lohit
10937 +awtfontpath.malayalam=/usr/share/fonts/TrueType/lohit
10938 +awtfontpath.marathi=/usr/share/fonts/TrueType/lohit
10939 +awtfontpath.tamil=/usr/share/fonts/TrueType/lohit
10940 +awtfontpath.telugu=/usr/share/fonts/TrueType/lohit
10941 +awtfontpath.dejavusans=/usr/share/fonts/TrueType/dejavu
10943 +# Appended Font Path
10945 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_PCM.c jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_PCM.c
10946 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_PCM.c 1970-01-01 01:00:00.000000000 +0100
10947 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_PCM.c 2024-12-29 15:20:25.120732370 +0100
10950 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
10951 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10953 + * This code is free software; you can redistribute it and/or modify it
10954 + * under the terms of the GNU General Public License version 2 only, as
10955 + * published by the Free Software Foundation. Oracle designates this
10956 + * particular file as subject to the "Classpath" exception as provided
10957 + * by Oracle in the LICENSE file that accompanied this code.
10959 + * This code is distributed in the hope that it will be useful, but WITHOUT
10960 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10961 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10962 + * version 2 for more details (a copy is included in the LICENSE file that
10963 + * accompanied this code).
10965 + * You should have received a copy of the GNU General Public License version
10966 + * 2 along with this work; if not, write to the Free Software Foundation,
10967 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10969 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10970 + * or visit www.oracle.com if you need additional information or have any
10977 +#include "PLATFORM_API_SolarisOS_Utils.h"
10978 +#include "DirectAudio.h"
10980 +#if USE_DAUDIO == TRUE
10983 +// The default buffer time
10984 +#define DEFAULT_PERIOD_TIME_MILLIS 50
10986 +///// implemented functions of DirectAudio.h
10988 +INT32 DAUDIO_GetDirectAudioDeviceCount() {
10989 + return (INT32) getAudioDeviceCount();
10993 +INT32 DAUDIO_GetDirectAudioDeviceDescription(INT32 mixerIndex,
10994 + DirectAudioDeviceDescription* description) {
10995 + AudioDeviceDescription desc;
10997 + if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, TRUE)) {
10998 + description->maxSimulLines = desc.maxSimulLines;
10999 + strncpy(description->name, desc.name, DAUDIO_STRING_LENGTH-1);
11000 + description->name[DAUDIO_STRING_LENGTH-1] = 0;
11001 + strncpy(description->vendor, desc.vendor, DAUDIO_STRING_LENGTH-1);
11002 + description->vendor[DAUDIO_STRING_LENGTH-1] = 0;
11003 + strncpy(description->version, desc.version, DAUDIO_STRING_LENGTH-1);
11004 + description->version[DAUDIO_STRING_LENGTH-1] = 0;
11005 + /*strncpy(description->description, desc.description, DAUDIO_STRING_LENGTH-1);*/
11006 + strncpy(description->description, "Solaris Mixer", DAUDIO_STRING_LENGTH-1);
11007 + description->description[DAUDIO_STRING_LENGTH-1] = 0;
11014 +#define MAX_SAMPLE_RATES 20
11016 +void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* creator) {
11018 + AudioDeviceDescription desc;
11019 + am_sample_rates_t *sr;
11020 + /* hardcoded bits and channels */
11021 + int bits[] = {8, 16};
11022 + int bitsCount = 2;
11023 + int channels[] = {1, 2};
11024 + int channelsCount = 2;
11025 + /* for querying sample rates */
11030 + TRACE2("DAUDIO_GetFormats, mixer %d, isSource=%d\n", mixerIndex, isSource);
11031 + if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) {
11032 + fd = open(desc.pathctl, O_RDONLY);
11035 + ERROR1("Couldn't open audio device ctl for device %d!\n", mixerIndex);
11039 + /* get sample rates */
11040 + sr = (am_sample_rates_t*) malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(MAX_SAMPLE_RATES));
11041 + if (sr == NULL) {
11042 + ERROR1("DAUDIO_GetFormats: out of memory for mixer %d\n", (int) mixerIndex);
11047 + sr->num_samp_rates = MAX_SAMPLE_RATES;
11048 + sr->type = isSource?AUDIO_PLAY:AUDIO_RECORD;
11049 + sr->samp_rates[0] = -2;
11050 + err = ioctl(fd, AUDIO_MIXER_GET_SAMPLE_RATES, sr);
11052 + ERROR1(" DAUDIO_GetFormats: AUDIO_MIXER_GET_SAMPLE_RATES failed for mixer %d!\n",
11053 + (int)mixerIndex);
11054 + ERROR2(" -> num_sample_rates=%d sample_rates[0] = %d\n",
11055 + (int) sr->num_samp_rates,
11056 + (int) sr->samp_rates[0]);
11057 + /* Some Solaris 8 drivers fail for get sample rates!
11058 + * Do as if we support all sample rates
11060 + sr->flags = MIXER_SR_LIMITS;
11062 + if ((sr->flags & MIXER_SR_LIMITS)
11063 + || (sr->num_samp_rates > MAX_SAMPLE_RATES)) {
11065 + if ((sr->flags & MIXER_SR_LIMITS)) {
11066 + TRACE1(" DAUDIO_GetFormats: floating sample rate allowed by mixer %d\n",
11067 + (int)mixerIndex);
11069 + if (sr->num_samp_rates > MAX_SAMPLE_RATES) {
11070 + TRACE2(" DAUDIO_GetFormats: more than %d formats. Use -1 for sample rates mixer %d\n",
11071 + MAX_SAMPLE_RATES, (int)mixerIndex);
11075 + * Fake it to have only one sample rate: -1
11077 + sr->num_samp_rates = 1;
11078 + sr->samp_rates[0] = -1;
11082 + for (ch = 0; ch < channelsCount; ch++) {
11083 + for (b = 0; b < bitsCount; b++) {
11084 + for (s = 0; s < sr->num_samp_rates; s++) {
11085 + DAUDIO_AddAudioFormat(creator,
11086 + bits[b], /* significant bits */
11087 + 0, /* frameSize: let it be calculated */
11089 + (float) ((int) sr->samp_rates[s]),
11090 + DAUDIO_PCM, /* encoding - let's only do PCM */
11091 + (bits[b] > 8)?TRUE:TRUE, /* isSigned */
11092 +#ifdef _LITTLE_ENDIAN
11093 + FALSE /* little endian */
11095 + (bits[b] > 8)?TRUE:FALSE /* big endian */
11107 + audio_info_t info;
11108 + int bufferSizeInBytes;
11109 + int frameSize; /* storage size in Bytes */
11110 + /* how many bytes were written or read */
11111 + INT32 transferedBytes;
11112 + /* if transferedBytes exceed 32-bit boundary,
11113 + * it will be reset and positionOffset will receive
11116 + INT64 positionOffset;
11120 +void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
11121 + int encoding, float sampleRate, int sampleSizeInBits,
11122 + int frameSize, int channels,
11123 + int isSigned, int isBigEndian, int bufferSizeInBytes) {
11126 + AudioDeviceDescription desc;
11127 + SolPcmInfo* info;
11129 + TRACE0("> DAUDIO_Open\n");
11130 + if (encoding != DAUDIO_PCM) {
11131 + ERROR1(" DAUDIO_Open: invalid encoding %d\n", (int) encoding);
11134 + if (channels <= 0) {
11135 + ERROR1(" DAUDIO_Open: Invalid number of channels=%d!\n", channels);
11139 + info = (SolPcmInfo*) malloc(sizeof(SolPcmInfo));
11141 + ERROR0("Out of memory\n");
11144 + memset(info, 0, sizeof(SolPcmInfo));
11145 + info->frameSize = frameSize;
11149 + openMode = O_WRONLY;
11151 + openMode = O_RDONLY;
11155 + /* blackdown does not use NONBLOCK */
11156 + openMode |= O_NONBLOCK;
11159 + if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) {
11160 + info->fd = open(desc.path, openMode);
11162 + if (info->fd < 0) {
11163 + ERROR1("Couldn't open audio device for mixer %d!\n", mixerIndex);
11167 + /* set to multiple open */
11168 + if (ioctl(info->fd, AUDIO_MIXER_MULTIPLE_OPEN, NULL) >= 0) {
11169 + TRACE1("DAUDIO_Open: %s set to multiple open\n", desc.path);
11171 + ERROR1("DAUDIO_Open: ioctl AUDIO_MIXER_MULTIPLE_OPEN failed on %s!\n", desc.path);
11174 + AUDIO_INITINFO(&(info->info));
11175 + /* need AUDIO_GETINFO ioctl to get this to work on solaris x86 */
11176 + err = ioctl(info->fd, AUDIO_GETINFO, &(info->info));
11178 + /* not valid to call AUDIO_SETINFO ioctl with all the fields from AUDIO_GETINFO. */
11179 + AUDIO_INITINFO(&(info->info));
11182 + info->info.play.sample_rate = sampleRate;
11183 + info->info.play.precision = sampleSizeInBits;
11184 + info->info.play.channels = channels;
11185 + info->info.play.encoding = AUDIO_ENCODING_LINEAR;
11186 + info->info.play.buffer_size = bufferSizeInBytes;
11187 + info->info.play.pause = 1;
11189 + info->info.record.sample_rate = sampleRate;
11190 + info->info.record.precision = sampleSizeInBits;
11191 + info->info.record.channels = channels;
11192 + info->info.record.encoding = AUDIO_ENCODING_LINEAR;
11193 + info->info.record.buffer_size = bufferSizeInBytes;
11194 + info->info.record.pause = 1;
11196 + err = ioctl(info->fd, AUDIO_SETINFO, &(info->info));
11198 + ERROR0("DAUDIO_Open: could not set info!\n");
11199 + DAUDIO_Close((void*) info, isSource);
11202 + DAUDIO_Flush((void*) info, isSource);
11204 + err = ioctl(info->fd, AUDIO_GETINFO, &(info->info));
11207 + info->bufferSizeInBytes = info->info.play.buffer_size;
11209 + info->bufferSizeInBytes = info->info.record.buffer_size;
11211 + TRACE2("DAUDIO: buffersize in bytes: requested=%d, got %d\n",
11212 + (int) bufferSizeInBytes,
11213 + (int) info->bufferSizeInBytes);
11215 + ERROR0("DAUDIO_Open: cannot get info!\n");
11216 + DAUDIO_Close((void*) info, isSource);
11219 + TRACE0("< DAUDIO_Open: Opened device successfully.\n");
11220 + return (void*) info;
11224 +int DAUDIO_Start(void* id, int isSource) {
11225 + SolPcmInfo* info = (SolPcmInfo*) id;
11226 + int err, modified;
11227 + audio_info_t audioInfo;
11229 + TRACE0("> DAUDIO_Start\n");
11231 + AUDIO_INITINFO(&audioInfo);
11232 + err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
11235 + modified = FALSE;
11236 + if (isSource && audioInfo.play.pause) {
11237 + audioInfo.play.pause = 0;
11240 + if (!isSource && audioInfo.record.pause) {
11241 + audioInfo.record.pause = 0;
11245 + err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
11249 + TRACE1("< DAUDIO_Start %s\n", (err>=0)?"success":"error");
11250 + return (err >= 0)?TRUE:FALSE;
11253 +int DAUDIO_Stop(void* id, int isSource) {
11254 + SolPcmInfo* info = (SolPcmInfo*) id;
11255 + int err, modified;
11256 + audio_info_t audioInfo;
11258 + TRACE0("> DAUDIO_Stop\n");
11260 + AUDIO_INITINFO(&audioInfo);
11261 + err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
11264 + modified = FALSE;
11265 + if (isSource && !audioInfo.play.pause) {
11266 + audioInfo.play.pause = 1;
11269 + if (!isSource && !audioInfo.record.pause) {
11270 + audioInfo.record.pause = 1;
11274 + err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
11278 + TRACE1("< DAUDIO_Stop %s\n", (err>=0)?"success":"error");
11279 + return (err >= 0)?TRUE:FALSE;
11282 +void DAUDIO_Close(void* id, int isSource) {
11283 + SolPcmInfo* info = (SolPcmInfo*) id;
11285 + TRACE0("DAUDIO_Close\n");
11286 + if (info != NULL) {
11287 + if (info->fd >= 0) {
11288 + DAUDIO_Flush(id, isSource);
11296 +/* close to 2^31 */
11297 +#define POSITION_MAX 2000000000
11300 +#define POSITION_MAX 1000000
11303 +void resetErrorFlagAndAdjustPosition(SolPcmInfo* info, int isSource, int count) {
11304 + audio_info_t audioInfo;
11305 + audio_prinfo_t* prinfo;
11308 + int underrun = FALSE;
11309 + int devBytes = 0;
11312 + info->transferedBytes += count;
11315 + prinfo = &(audioInfo.play);
11317 + prinfo = &(audioInfo.record);
11319 + AUDIO_INITINFO(&audioInfo);
11320 + err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
11322 + underrun = prinfo->error;
11323 + devBytes = prinfo->samples * info->frameSize;
11325 + AUDIO_INITINFO(&audioInfo);
11327 + /* if an underrun occurred, reset */
11328 + ERROR1("DAUDIO_Write/Read: Underrun/overflow: adjusting positionOffset by %d:\n",
11329 + (devBytes - info->transferedBytes));
11330 + ERROR1(" devBytes from %d to 0, ", devBytes);
11331 + ERROR2(" positionOffset from %d to %d ",
11332 + (int) info->positionOffset,
11333 + (int) (info->positionOffset + info->transferedBytes));
11334 + ERROR1(" transferedBytes from %d to 0\n",
11335 + (int) info->transferedBytes);
11336 + prinfo->samples = 0;
11337 + info->positionOffset += info->transferedBytes;
11338 + info->transferedBytes = 0;
11340 + else if (info->transferedBytes > POSITION_MAX) {
11341 + /* we will reset transferedBytes and
11342 + * the samples field in prinfo
11344 + offset = devBytes;
11345 + prinfo->samples = 0;
11347 + /* reset error flag */
11348 + prinfo->error = 0;
11350 + err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
11352 + if (offset > 0) {
11353 + /* upon exit of AUDIO_SETINFO, the samples parameter
11354 + * was set to the previous value. This is our
11357 + TRACE1("Adjust samplePos: offset=%d, ", (int) offset);
11358 + TRACE2("transferedBytes=%d -> %d, ",
11359 + (int) info->transferedBytes,
11360 + (int) (info->transferedBytes - offset));
11361 + TRACE2("positionOffset=%d -> %d\n",
11362 + (int) (info->positionOffset),
11363 + (int) (((int) info->positionOffset) + offset));
11364 + info->transferedBytes -= offset;
11365 + info->positionOffset += offset;
11368 + ERROR0("DAUDIO: resetErrorFlagAndAdjustPosition ioctl failed!\n");
11373 +// returns -1 on error
11374 +int DAUDIO_Write(void* id, char* data, int byteSize) {
11375 + SolPcmInfo* info = (SolPcmInfo*) id;
11378 + TRACE1("> DAUDIO_Write %d bytes\n", byteSize);
11379 + if (info!=NULL) {
11380 + ret = write(info->fd, data, byteSize);
11381 + resetErrorFlagAndAdjustPosition(info, TRUE, ret);
11382 + /* sets ret to -1 if buffer full, no error! */
11387 + TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret);
11391 +// returns -1 on error
11392 +int DAUDIO_Read(void* id, char* data, int byteSize) {
11393 + SolPcmInfo* info = (SolPcmInfo*) id;
11396 + TRACE1("> DAUDIO_Read %d bytes\n", byteSize);
11397 + if (info != NULL) {
11398 + ret = read(info->fd, data, byteSize);
11399 + resetErrorFlagAndAdjustPosition(info, TRUE, ret);
11400 + /* sets ret to -1 if buffer full, no error! */
11405 + TRACE1("< DAUDIO_Read: returning %d bytes.\n", ret);
11410 +int DAUDIO_GetBufferSize(void* id, int isSource) {
11411 + SolPcmInfo* info = (SolPcmInfo*) id;
11413 + return info->bufferSizeInBytes;
11418 +int DAUDIO_StillDraining(void* id, int isSource) {
11419 + SolPcmInfo* info = (SolPcmInfo*) id;
11420 + audio_info_t audioInfo;
11421 + audio_prinfo_t* prinfo;
11424 + if (info!=NULL) {
11426 + prinfo = &(audioInfo.play);
11428 + prinfo = &(audioInfo.record);
11430 + /* check error flag */
11431 + AUDIO_INITINFO(&audioInfo);
11432 + ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
11433 + ret = (prinfo->error != 0)?FALSE:TRUE;
11439 +int getDevicePosition(SolPcmInfo* info, int isSource) {
11440 + audio_info_t audioInfo;
11441 + audio_prinfo_t* prinfo;
11445 + prinfo = &(audioInfo.play);
11447 + prinfo = &(audioInfo.record);
11449 + AUDIO_INITINFO(&audioInfo);
11450 + err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
11452 + /*TRACE2("---> device paused: %d eof=%d\n",
11453 + prinfo->pause, prinfo->eof);
11455 + return (int) (prinfo->samples * info->frameSize);
11457 + ERROR0("DAUDIO: getDevicePosition: ioctl failed!\n");
11461 +int DAUDIO_Flush(void* id, int isSource) {
11462 + SolPcmInfo* info = (SolPcmInfo*) id;
11466 + TRACE0("DAUDIO_Flush\n");
11469 + err = ioctl(info->fd, I_FLUSH, FLUSHW);
11471 + err = ioctl(info->fd, I_FLUSH, FLUSHR);
11474 + /* resets the transferedBytes parameter to
11475 + * the current samples count of the device
11477 + pos = getDevicePosition(info, isSource);
11479 + info->transferedBytes = pos;
11484 + ERROR0("ERROR in DAUDIO_Flush\n");
11486 + return (err < 0)?FALSE:TRUE;
11489 +int DAUDIO_GetAvailable(void* id, int isSource) {
11490 + SolPcmInfo* info = (SolPcmInfo*) id;
11495 + /* unfortunately, the STREAMS architecture
11496 + * seems to not have a method for querying
11497 + * the available bytes to read/write!
11500 + pos = getDevicePosition(info, isSource);
11503 + /* we usually have written more bytes
11504 + * to the queue than the device position should be
11506 + ret = (info->bufferSizeInBytes) - (info->transferedBytes - pos);
11508 + /* for record, the device stream should
11509 + * be usually ahead of our read actions
11511 + ret = pos - info->transferedBytes;
11513 + if (ret > info->bufferSizeInBytes) {
11514 + ERROR2("DAUDIO_GetAvailable: available=%d, too big at bufferSize=%d!\n",
11515 + (int) ret, (int) info->bufferSizeInBytes);
11516 + ERROR2(" devicePos=%d, transferedBytes=%d\n",
11517 + (int) pos, (int) info->transferedBytes);
11518 + ret = info->bufferSizeInBytes;
11520 + else if (ret < 0) {
11521 + ERROR1("DAUDIO_GetAvailable: available=%d, in theory not possible!\n",
11523 + ERROR2(" devicePos=%d, transferedBytes=%d\n",
11524 + (int) pos, (int) info->transferedBytes);
11530 + TRACE1("DAUDIO_GetAvailable returns %d bytes\n", ret);
11534 +INT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos) {
11535 + SolPcmInfo* info = (SolPcmInfo*) id;
11538 + INT64 result = javaBytePos;
11541 + pos = getDevicePosition(info, isSource);
11543 + result = info->positionOffset + pos;
11547 + //printf("getbyteposition: javaBytePos=%d , return=%d\n", (int) javaBytePos, (int) result);
11552 +void DAUDIO_SetBytePosition(void* id, int isSource, INT64 javaBytePos) {
11553 + SolPcmInfo* info = (SolPcmInfo*) id;
11558 + pos = getDevicePosition(info, isSource);
11560 + info->positionOffset = javaBytePos - pos;
11565 +int DAUDIO_RequiresServicing(void* id, int isSource) {
11566 + // never need servicing on Solaris
11570 +void DAUDIO_Service(void* id, int isSource) {
11571 + // never need servicing on Solaris
11575 +#endif // USE_DAUDIO
11576 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Ports.c jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Ports.c
11577 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Ports.c 1970-01-01 01:00:00.000000000 +0100
11578 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Ports.c 2024-12-29 15:20:25.121215791 +0100
11581 + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
11582 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11584 + * This code is free software; you can redistribute it and/or modify it
11585 + * under the terms of the GNU General Public License version 2 only, as
11586 + * published by the Free Software Foundation. Oracle designates this
11587 + * particular file as subject to the "Classpath" exception as provided
11588 + * by Oracle in the LICENSE file that accompanied this code.
11590 + * This code is distributed in the hope that it will be useful, but WITHOUT
11591 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11592 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11593 + * version 2 for more details (a copy is included in the LICENSE file that
11594 + * accompanied this code).
11596 + * You should have received a copy of the GNU General Public License version
11597 + * 2 along with this work; if not, write to the Free Software Foundation,
11598 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
11600 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
11601 + * or visit www.oracle.com if you need additional information or have any
11606 +//#define USE_TRACE
11608 +#include "Ports.h"
11609 +#include "PLATFORM_API_SolarisOS_Utils.h"
11611 +#if USE_PORTS == TRUE
11613 +#define MONITOR_GAIN_STRING "Monitor Gain"
11615 +#define ALL_TARGET_PORT_COUNT 6
11617 +// Solaris audio defines
11618 +static int targetPorts[ALL_TARGET_PORT_COUNT] = {
11627 +static char* targetPortNames[ALL_TARGET_PORT_COUNT] = {
11636 +// defined in Ports.h
11637 +static int targetPortJavaSoundMapping[ALL_TARGET_PORT_COUNT] = {
11638 + PORT_DST_SPEAKER,
11639 + PORT_DST_HEADPHONE,
11640 + PORT_DST_LINE_OUT,
11641 + PORT_DST_UNKNOWN,
11642 + PORT_DST_UNKNOWN,
11643 + PORT_DST_UNKNOWN,
11646 +#define ALL_SOURCE_PORT_COUNT 7
11648 +// Solaris audio defines
11649 +static int sourcePorts[ALL_SOURCE_PORT_COUNT] = {
11650 + AUDIO_MICROPHONE,
11656 + AUDIO_CODEC_LOOPB_IN
11659 +static char* sourcePortNames[ALL_SOURCE_PORT_COUNT] = {
11662 + "Compact Disc In",
11666 + "Internal Loopback"
11669 +// Ports.h defines
11670 +static int sourcePortJavaSoundMapping[ALL_SOURCE_PORT_COUNT] = {
11671 + PORT_SRC_MICROPHONE,
11672 + PORT_SRC_LINE_IN,
11673 + PORT_SRC_COMPACT_DISC,
11674 + PORT_SRC_UNKNOWN,
11675 + PORT_SRC_UNKNOWN,
11676 + PORT_SRC_UNKNOWN,
11680 +struct tag_PortControlID;
11682 +typedef struct tag_PortInfo {
11683 + int fd; // file descriptor of the pseudo device
11684 + audio_info_t audioInfo;
11686 + int targetPortCount;
11687 + int sourcePortCount;
11688 + // indexes to sourcePorts/targetPorts
11689 + // contains first target ports, then source ports
11690 + int ports[ALL_TARGET_PORT_COUNT + ALL_SOURCE_PORT_COUNT];
11692 + int maxControlCount; // upper bound of number of controls
11693 + int usedControlIDs; // number of items already filled in controlIDs
11694 + struct tag_PortControlID* controlIDs; // the control IDs themselves
11697 +#define PORT_CONTROL_TYPE_PLAY 0x4000000
11698 +#define PORT_CONTROL_TYPE_RECORD 0x8000000
11699 +#define PORT_CONTROL_TYPE_SELECT_PORT 1
11700 +#define PORT_CONTROL_TYPE_GAIN 2
11701 +#define PORT_CONTROL_TYPE_BALANCE 3
11702 +#define PORT_CONTROL_TYPE_MONITOR_GAIN 10
11703 +#define PORT_CONTROL_TYPE_OUTPUT_MUTED 11
11704 +#define PORT_CONTROL_TYPE_PLAYRECORD_MASK PORT_CONTROL_TYPE_PLAY | PORT_CONTROL_TYPE_RECORD
11705 +#define PORT_CONTROL_TYPE_MASK 0xFFFFFF
11708 +typedef struct tag_PortControlID {
11709 + PortInfo* portInfo;
11710 + INT32 controlType; // PORT_CONTROL_TYPE_XX
11715 +///// implemented functions of Ports.h
11717 +INT32 PORT_GetPortMixerCount() {
11718 + return (INT32) getAudioDeviceCount();
11722 +INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
11723 + AudioDeviceDescription desc;
11725 + if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, TRUE)) {
11726 + strncpy(description->name, desc.name, PORT_STRING_LENGTH-1);
11727 + description->name[PORT_STRING_LENGTH-1] = 0;
11728 + strncpy(description->vendor, desc.vendor, PORT_STRING_LENGTH-1);
11729 + description->vendor[PORT_STRING_LENGTH-1] = 0;
11730 + strncpy(description->version, desc.version, PORT_STRING_LENGTH-1);
11731 + description->version[PORT_STRING_LENGTH-1] = 0;
11732 + /*strncpy(description->description, desc.description, PORT_STRING_LENGTH-1);*/
11733 + strncpy(description->description, "Solaris Ports", PORT_STRING_LENGTH-1);
11734 + description->description[PORT_STRING_LENGTH-1] = 0;
11741 +void* PORT_Open(INT32 mixerIndex) {
11742 + PortInfo* info = NULL;
11744 + AudioDeviceDescription desc;
11745 + int success = FALSE;
11747 + TRACE0("PORT_Open\n");
11748 + if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) {
11749 + fd = open(desc.pathctl, O_RDWR);
11752 + ERROR1("Couldn't open audio device ctl for device %d!\n", mixerIndex);
11756 + info = (PortInfo*) malloc(sizeof(PortInfo));
11757 + if (info != NULL) {
11758 + memset(info, 0, sizeof(PortInfo));
11766 + PORT_Close((void*) info);
11772 +void PORT_Close(void* id) {
11773 + TRACE0("PORT_Close\n");
11774 + if (id != NULL) {
11775 + PortInfo* info = (PortInfo*) id;
11776 + if (info->fd >= 0) {
11780 + if (info->controlIDs) {
11781 + free(info->controlIDs);
11782 + info->controlIDs = NULL;
11790 +INT32 PORT_GetPortCount(void* id) {
11792 + PortInfo* info = (PortInfo*) id;
11793 + if (info != NULL) {
11794 + if (!info->targetPortCount && !info->sourcePortCount) {
11796 + AUDIO_INITINFO(&info->audioInfo);
11797 + if (ioctl(info->fd, AUDIO_GETINFO, &info->audioInfo) >= 0) {
11798 + for (i = 0; i < ALL_TARGET_PORT_COUNT; i++) {
11799 + if (info->audioInfo.play.avail_ports & targetPorts[i]) {
11800 + info->ports[info->targetPortCount] = i;
11801 + info->targetPortCount++;
11803 + TRACE4("Target %d %s: avail=%d mod=%d\n", i, targetPortNames[i],
11804 + info->audioInfo.play.avail_ports & targetPorts[i],
11805 + info->audioInfo.play.mod_ports & targetPorts[i]);
11807 + for (i = 0; i < ALL_SOURCE_PORT_COUNT; i++) {
11808 + if (info->audioInfo.record.avail_ports & sourcePorts[i]) {
11809 + info->ports[info->targetPortCount + info->sourcePortCount] = i;
11810 + info->sourcePortCount++;
11812 + TRACE4("Source %d %s: avail=%d mod=%d\n", i, sourcePortNames[i],
11813 + info->audioInfo.record.avail_ports & sourcePorts[i],
11814 + info->audioInfo.record.mod_ports & sourcePorts[i]);
11818 + ret = info->targetPortCount + info->sourcePortCount;
11823 +int isSourcePort(PortInfo* info, INT32 portIndex) {
11824 + return (portIndex >= info->targetPortCount);
11827 +INT32 PORT_GetPortType(void* id, INT32 portIndex) {
11828 + PortInfo* info = (PortInfo*) id;
11829 + if ((portIndex >= 0) && (portIndex < PORT_GetPortCount(id))) {
11830 + if (isSourcePort(info, portIndex)) {
11831 + return sourcePortJavaSoundMapping[info->ports[portIndex]];
11833 + return targetPortJavaSoundMapping[info->ports[portIndex]];
11839 +// pre-condition: portIndex must have been verified!
11840 +char* getPortName(PortInfo* info, INT32 portIndex) {
11841 + char* ret = NULL;
11843 + if (isSourcePort(info, portIndex)) {
11844 + ret = sourcePortNames[info->ports[portIndex]];
11846 + ret = targetPortNames[info->ports[portIndex]];
11851 +INT32 PORT_GetPortName(void* id, INT32 portIndex, char* name, INT32 len) {
11852 + PortInfo* info = (PortInfo*) id;
11855 + if ((portIndex >= 0) && (portIndex < PORT_GetPortCount(id))) {
11856 + n = getPortName(info, portIndex);
11858 + strncpy(name, n, len-1);
11866 +void createPortControl(PortInfo* info, PortControlCreator* creator, INT32 portIndex,
11867 + INT32 type, void** controlObjects, int* controlCount) {
11868 + PortControlID* controlID;
11869 + void* newControl = NULL;
11870 + int controlIndex;
11871 + char* jsType = NULL;
11872 + int isBoolean = FALSE;
11874 + TRACE0(">createPortControl\n");
11876 + // fill the ControlID structure and add this control
11877 + if (info->usedControlIDs >= info->maxControlCount) {
11878 + ERROR1("not enough free controlIDs !! maxControlIDs = %d\n", info->maxControlCount);
11881 + controlID = &(info->controlIDs[info->usedControlIDs]);
11882 + controlID->portInfo = info;
11883 + controlID->controlType = type;
11884 + controlIndex = info->ports[portIndex];
11885 + if (isSourcePort(info, portIndex)) {
11886 + controlID->port = sourcePorts[controlIndex];
11888 + controlID->port = targetPorts[controlIndex];
11890 + switch (type & PORT_CONTROL_TYPE_MASK) {
11891 + case PORT_CONTROL_TYPE_SELECT_PORT:
11892 + jsType = CONTROL_TYPE_SELECT; isBoolean = TRUE; break;
11893 + case PORT_CONTROL_TYPE_GAIN:
11894 + jsType = CONTROL_TYPE_VOLUME; break;
11895 + case PORT_CONTROL_TYPE_BALANCE:
11896 + jsType = CONTROL_TYPE_BALANCE; break;
11897 + case PORT_CONTROL_TYPE_MONITOR_GAIN:
11898 + jsType = CONTROL_TYPE_VOLUME; break;
11899 + case PORT_CONTROL_TYPE_OUTPUT_MUTED:
11900 + jsType = CONTROL_TYPE_MUTE; isBoolean = TRUE; break;
11903 + TRACE0(" PORT_CONTROL_TYPE_BOOLEAN\n");
11904 + newControl = (creator->newBooleanControl)(creator, controlID, jsType);
11906 + else if (jsType == CONTROL_TYPE_BALANCE) {
11907 + TRACE0(" PORT_CONTROL_TYPE_BALANCE\n");
11908 + newControl = (creator->newFloatControl)(creator, controlID, jsType,
11909 + -1.0f, 1.0f, 2.0f / 65.0f, "");
11911 + TRACE0(" PORT_CONTROL_TYPE_FLOAT\n");
11912 + newControl = (creator->newFloatControl)(creator, controlID, jsType,
11913 + 0.0f, 1.0f, 1.0f / 256.0f, "");
11915 + if (newControl) {
11916 + controlObjects[*controlCount] = newControl;
11917 + (*controlCount)++;
11918 + info->usedControlIDs++;
11920 + TRACE0("<createPortControl\n");
11924 +void addCompoundControl(PortInfo* info, PortControlCreator* creator, char* name, void** controlObjects, int* controlCount) {
11925 + void* compControl;
11927 + TRACE1(">addCompoundControl %d controls\n", *controlCount);
11928 + if (*controlCount) {
11929 + // create compound control and add it to the vector
11930 + compControl = (creator->newCompoundControl)(creator, name, controlObjects, *controlCount);
11931 + if (compControl) {
11932 + TRACE1(" addCompoundControl: calling addControl %p\n", compControl);
11933 + (creator->addControl)(creator, compControl);
11935 + *controlCount = 0;
11937 + TRACE0("<addCompoundControl\n");
11940 +void addAllControls(PortInfo* info, PortControlCreator* creator, void** controlObjects, int* controlCount) {
11943 + TRACE0(">addAllControl\n");
11944 + // go through all controls and add them to the vector
11945 + for (i = 0; i < *controlCount; i++) {
11946 + (creator->addControl)(creator, controlObjects[i]);
11948 + *controlCount = 0;
11949 + TRACE0("<addAllControl\n");
11952 +void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator) {
11953 + PortInfo* info = (PortInfo*) id;
11954 + int portCount = PORT_GetPortCount(id);
11955 + void* controls[4];
11956 + int controlCount = 0;
11958 + int selectable = 1;
11959 + memset(controls, 0, sizeof(controls));
11961 + TRACE4(">PORT_GetControls(id=%p, portIndex=%d). controlIDs=%p, maxControlCount=%d\n",
11962 + id, portIndex, info->controlIDs, info->maxControlCount);
11963 + if ((portIndex >= 0) && (portIndex < portCount)) {
11964 + // if the memory isn't reserved for the control structures, allocate it
11965 + if (!info->controlIDs) {
11966 + int maxCount = 0;
11967 + TRACE0("getControl: allocate mem\n");
11968 + // get a maximum number of controls:
11969 + // each port has a select, balance, and volume control.
11970 + maxCount = 3 * portCount;
11971 + // then there is monitorGain and outputMuted
11972 + maxCount += (2 * info->targetPortCount);
11973 + info->maxControlCount = maxCount;
11974 + info->controlIDs = (PortControlID*) malloc(sizeof(PortControlID) * maxCount);
11976 + if (!isSourcePort(info, portIndex)) {
11977 + type = PORT_CONTROL_TYPE_PLAY;
11978 + // add master mute control
11979 + createPortControl(info, creator, portIndex,
11980 + type | PORT_CONTROL_TYPE_OUTPUT_MUTED,
11981 + controls, &controlCount);
11982 + addAllControls(info, creator, controls, &controlCount);
11983 + selectable = info->audioInfo.play.mod_ports & targetPorts[info->ports[portIndex]];
11985 + type = PORT_CONTROL_TYPE_RECORD;
11986 + selectable = info->audioInfo.record.mod_ports & sourcePorts[info->ports[portIndex]];
11988 + // add a mixer strip with volume, ...
11989 + createPortControl(info, creator, portIndex,
11990 + type | PORT_CONTROL_TYPE_GAIN,
11991 + controls, &controlCount);
11992 + // ... balance, ...
11993 + createPortControl(info, creator, portIndex,
11994 + type | PORT_CONTROL_TYPE_BALANCE,
11995 + controls, &controlCount);
11996 + // ... and select control (if not always on)...
11997 + if (selectable) {
11998 + createPortControl(info, creator, portIndex,
11999 + type | PORT_CONTROL_TYPE_SELECT_PORT,
12000 + controls, &controlCount);
12002 + // ... packaged in a compound control.
12003 + addCompoundControl(info, creator, getPortName(info, portIndex), controls, &controlCount);
12005 + if (type == PORT_CONTROL_TYPE_PLAY) {
12006 + // add a single strip for source ports with monitor gain
12007 + createPortControl(info, creator, portIndex,
12008 + type | PORT_CONTROL_TYPE_MONITOR_GAIN,
12009 + controls, &controlCount);
12010 + // also in a compound control
12011 + addCompoundControl(info, creator, MONITOR_GAIN_STRING, controls, &controlCount);
12014 + TRACE0("< PORT_getControls\n");
12017 +INT32 PORT_GetIntValue(void* controlIDV) {
12018 + PortControlID* controlID = (PortControlID*) controlIDV;
12019 + audio_info_t audioInfo;
12020 + audio_prinfo_t* prinfo;
12022 + AUDIO_INITINFO(&audioInfo);
12023 + if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) {
12024 + if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) {
12025 + prinfo = &(audioInfo.play);
12027 + prinfo = &(audioInfo.record);
12029 + switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) {
12030 + case PORT_CONTROL_TYPE_SELECT_PORT:
12031 + return (prinfo->port & controlID->port)?TRUE:FALSE;
12032 + case PORT_CONTROL_TYPE_OUTPUT_MUTED:
12033 + return (audioInfo.output_muted)?TRUE:FALSE;
12035 + ERROR1("PORT_GetIntValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK);
12038 + ERROR0("PORT_GetIntValue: Could not ioctl!\n");
12042 +void PORT_SetIntValue(void* controlIDV, INT32 value) {
12043 + PortControlID* controlID = (PortControlID*) controlIDV;
12044 + audio_info_t audioInfo;
12045 + audio_prinfo_t* prinfo;
12048 + if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) {
12049 + prinfo = &(audioInfo.play);
12051 + prinfo = &(audioInfo.record);
12053 + switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) {
12054 + case PORT_CONTROL_TYPE_SELECT_PORT:
12055 + // first try to just add this port. if that fails, set ONLY to this port.
12056 + AUDIO_INITINFO(&audioInfo);
12057 + if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) {
12059 + setPort = (prinfo->port | controlID->port);
12061 + setPort = (prinfo->port - controlID->port);
12063 + AUDIO_INITINFO(&audioInfo);
12064 + prinfo->port = setPort;
12065 + if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) {
12066 + // didn't work. Either this line doesn't support to select several
12067 + // ports at once (e.g. record), or a real error
12069 + // set to ONLY this port (and disable any other currently selected ports)
12070 + AUDIO_INITINFO(&audioInfo);
12071 + prinfo->port = controlID->port;
12072 + if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) {
12073 + ERROR2("Error setting output select port %d to port %d!\n", controlID->port, controlID->port);
12076 + // assume it's an error
12077 + ERROR2("Error setting output select port %d to port %d!\n", controlID->port, setPort);
12081 + case PORT_CONTROL_TYPE_OUTPUT_MUTED:
12082 + AUDIO_INITINFO(&audioInfo);
12083 + audioInfo.output_muted = (value?TRUE:FALSE);
12084 + if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) {
12085 + ERROR2("Error setting output muted on port %d to %d!\n", controlID->port, value);
12089 + ERROR1("PORT_SetIntValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK);
12094 +float PORT_GetFloatValue(void* controlIDV) {
12095 + PortControlID* controlID = (PortControlID*) controlIDV;
12096 + audio_info_t audioInfo;
12097 + audio_prinfo_t* prinfo;
12099 + AUDIO_INITINFO(&audioInfo);
12100 + if (ioctl(controlID->portInfo->fd, AUDIO_GETINFO, &audioInfo) >= 0) {
12101 + if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) {
12102 + prinfo = &(audioInfo.play);
12104 + prinfo = &(audioInfo.record);
12106 + switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) {
12107 + case PORT_CONTROL_TYPE_GAIN:
12108 + return ((float) (prinfo->gain - AUDIO_MIN_GAIN))
12109 + / ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN));
12110 + case PORT_CONTROL_TYPE_BALANCE:
12111 + return ((float) ((prinfo->balance - AUDIO_LEFT_BALANCE - AUDIO_MID_BALANCE) << 1))
12112 + / ((float) (AUDIO_RIGHT_BALANCE - AUDIO_LEFT_BALANCE));
12113 + case PORT_CONTROL_TYPE_MONITOR_GAIN:
12114 + return ((float) (audioInfo.monitor_gain - AUDIO_MIN_GAIN))
12115 + / ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN));
12117 + ERROR1("PORT_GetFloatValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK);
12120 + ERROR0("PORT_GetFloatValue: Could not ioctl!\n");
12124 +void PORT_SetFloatValue(void* controlIDV, float value) {
12125 + PortControlID* controlID = (PortControlID*) controlIDV;
12126 + audio_info_t audioInfo;
12127 + audio_prinfo_t* prinfo;
12129 + AUDIO_INITINFO(&audioInfo);
12131 + if (controlID->controlType & PORT_CONTROL_TYPE_PLAY) {
12132 + prinfo = &(audioInfo.play);
12134 + prinfo = &(audioInfo.record);
12136 + switch (controlID->controlType & PORT_CONTROL_TYPE_MASK) {
12137 + case PORT_CONTROL_TYPE_GAIN:
12138 + prinfo->gain = AUDIO_MIN_GAIN
12139 + + (int) ((value * ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN))) + 0.5f);
12141 + case PORT_CONTROL_TYPE_BALANCE:
12142 + prinfo->balance = AUDIO_LEFT_BALANCE + AUDIO_MID_BALANCE
12143 + + ((int) (value * ((float) ((AUDIO_RIGHT_BALANCE - AUDIO_LEFT_BALANCE) >> 1))) + 0.5f);
12145 + case PORT_CONTROL_TYPE_MONITOR_GAIN:
12146 + audioInfo.monitor_gain = AUDIO_MIN_GAIN
12147 + + (int) ((value * ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN))) + 0.5f);
12150 + ERROR1("PORT_SetFloatValue: Wrong type %d !\n", controlID->controlType & PORT_CONTROL_TYPE_MASK);
12153 + if (ioctl(controlID->portInfo->fd, AUDIO_SETINFO, &audioInfo) < 0) {
12154 + ERROR0("PORT_SetFloatValue: Could not ioctl!\n");
12158 +#endif // USE_PORTS
12159 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.c jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.c
12160 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.c 1970-01-01 01:00:00.000000000 +0100
12161 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.c 2024-12-29 15:20:25.121510507 +0100
12164 + * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
12165 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12167 + * This code is free software; you can redistribute it and/or modify it
12168 + * under the terms of the GNU General Public License version 2 only, as
12169 + * published by the Free Software Foundation. Oracle designates this
12170 + * particular file as subject to the "Classpath" exception as provided
12171 + * by Oracle in the LICENSE file that accompanied this code.
12173 + * This code is distributed in the hope that it will be useful, but WITHOUT
12174 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12175 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12176 + * version 2 for more details (a copy is included in the LICENSE file that
12177 + * accompanied this code).
12179 + * You should have received a copy of the GNU General Public License version
12180 + * 2 along with this work; if not, write to the Free Software Foundation,
12181 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
12183 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
12184 + * or visit www.oracle.com if you need additional information or have any
12191 +#include "PLATFORM_API_SolarisOS_Utils.h"
12193 +#define MAX_AUDIO_DEVICES 20
12195 +// not thread safe...
12196 +static AudioDevicePath globalADPaths[MAX_AUDIO_DEVICES];
12197 +static int globalADCount = -1;
12198 +static int globalADCacheTime = -1;
12199 +/* how many seconds do we cache devices */
12200 +#define AD_CACHE_TIME 30
12203 +long getTimeInSeconds() {
12204 + struct timeval tv;
12205 + gettimeofday(&tv, NULL);
12206 + return tv.tv_sec;
12210 +int getAudioDeviceCount() {
12211 + int count = MAX_AUDIO_DEVICES;
12213 + getAudioDevices(globalADPaths, &count);
12217 +/* returns TRUE if the path exists at all */
12218 +int addAudioDevice(char* path, AudioDevicePath* adPath, int* count) {
12221 + int fileExists = 0;
12222 + // not thread safe...
12223 + static struct stat statBuf;
12225 + // get stats on the file
12226 + if (stat(path, &statBuf) == 0) {
12229 + // If it is not yet in the adPath array, add it to the array
12230 + for (i = 0; i < *count; i++) {
12231 + if (adPath[i].st_ino == statBuf.st_ino
12232 + && adPath[i].st_dev == statBuf.st_dev) {
12238 + adPath[*count].st_ino = statBuf.st_ino;
12239 + adPath[*count].st_dev = statBuf.st_dev;
12240 + strncpy(adPath[*count].path, path, MAX_NAME_LENGTH);
12241 + adPath[*count].path[MAX_NAME_LENGTH - 1] = 0;
12243 + TRACE1("Added audio device %s\n", path);
12246 + return fileExists;
12250 +void getAudioDevices(AudioDevicePath* adPath, int* count) {
12251 + int maxCount = *count;
12253 + char devsound[15];
12255 + long timeInSeconds = getTimeInSeconds();
12257 + if (globalADCount < 0
12258 + || (getTimeInSeconds() - globalADCacheTime) > AD_CACHE_TIME
12259 + || (adPath != globalADPaths)) {
12261 + // first device, if set, is AUDIODEV variable
12262 + audiodev = getenv("AUDIODEV");
12263 + if (audiodev != NULL && audiodev[0] != 0) {
12264 + addAudioDevice(audiodev, adPath, count);
12266 + // then try /dev/audio
12267 + addAudioDevice("/dev/audio", adPath, count);
12268 + // then go through all of the /dev/sound/? devices
12269 + for (i = 0; i < 100; i++) {
12270 + sprintf(devsound, "/dev/sound/%d", i);
12271 + if (!addAudioDevice(devsound, adPath, count)) {
12275 + if (adPath == globalADPaths) {
12276 + /* commit cache */
12277 + globalADCount = *count;
12278 + /* set cache time */
12279 + globalADCacheTime = timeInSeconds;
12282 + /* return cache */
12283 + *count = globalADCount;
12288 +int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames) {
12289 + int count = MAX_AUDIO_DEVICES;
12292 + getAudioDevices(globalADPaths, &count);
12293 + if (index>=0 && index < count) {
12294 + ret = getAudioDeviceDescription(globalADPaths[index].path, adDesc, getNames);
12299 +int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames) {
12303 + audio_info_t info;
12304 + audio_device_t deviceInfo;
12306 + strncpy(adDesc->path, path, MAX_NAME_LENGTH);
12307 + adDesc->path[MAX_NAME_LENGTH] = 0;
12308 + strcpy(adDesc->pathctl, adDesc->path);
12309 + strcat(adDesc->pathctl, "ctl");
12310 + strcpy(adDesc->name, adDesc->path);
12311 + adDesc->vendor[0] = 0;
12312 + adDesc->version[0] = 0;
12313 + adDesc->description[0] = 0;
12314 + adDesc->maxSimulLines = 1;
12316 + // try to open the pseudo device and get more information
12317 + fd = open(adDesc->pathctl, O_WRONLY | O_NONBLOCK);
12321 + fd = open(adDesc->pathctl, O_RDONLY);
12323 + if (ioctl(fd, AUDIO_GETDEV, &deviceInfo) >= 0) {
12324 + strncpy(adDesc->vendor, deviceInfo.name, MAX_AUDIO_DEV_LEN);
12325 + adDesc->vendor[MAX_AUDIO_DEV_LEN] = 0;
12326 + strncpy(adDesc->version, deviceInfo.version, MAX_AUDIO_DEV_LEN);
12327 + adDesc->version[MAX_AUDIO_DEV_LEN] = 0;
12328 + /* add config string to the dev name
12329 + * creates a string like "/dev/audio (onboard1)"
12331 + len = strlen(adDesc->name) + 1;
12332 + if (MAX_NAME_LENGTH - len > 3) {
12333 + strcat(adDesc->name, " (");
12334 + strncat(adDesc->name, deviceInfo.config, MAX_NAME_LENGTH - len);
12335 + strcat(adDesc->name, ")");
12337 + adDesc->name[MAX_NAME_LENGTH-1] = 0;
12339 + if (ioctl(fd, AUDIO_MIXERCTL_GET_MODE, &mixerMode) >= 0) {
12340 + if (mixerMode == AM_MIXER_MODE) {
12341 + TRACE1(" getAudioDeviceDescription: %s is in mixer mode\n", adDesc->path);
12342 + adDesc->maxSimulLines = -1;
12345 + ERROR1("ioctl AUDIO_MIXERCTL_GET_MODE failed on %s!\n", adDesc->path);
12349 + ERROR1("could not open %s!\n", adDesc->pathctl);
12356 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h
12357 --- jdk24u-jdk-24-29.orig/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h 1970-01-01 01:00:00.000000000 +0100
12358 +++ jdk24u-jdk-24-29/src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h 2024-12-29 15:20:25.121752513 +0100
12361 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
12362 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12364 + * This code is free software; you can redistribute it and/or modify it
12365 + * under the terms of the GNU General Public License version 2 only, as
12366 + * published by the Free Software Foundation. Oracle designates this
12367 + * particular file as subject to the "Classpath" exception as provided
12368 + * by Oracle in the LICENSE file that accompanied this code.
12370 + * This code is distributed in the hope that it will be useful, but WITHOUT
12371 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12372 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12373 + * version 2 for more details (a copy is included in the LICENSE file that
12374 + * accompanied this code).
12376 + * You should have received a copy of the GNU General Public License version
12377 + * 2 along with this work; if not, write to the Free Software Foundation,
12378 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
12380 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
12381 + * or visit www.oracle.com if you need additional information or have any
12385 +#include <Utilities.h>
12386 +#include <string.h>
12387 +#include <stdlib.h>
12388 +#include <fcntl.h>
12389 +#include <sys/audio.h>
12390 +#include <sys/mixer.h>
12391 +#include <sys/types.h>
12393 +#include <stropts.h>
12395 +#include <sys/conf.h>
12396 +#include <sys/stat.h>
12397 +#include <unistd.h>
12399 +#ifndef PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED
12400 +#define PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED
12402 +/* input from Codec inter. loopback */
12403 +#ifndef AUDIO_CODEC_LOOPB_IN
12404 +#define AUDIO_CODEC_LOOPB_IN (0x40)
12408 +#define MAX_NAME_LENGTH 300
12410 +typedef struct tag_AudioDevicePath {
12411 + char path[MAX_NAME_LENGTH];
12412 + ino_t st_ino; // inode number to detect duplicate devices
12413 + dev_t st_dev; // device ID to detect duplicate audio devices
12414 +} AudioDevicePath;
12416 +typedef struct tag_AudioDeviceDescription {
12417 + INT32 maxSimulLines;
12418 + char path[MAX_NAME_LENGTH+1];
12419 + char pathctl[MAX_NAME_LENGTH+4];
12420 + char name[MAX_NAME_LENGTH+1];
12421 + char vendor[MAX_NAME_LENGTH+1];
12422 + char version[MAX_NAME_LENGTH+1];
12423 + char description[MAX_NAME_LENGTH+1];
12424 +} AudioDeviceDescription;
12426 +int getAudioDeviceCount();
12429 + * adPath is an array of AudioDevicePath structures
12430 + * count contains initially the number of elements in adPath
12431 + * and will be set to the returned number of paths.
12433 +void getAudioDevices(AudioDevicePath* adPath, int* count);
12436 + * fills adDesc from the audio device given in path
12437 + * returns 0 if an error occurred
12438 + * if getNames is 0, only path and pathctl are filled
12440 +int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames);
12441 +int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames);
12444 +#endif // PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED
12445 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/awt/X11FontManager.java jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/awt/X11FontManager.java
12446 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/awt/X11FontManager.java 2024-12-29 15:19:42.646205165 +0100
12447 +++ jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/awt/X11FontManager.java 2024-12-29 15:20:25.091714810 +0100
12448 @@ -686,7 +686,8 @@
12449 * and do the best we can.
12451 FontConfiguration mFontConfig = new MFontConfiguration(this);
12452 - if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile())) {
12453 + if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
12454 + (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) {
12455 FcFontConfiguration fcFontConfig =
12456 new FcFontConfiguration(this);
12457 if (fcFontConfig.init()) {
12458 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java
12459 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java 2024-12-29 15:19:42.640121915 +0100
12460 +++ jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java 2024-12-29 15:20:25.092292020 +0100
12463 protected void initReorderMap() {
12464 reorderMap = new HashMap<>();
12465 + if (osName == null) { /* null means SunOS */
12466 + initReorderMapForSolaris();
12468 + initReorderMapForLinux();
12472 + private void initReorderMapForSolaris() {
12473 + /* Don't create a no-op entry, so we can optimize this case
12474 + * i.e. we don't need to do anything so can avoid slower paths in
12477 +// reorderMap.put("UTF-8", "latin-1");
12478 + reorderMap.put("UTF-8.hi", "devanagari"); // NB is in Lucida.
12479 + reorderMap.put("UTF-8.ja",
12480 + new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"});
12481 + reorderMap.put("UTF-8.ko", "korean-johab");
12482 + reorderMap.put("UTF-8.th", "thai");
12483 + reorderMap.put("UTF-8.zh.TW", "chinese-big5");
12484 + reorderMap.put("UTF-8.zh.HK", new String[] {"chinese-big5", "chinese-hkscs"});
12485 + reorderMap.put("UTF-8.zh.CN",
12486 + new String[] {"chinese-gb18030-0", "chinese-gb18030-1"});
12487 + reorderMap.put("UTF-8.zh",
12488 + new String[] {"chinese-big5", "chinese-hkscs", "chinese-gb18030-0,chinese-gb18030-1"});
12489 + reorderMap.put("Big5", "chinese-big5");
12490 + reorderMap.put("Big5-HKSCS", new String[] {"chinese-big5", "chinese-hkscs"});
12491 + reorderMap.put("GB2312", new String[] {"chinese-gbk", "chinese-gb2312"});
12492 + reorderMap.put("x-EUC-TW",
12493 + new String[] {"chinese-cns11643-1", "chinese-cns11643-2", "chinese-cns11643-3"});
12494 + reorderMap.put("GBK", "chinese-gbk");
12495 + reorderMap.put("GB18030",new String[] {"chinese-gb18030-0", "chinese-gb18030-1"});
12497 + reorderMap.put("TIS-620", "thai");
12498 + reorderMap.put("x-PCK",
12499 + new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"});
12500 + reorderMap.put("x-eucJP-Open",
12501 + new String[] {"japanese-x0201", "japanese-x0208", "japanese-x0212"});
12502 + reorderMap.put("EUC-KR", "korean");
12503 + /* Don't create a no-op entry, so we can optimize this case */
12504 +// reorderMap.put("ISO-8859-1", "latin-1");
12505 + reorderMap.put("ISO-8859-2", "latin-2");
12506 + reorderMap.put("ISO-8859-5", "cyrillic-iso8859-5");
12507 + reorderMap.put("windows-1251", "cyrillic-cp1251");
12508 + reorderMap.put("KOI8-R", "cyrillic-koi8-r");
12509 + reorderMap.put("ISO-8859-6", "arabic");
12510 + reorderMap.put("ISO-8859-7", "greek");
12511 + reorderMap.put("ISO-8859-8", "hebrew");
12512 + reorderMap.put("ISO-8859-9", "latin-5");
12513 + reorderMap.put("ISO-8859-13", "latin-7");
12514 + reorderMap.put("ISO-8859-15", "latin-9");
12517 + private void initReorderMapForLinux() {
12518 reorderMap.put("UTF-8.ja.JP", "japanese-iso10646");
12519 reorderMap.put("UTF-8.ko.KR", "korean-iso10646");
12520 reorderMap.put("UTF-8.zh.TW", "chinese-tw-iso10646");
12521 @@ -78,7 +130,12 @@
12522 reorderMap.put("GB2312", "chinese-gb18030");
12523 reorderMap.put("Big5", "chinese-big5");
12524 reorderMap.put("EUC-KR", "korean");
12525 - reorderMap.put("GB18030", "chinese-gb18030");
12526 + if (osName.equals("Sun")){
12527 + reorderMap.put("GB18030", "chinese-cn-iso10646");
12530 + reorderMap.put("GB18030", "chinese-gb18030");
12535 @@ -87,7 +144,10 @@
12536 protected void setOsNameAndVersion(){
12537 super.setOsNameAndVersion();
12539 - if (osName.equals("Linux")) {
12540 + if (osName.equals("SunOS")) {
12541 + //don't care os name on Solaris
12543 + } else if (osName.equals("Linux")) {
12546 if ((f = new File("/etc/fedora-release")).canRead()) {
12547 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
12548 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java 2024-12-29 15:19:42.677705067 +0100
12549 +++ jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java 2024-12-29 15:20:25.092927803 +0100
12550 @@ -139,6 +139,10 @@
12551 return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
12554 + static boolean isSysV() {
12555 + return OSInfo.getOSType() == OSInfo.OSType.SOLARIS;
12558 static boolean isLinux() {
12559 return OSInfo.getOSType() == OSInfo.OSType.LINUX;
12561 @@ -281,7 +285,7 @@
12566 + if (isMac() || isSysV()) {
12567 printers = getAllPrinterNamesSysV();
12568 } else if (isAIX()) {
12569 printers = getAllPrinterNamesAIX();
12570 @@ -465,7 +469,7 @@
12572 /* fallback if nothing not having a printer at this point */
12573 PrintService printer = null;
12575 + if (isMac() || isSysV()) {
12576 printer = getNamedPrinterNameSysV(name);
12577 } else if (isAIX()) {
12578 printer = getNamedPrinterNameAIX(name);
12579 @@ -620,7 +624,7 @@
12580 psuri = printerInfo[1];
12584 + if (isMac() || isSysV()) {
12585 defaultPrinter = getDefaultPrinterNameSysV();
12586 } else if (isAIX()) {
12587 defaultPrinter = getDefaultPrinterNameAIX();
12588 @@ -839,7 +843,7 @@
12589 ArrayList<String> results = null;
12591 final String[] cmd = new String[3];
12593 + if (isSysV() || isAIX()) {
12594 cmd[0] = "/usr/bin/sh";
12596 cmd[2] = "env LC_ALL=C " + command;
12597 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
12598 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java 2024-12-29 15:19:42.676481495 +0100
12599 +++ jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java 2024-12-29 15:20:25.093408737 +0100
12600 @@ -853,25 +853,51 @@
12601 isAttributeCategorySupported(JobSheets.class)) {
12604 - execCmd = new String[ncomps];
12605 - execCmd[n++] = "/usr/bin/lpr";
12606 - if ((pFlags & PRINTER) != 0) {
12607 - execCmd[n++] = "-P" + printer;
12609 - if ((pFlags & JOBTITLE) != 0) {
12610 - execCmd[n++] = "-J " + jobTitle;
12612 - if ((pFlags & COPIES) != 0) {
12613 - execCmd[n++] = "-#" + copies;
12615 - if ((pFlags & NOSHEET) != 0) {
12616 - execCmd[n++] = "-h";
12617 - } else if (getPrintService().
12618 - isAttributeCategorySupported(JobSheets.class)) {
12619 - execCmd[n++] = "-o job-sheets=standard";
12621 - if ((pFlags & OPTIONS) != 0) {
12622 - execCmd[n++] = "-o" + options;
12623 + if (PrintServiceLookupProvider.isSysV()) {
12624 + ncomps+=1; // lp uses 1 more arg than lpr (make a copy)
12625 + execCmd = new String[ncomps];
12626 + execCmd[n++] = "/usr/bin/lp";
12627 + execCmd[n++] = "-c"; // make a copy of the spool file
12628 + if ((pFlags & PRINTER) != 0) {
12629 + execCmd[n++] = "-d" + printer;
12631 + if ((pFlags & JOBTITLE) != 0) {
12632 + String quoteChar = "\"";
12633 + execCmd[n++] = "-t " + quoteChar+jobTitle+quoteChar;
12635 + if ((pFlags & COPIES) != 0) {
12636 + execCmd[n++] = "-n " + copies;
12638 + if ((pFlags & NOSHEET) != 0) {
12639 + execCmd[n++] = "-o nobanner";
12640 + } else if (getPrintService().
12641 + isAttributeCategorySupported(JobSheets.class)) {
12642 + execCmd[n++] = "-o job-sheets=standard";
12644 + if ((pFlags & OPTIONS) != 0) {
12645 + execCmd[n++] = "-o " + options;
12648 + execCmd = new String[ncomps];
12649 + execCmd[n++] = "/usr/bin/lpr";
12650 + if ((pFlags & PRINTER) != 0) {
12651 + execCmd[n++] = "-P" + printer;
12653 + if ((pFlags & JOBTITLE) != 0) {
12654 + execCmd[n++] = "-J " + jobTitle;
12656 + if ((pFlags & COPIES) != 0) {
12657 + execCmd[n++] = "-#" + copies;
12659 + if ((pFlags & NOSHEET) != 0) {
12660 + execCmd[n++] = "-h";
12661 + } else if (getPrintService().
12662 + isAttributeCategorySupported(JobSheets.class)) {
12663 + execCmd[n++] = "-o job-sheets=standard";
12665 + if ((pFlags & OPTIONS) != 0) {
12666 + execCmd[n++] = "-o" + options;
12669 execCmd[n++] = spoolFile;
12670 if (IPPPrintService.debugPrint) {
12671 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/UnixPrintService.java jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
12672 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/classes/sun/print/UnixPrintService.java 2024-12-29 15:19:42.677405072 +0100
12673 +++ jdk24u-jdk-24-29/src/java.desktop/unix/classes/sun/print/UnixPrintService.java 2024-12-29 15:20:25.094074563 +0100
12674 @@ -218,6 +218,31 @@
12678 + private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsSysV() {
12679 + String command = "/usr/bin/lpstat -a " + printer;
12680 + String[] results= PrintServiceLookupProvider.execCmd(command);
12682 + if (results != null && results.length > 0) {
12683 + if (results[0].startsWith(printer + " accepting requests")) {
12684 + return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
12686 + else if (results[0].startsWith(printer)) {
12687 + /* As well as "myprinter accepting requests", look for
12688 + * "myprinter@somehost accepting requests".
12690 + int index = printer.length();
12691 + String str = results[0];
12692 + if (str.length() > index &&
12693 + str.charAt(index) == '@' &&
12694 + str.indexOf(" accepting requests", index) > 0 &&
12695 + str.indexOf(" not accepting requests", index) == -1) {
12696 + return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
12700 + return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS ;
12703 private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsBSD() {
12704 if (PrintServiceLookupProvider.cmdIndex ==
12705 PrintServiceLookupProvider.UNINITIALIZED) {
12706 @@ -295,7 +320,9 @@
12709 private PrinterIsAcceptingJobs getPrinterIsAcceptingJobs() {
12710 - if (PrintServiceLookupProvider.isBSD()) {
12711 + if (PrintServiceLookupProvider.isSysV()) {
12712 + return getPrinterIsAcceptingJobsSysV();
12713 + } else if (PrintServiceLookupProvider.isBSD()) {
12714 return getPrinterIsAcceptingJobsBSD();
12715 } else if (PrintServiceLookupProvider.isAIX()) {
12716 return getPrinterIsAcceptingJobsAIX();
12717 @@ -322,6 +349,14 @@
12721 + private QueuedJobCount getQueuedJobCountSysV() {
12722 + String command = "/usr/bin/lpstat -R " + printer;
12723 + String[] results= PrintServiceLookupProvider.execCmd(command);
12724 + int qlen = (results == null) ? 0 : results.length;
12726 + return new QueuedJobCount(qlen);
12729 private QueuedJobCount getQueuedJobCountBSD() {
12730 if (PrintServiceLookupProvider.cmdIndex ==
12731 PrintServiceLookupProvider.UNINITIALIZED) {
12732 @@ -378,7 +413,9 @@
12735 private QueuedJobCount getQueuedJobCount() {
12736 - if (PrintServiceLookupProvider.isBSD()) {
12737 + if (PrintServiceLookupProvider.isSysV()) {
12738 + return getQueuedJobCountSysV();
12739 + } else if (PrintServiceLookupProvider.isBSD()) {
12740 return getQueuedJobCountBSD();
12741 } else if (PrintServiceLookupProvider.isAIX()) {
12742 return getQueuedJobCountAIX();
12743 @@ -387,6 +424,13 @@
12747 + private PrintServiceAttributeSet getSysVServiceAttributes() {
12748 + PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
12749 + attrs.add(getQueuedJobCountSysV());
12750 + attrs.add(getPrinterIsAcceptingJobsSysV());
12754 private PrintServiceAttributeSet getBSDServiceAttributes() {
12755 PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
12756 attrs.add(getQueuedJobCountBSD());
12757 @@ -420,7 +464,9 @@
12760 private PrintServiceAttributeSet getDynamicAttributes() {
12761 - if (PrintServiceLookupProvider.isAIX()) {
12762 + if (PrintServiceLookupProvider.isSysV()) {
12763 + return getSysVServiceAttributes();
12764 + } else if (PrintServiceLookupProvider.isAIX()) {
12765 return getAIXServiceAttributes();
12767 return getBSDServiceAttributes();
12768 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/common/awt/fontpath.c jdk24u-jdk-24-29/src/java.desktop/unix/native/common/awt/fontpath.c
12769 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/common/awt/fontpath.c 2024-12-29 15:19:42.588808284 +0100
12770 +++ jdk24u-jdk-24-29/src/java.desktop/unix/native/common/awt/fontpath.c 2024-12-29 15:20:25.094669487 +0100
12773 #define MAXFDIRS 512 /* Max number of directories that contain fonts */
12775 -#if defined( __linux__)
12776 +#if defined(__solaris__)
12777 +/* These are well known Solaris 11 or illumos X11 directories.
12779 +static char *fullSolarisFontPath[] = {
12780 + "/usr/share/fonts/TrueType",
12781 + "/usr/share/fonts/X11/Type1",
12782 + NULL, /* terminates the list */
12785 +#elif defined( __linux__)
12786 /* All the known interesting locations we have discovered on
12787 * various flavors of Linux
12789 @@ -321,6 +330,8 @@
12791 #if defined(__linux__)
12792 knowndirs = fullLinuxFontPath;
12793 +#elif defined(__solaris__)
12794 + knowndirs = fullSolarisFontPath;
12795 #elif defined(_AIX)
12796 knowndirs = fullAixFontPath;
12798 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c jdk24u-jdk-24-29/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
12799 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c 2024-12-29 15:19:42.625116865 +0100
12800 +++ jdk24u-jdk-24-29/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c 2024-12-29 15:20:25.095274814 +0100
12801 @@ -401,7 +401,12 @@
12802 xrenderLibHandle = dlopen("libXrender.so", RTLD_LAZY | RTLD_GLOBAL);
12806 +#if defined(__solaris__)
12807 + if (xrenderLibHandle == NULL) {
12808 + xrenderLibHandle = dlopen("libXrender.so.1",
12809 + RTLD_LAZY | RTLD_GLOBAL);
12811 +#elif defined(_AIX)
12812 if (xrenderLibHandle == NULL) {
12813 xrenderLibHandle = dlopen("libXrender.a(libXrender.so.0)",
12814 RTLD_MEMBER | RTLD_LAZY | RTLD_GLOBAL);
12815 diff -Nru jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c jdk24u-jdk-24-29/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
12816 --- jdk24u-jdk-24-29.orig/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c 2024-12-29 15:19:42.620754450 +0100
12817 +++ jdk24u-jdk-24-29/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c 2024-12-29 15:20:25.096307209 +0100
12822 +#if defined(__solaris__)
12823 +/* Solaris 10 will not have these symbols at compile time */
12825 +typedef Picture (*XRenderCreateLinearGradientFuncType)
12827 + const XLinearGradient *gradient,
12828 + const XFixed *stops,
12829 + const XRenderColor *colors,
12832 +typedef Picture (*XRenderCreateRadialGradientFuncType)
12834 + const XRadialGradient *gradient,
12835 + const XFixed *stops,
12836 + const XRenderColor *colors,
12840 +XRenderCreateLinearGradientFuncType XRenderCreateLinearGradientFunc = NULL;
12842 + XRenderCreateRadialGradientFuncType XRenderCreateRadialGradientFunc = NULL;
12845 #define BUILD_TRANSFORM_MATRIX(TRANSFORM, M00, M01, M02, M10, M11, M12) \
12847 TRANSFORM.matrix[0][0] = M00; \
12848 @@ -128,6 +151,27 @@
12850 available = JNI_FALSE;
12852 +#elif defined(__solaris__)
12853 + xrenderlib = dlopen("libXrender.so",RTLD_GLOBAL|RTLD_LAZY);
12854 + if (xrenderlib != NULL) {
12856 + XRenderCreateLinearGradientFunc =
12857 + (XRenderCreateLinearGradientFuncType)
12858 + dlsym(xrenderlib, "XRenderCreateLinearGradient");
12860 + XRenderCreateRadialGradientFunc =
12861 + (XRenderCreateRadialGradientFuncType)
12862 + dlsym(xrenderlib, "XRenderCreateRadialGradient");
12864 + if (XRenderCreateLinearGradientFunc == NULL ||
12865 + XRenderCreateRadialGradientFunc == NULL)
12867 + available = JNI_FALSE;
12869 + dlclose(xrenderlib);
12871 + available = JNI_FALSE;
12875 jboolean versionInfoIsFound = JNI_FALSE;
12876 @@ -534,7 +578,13 @@
12877 colors[i].green = pixels[i*4 + 2];
12878 colors[i].blue = pixels[i*4 + 3];
12880 +#ifdef __solaris__
12881 + if (XRenderCreateLinearGradientFunc!=NULL) {
12882 + gradient = (*XRenderCreateLinearGradientFunc)(awt_display, &grad, stops, colors, numStops);
12885 gradient = XRenderCreateLinearGradient(awt_display, &grad, stops, colors, numStops);
12890 @@ -612,7 +662,13 @@
12891 colors[i].green = pixels[i*4 + 2];
12892 colors[i].blue = pixels[i*4 + 3];
12894 +#ifdef __solaris__
12895 + if (XRenderCreateRadialGradientFunc != NULL) {
12896 + gradient = (jint) (*XRenderCreateRadialGradientFunc)(awt_display, &grad, stops, colors, numStops);
12899 gradient = (jint) XRenderCreateRadialGradient(awt_display, &grad, stops, colors, numStops);
12904 diff -Nru jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
12905 --- jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2024-12-29 15:19:46.169330391 +0100
12906 +++ jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java 2024-12-29 15:20:25.096818744 +0100
12908 String defaultLib = System.getProperty("sun.security.jgss.lib");
12909 if (defaultLib == null || defaultLib.trim().equals("")) {
12910 gssLibs = switch (OperatingSystem.current()) {
12911 + case SOLARIS -> new String[]{
12914 case LINUX -> new String[]{
12916 "libgssapi_krb5.so",
12917 diff -Nru jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/krb5/Config.java jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
12918 --- jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/krb5/Config.java 2024-12-29 15:19:46.180332170 +0100
12919 +++ jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/krb5/Config.java 2024-12-29 15:20:25.097408576 +0100
12920 @@ -905,6 +905,8 @@
12921 if (name == null) {
12922 name = "c:\\winnt\\krb5.ini";
12924 + } else if (OperatingSystem.isSolaris()) {
12925 + name = "/etc/krb5/krb5.conf";
12926 } else if (OperatingSystem.isMacOS()) {
12927 name = findMacosConfigFile();
12929 diff -Nru jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java
12930 --- jdk24u-jdk-24-29.orig/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java 2024-12-29 15:19:46.190234042 +0100
12931 +++ jdk24u-jdk-24-29/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java 2024-12-29 15:20:25.097918030 +0100
12932 @@ -106,7 +106,7 @@
12934 private static long uid;
12936 - // Available on Linux and Mac. Otherwise, -1 and no _euid suffix
12937 + // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
12938 uid = jdk.internal.misc.VM.geteuid();
12941 diff -Nru jdk24u-jdk-24-29.orig/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java jdk24u-jdk-24-29/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
12942 --- jdk24u-jdk-24-29.orig/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 2024-12-29 15:19:45.838526413 +0100
12943 +++ jdk24u-jdk-24-29/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 2024-12-29 15:20:25.098432578 +0100
12947 if ("64".equals(System.getProperty("sun.arch.data.model"))) {
12948 - // assume Linux convention
12949 - libDir = "lib64";
12950 + if ("SunOS".equals(System.getProperty("os.name"))) {
12951 + libDir = "lib/64";
12953 + // assume Linux convention
12954 + libDir = "lib64";
12959 diff -Nru jdk24u-jdk-24-29.orig/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java jdk24u-jdk-24-29/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java
12960 --- jdk24u-jdk-24-29.orig/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2024-12-29 15:19:45.512876468 +0100
12961 +++ jdk24u-jdk-24-29/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java 2024-12-29 15:20:25.098958971 +0100
12962 @@ -33,12 +33,21 @@
12963 private static final int KB = 1024;
12964 private static int BUFFER_SIZE = 4 * KB;
12967 + // Set a larger buffer size for Solaris
12968 + final String osName = System.getProperty("os.name");
12969 + if (osName.equalsIgnoreCase("solaris")) {
12970 + BUFFER_SIZE = 32 * KB;
12974 private Writer _writer;
12977 * Initializes a WriterOutputBuffer by creating an instance of a
12978 * BufferedWriter. The size of the buffer in this writer may have
12979 - * a significant impact on throughput.
12980 + * a significant impact on throughput. Solaris prefers a larger
12981 + * buffer, while Linux works better with a smaller one.
12983 public WriterOutputBuffer(Writer writer) {
12984 _writer = new BufferedWriter(writer, BUFFER_SIZE);
12985 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/classes/sun/tools/attach/AttachProviderImpl.java jdk24u-jdk-24-29/src/jdk.attach/solaris/classes/sun/tools/attach/AttachProviderImpl.java
12986 --- jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/classes/sun/tools/attach/AttachProviderImpl.java 1970-01-01 01:00:00.000000000 +0100
12987 +++ jdk24u-jdk-24-29/src/jdk.attach/solaris/classes/sun/tools/attach/AttachProviderImpl.java 2024-12-29 15:20:25.122224133 +0100
12990 + * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
12991 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12993 + * This code is free software; you can redistribute it and/or modify it
12994 + * under the terms of the GNU General Public License version 2 only, as
12995 + * published by the Free Software Foundation. Oracle designates this
12996 + * particular file as subject to the "Classpath" exception as provided
12997 + * by Oracle in the LICENSE file that accompanied this code.
12999 + * This code is distributed in the hope that it will be useful, but WITHOUT
13000 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13001 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13002 + * version 2 for more details (a copy is included in the LICENSE file that
13003 + * accompanied this code).
13005 + * You should have received a copy of the GNU General Public License version
13006 + * 2 along with this work; if not, write to the Free Software Foundation,
13007 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13009 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13010 + * or visit www.oracle.com if you need additional information or have any
13013 +package sun.tools.attach;
13015 +import com.sun.tools.attach.VirtualMachine;
13016 +import com.sun.tools.attach.VirtualMachineDescriptor;
13017 +import com.sun.tools.attach.AttachNotSupportedException;
13018 +import java.io.IOException;
13021 + * An AttachProvider implementation for Solaris that use the doors
13022 + * interface to the VM.
13024 +public class AttachProviderImpl extends HotSpotAttachProvider {
13026 + public AttachProviderImpl() {
13029 + public String name() {
13033 + public String type() {
13037 + public VirtualMachine attachVirtualMachine(String vmid)
13038 + throws AttachNotSupportedException, IOException
13040 + // AttachNotSupportedException will be thrown if the target VM can be determined
13041 + // to be not attachable.
13042 + testAttachable(vmid);
13044 + return new VirtualMachineImpl(this, vmid);
13047 + public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
13048 + throws AttachNotSupportedException, IOException
13050 + if (vmd.provider() != this) {
13051 + throw new AttachNotSupportedException("provider mismatch");
13053 + // To avoid re-checking if the VM if attachable, we check if the descriptor
13054 + // is for a hotspot VM - these descriptors are created by the listVirtualMachines
13055 + // implementation which only returns a list of attachable VMs.
13056 + if (vmd instanceof HotSpotVirtualMachineDescriptor) {
13057 + assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
13058 + return new VirtualMachineImpl(this, vmd.id());
13060 + return attachVirtualMachine(vmd.id());
13065 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java jdk24u-jdk-24-29/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java
13066 --- jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java 1970-01-01 01:00:00.000000000 +0100
13067 +++ jdk24u-jdk-24-29/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java 2024-12-29 15:20:25.122559787 +0100
13070 + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
13071 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13073 + * This code is free software; you can redistribute it and/or modify it
13074 + * under the terms of the GNU General Public License version 2 only, as
13075 + * published by the Free Software Foundation. Oracle designates this
13076 + * particular file as subject to the "Classpath" exception as provided
13077 + * by Oracle in the LICENSE file that accompanied this code.
13079 + * This code is distributed in the hope that it will be useful, but WITHOUT
13080 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13081 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13082 + * version 2 for more details (a copy is included in the LICENSE file that
13083 + * accompanied this code).
13085 + * You should have received a copy of the GNU General Public License version
13086 + * 2 along with this work; if not, write to the Free Software Foundation,
13087 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13089 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13090 + * or visit www.oracle.com if you need additional information or have any
13093 +package sun.tools.attach;
13095 +import com.sun.tools.attach.AttachOperationFailedException;
13096 +import com.sun.tools.attach.AgentLoadException;
13097 +import com.sun.tools.attach.AttachNotSupportedException;
13098 +import com.sun.tools.attach.spi.AttachProvider;
13100 +import java.io.InputStream;
13101 +import java.io.IOException;
13102 +import java.io.File;
13103 +import java.io.FileNotFoundException;
13106 + * Solaris implementation of HotSpotVirtualMachine.
13108 +@SuppressWarnings("restricted")
13109 +public class VirtualMachineImpl extends HotSpotVirtualMachine {
13110 + // "/tmp" is used as a global well-known location for the files
13111 + // .java_pid<pid>. and .attach_pid<pid>. It is important that this
13112 + // location is the same for all processes, otherwise the tools
13113 + // will not be able to find all Hotspot processes.
13114 + // Any changes to this needs to be synchronized with HotSpot.
13115 + private static final String tmpdir = "/tmp";
13117 + // door descriptor;
13118 + private int fd = -1;
13119 + String socket_path;
13122 + * Attaches to the target VM
13124 + VirtualMachineImpl(AttachProvider provider, String vmid)
13125 + throws AttachNotSupportedException, IOException
13127 + super(provider, vmid);
13128 + // This provider only understands process-ids (pids).
13131 + pid = Integer.parseInt(vmid);
13133 + throw new NumberFormatException();
13135 + } catch (NumberFormatException x) {
13136 + throw new AttachNotSupportedException("Invalid process identifier: " + vmid);
13139 + // Opens the door file to the target VM. If the file is not
13140 + // found it might mean that the attach mechanism isn't started in the
13141 + // target VM so we attempt to start it and retry.
13143 + fd = openDoor(pid);
13144 + } catch (FileNotFoundException fnf1) {
13145 + File f = createAttachFile(pid);
13149 + // give the target VM time to start the attach mechanism
13150 + final int delay_step = 100;
13151 + final long timeout = attachTimeout();
13152 + long time_spend = 0;
13155 + // Increase timeout on each attempt to reduce polling
13156 + delay += delay_step;
13158 + Thread.sleep(delay);
13159 + } catch (InterruptedException x) { }
13161 + fd = openDoor(pid);
13162 + } catch (FileNotFoundException fnf2) {
13166 + time_spend += delay;
13167 + if (time_spend > timeout/2 && fd == -1) {
13168 + // Send QUIT again to give target VM the last chance to react
13171 + } while (time_spend <= timeout && fd == -1);
13173 + throw new AttachNotSupportedException(
13174 + String.format("Unable to open door %s: " +
13175 + "target process %d doesn't respond within %dms " +
13176 + "or HotSpot VM not loaded", socket_path, pid, time_spend));
13186 + * Detach from the target VM
13188 + public void detach() throws IOException {
13189 + synchronized (this) {
13198 + * Execute the given command in the target VM.
13200 + InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
13201 + assert args.length <= 3; // includes null
13203 + // first check that we are still attached
13205 + synchronized (this) {
13207 + throw new IOException("Detached from target VM");
13212 + // enqueue the command via a door call
13213 + int s = enqueue(door, cmd, args);
13214 + assert s >= 0; // valid file descriptor
13216 + // The door call returns a file descriptor (one end of a socket pair).
13217 + // Create an input stream around it.
13218 + SocketInputStream sis = new SocketInputStream(s);
13220 + // Read the command completion status
13221 + int completionStatus;
13223 + completionStatus = readInt(sis);
13224 + } catch (IOException ioe) {
13229 + // If non-0 it means an error but we need to special-case the
13230 + // "load" command to ensure that the right exception is thrown.
13231 + if (completionStatus != 0) {
13232 + // read from the stream and use that as the error message
13233 + String message = readMessage(sis);
13235 + if (cmd.equals("load")) {
13236 + String msg = "Failed to load agent library";
13237 + if (!message.isEmpty())
13238 + msg += ": " + message;
13239 + throw new AgentLoadException(msg);
13241 + if (message.isEmpty())
13242 + message = "Command failed in target VM";
13243 + throw new AttachOperationFailedException(message);
13247 + // Return the input stream so that the command output can be read
13251 + // InputStream over a socket
13252 + private class SocketInputStream extends InputStream {
13255 + public SocketInputStream(int s) {
13259 + public synchronized int read() throws IOException {
13260 + byte b[] = new byte[1];
13261 + int n = this.read(b, 0, 1);
13263 + return b[0] & 0xff;
13269 + public synchronized int read(byte[] bs, int off, int len) throws IOException {
13270 + if ((off < 0) || (off > bs.length) || (len < 0) ||
13271 + ((off + len) > bs.length) || ((off + len) < 0)) {
13272 + throw new IndexOutOfBoundsException();
13273 + } else if (len == 0)
13276 + return VirtualMachineImpl.read(s, bs, off, len);
13279 + public synchronized void close() throws IOException {
13283 + VirtualMachineImpl.close(toClose);
13288 + // The door is attached to .java_pid<pid> in the temporary directory.
13289 + private int openDoor(int pid) throws IOException {
13290 + socket_path = tmpdir + "/.java_pid" + pid;
13291 + fd = open(socket_path);
13293 + // Check that the file owner/permission to avoid attaching to
13296 + checkPermissions(socket_path);
13297 + } catch (IOException ioe) {
13304 + // On Solaris a simple handshake is used to start the attach mechanism
13305 + // if not already started. The client creates a .attach_pid<pid> file in the
13306 + // target VM's working directory (or temporary directory), and the SIGQUIT
13307 + // handler checks for the file.
13308 + private File createAttachFile(int pid) throws IOException {
13309 + String fn = ".attach_pid" + pid;
13310 + String path = "/proc/" + pid + "/cwd/" + fn;
13311 + File f = new File(path);
13313 + f = f.getCanonicalFile();
13314 + f.createNewFile();
13315 + } catch (IOException x) {
13316 + f = new File(tmpdir, fn);
13317 + f.createNewFile();
13322 + //-- native methods
13324 + static native int open(String path) throws IOException;
13326 + static native void close(int fd) throws IOException;
13328 + static native int read(int fd, byte buf[], int off, int buflen) throws IOException;
13330 + static native void checkPermissions(String path) throws IOException;
13332 + static native void sigquit(int pid) throws IOException;
13334 + // enqueue a command (and arguments) to the given door
13335 + static native int enqueue(int fd, String cmd, Object ... args)
13336 + throws IOException;
13339 + System.loadLibrary("attach");
13342 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c jdk24u-jdk-24-29/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c
13343 --- jdk24u-jdk-24-29.orig/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c 1970-01-01 01:00:00.000000000 +0100
13344 +++ jdk24u-jdk-24-29/src/jdk.attach/solaris/native/libattach/VirtualMachineImpl.c 2024-12-29 15:20:25.123043618 +0100
13347 + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
13348 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13350 + * This code is free software; you can redistribute it and/or modify it
13351 + * under the terms of the GNU General Public License version 2 only, as
13352 + * published by the Free Software Foundation. Oracle designates this
13353 + * particular file as subject to the "Classpath" exception as provided
13354 + * by Oracle in the LICENSE file that accompanied this code.
13356 + * This code is distributed in the hope that it will be useful, but WITHOUT
13357 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13358 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13359 + * version 2 for more details (a copy is included in the LICENSE file that
13360 + * accompanied this code).
13362 + * You should have received a copy of the GNU General Public License version
13363 + * 2 along with this work; if not, write to the Free Software Foundation,
13364 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13366 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13367 + * or visit www.oracle.com if you need additional information or have any
13371 +#include "jni_util.h"
13373 +#include <sys/stat.h>
13374 +#include <sys/types.h>
13376 +#include <errno.h>
13377 +#include <fcntl.h>
13378 +#include <limits.h>
13379 +#include <signal.h>
13380 +#include <stdlib.h>
13381 +#include <string.h>
13382 +#include <unistd.h>
13384 +#include "sun_tools_attach_VirtualMachineImpl.h"
13386 +#define ROOT_UID 0
13388 +#define RESTARTABLE(_cmd, _result) do { \
13390 + _result = _cmd; \
13391 + } while((_result == -1) && (errno == EINTR)); \
13395 + * Declare library specific JNI_Onload entry if static build
13397 +DEF_STATIC_JNI_OnLoad
13400 + * Class: sun_tools_attach_VirtualMachineImpl
13402 + * Signature: (Ljava/lang/String;)I
13404 +JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_open
13405 + (JNIEnv *env, jclass cls, jstring path)
13408 + const char* p = GetStringPlatformChars(env, path, &isCopy);
13415 + fd = open(p, O_RDWR);
13421 + JNU_ReleaseStringPlatformChars(env, path, p);
13425 + if (err == ENOENT) {
13426 + JNU_ThrowByName(env, "java/io/FileNotFoundException", NULL);
13428 + char* msg = strdup(strerror(err));
13429 + JNU_ThrowIOException(env, msg);
13430 + if (msg != NULL) {
13440 + * Class: sun_tools_attach_VirtualMachineImpl
13441 + * Method: checkPermissions
13442 + * Signature: (Ljava/lang/String;)V
13444 +JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
13445 + (JNIEnv *env, jclass cls, jstring path)
13448 + const char* p = GetStringPlatformChars(env, path, &isCopy);
13450 + struct stat64 sb;
13454 + memset(&sb, 0, sizeof(struct stat64));
13457 + * Check that the path is owned by the effective uid/gid of this
13458 + * process. Also check that group/other access is not allowed.
13463 + res = stat64(p, &sb);
13471 + jboolean isError = JNI_FALSE;
13472 + if (sb.st_uid != uid && uid != ROOT_UID) {
13473 + snprintf(msg, sizeof(msg),
13474 + "file should be owned by the current user (which is %d) but is owned by %d", uid, sb.st_uid);
13475 + isError = JNI_TRUE;
13476 + } else if (sb.st_gid != gid && uid != ROOT_UID) {
13477 + snprintf(msg, sizeof(msg),
13478 + "file's group should be the current group (which is %d) but the group is %d", gid, sb.st_gid);
13479 + isError = JNI_TRUE;
13480 + } else if ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) != 0) {
13481 + snprintf(msg, sizeof(msg),
13482 + "file should only be readable and writable by the owner but has 0%03o access", sb.st_mode & 0777);
13483 + isError = JNI_TRUE;
13487 + snprintf(buf, sizeof(buf), "well-known file %s is not secure: %s", p, msg);
13488 + JNU_ThrowIOException(env, buf);
13491 + char* msg = strdup(strerror(res));
13492 + JNU_ThrowIOException(env, msg);
13493 + if (msg != NULL) {
13499 + JNU_ReleaseStringPlatformChars(env, path, p);
13505 + * Class: sun_tools_attach_VirtualMachineImpl
13507 + * Signature: (I)V
13509 +JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
13510 + (JNIEnv *env, jclass cls, jint fd)
13513 + RESTARTABLE(close(fd), ret);
13517 + * Class: sun_tools_attach_VirtualMachineImpl
13519 + * Signature: (I[BI)I
13521 +JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_read
13522 + (JNIEnv *env, jclass cls, jint fd, jbyteArray ba, jint off, jint baLen)
13524 + unsigned char buf[128];
13525 + size_t len = sizeof(buf);
13528 + size_t remaining = (size_t)(baLen - off);
13529 + if (len > remaining) {
13533 + RESTARTABLE(read(fd, buf, len), n);
13535 + JNU_ThrowIOExceptionWithLastError(env, "read");
13540 + (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
13547 + * Class: sun_tools_attach_VirtualMachineImpl
13548 + * Method: sigquit
13549 + * Signature: (I)V
13551 +JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sigquit
13552 + (JNIEnv *env, jclass cls, jint pid)
13554 + if (kill((pid_t)pid, SIGQUIT) == -1) {
13555 + JNU_ThrowIOExceptionWithLastError(env, "kill");
13560 + * A simple table to translate some known errors into reasonable
13566 +} const error_messages[] = {
13567 + { 100, "Bad request" },
13568 + { 101, "Protocol mismatch" },
13569 + { 102, "Resource failure" },
13570 + { 103, "Internal error" },
13571 + { 104, "Permission denied" },
13575 + * Lookup the given error code and return the appropriate
13576 + * message. If not found return NULL.
13578 +static const char* translate_error(jint err) {
13579 + int table_size = sizeof(error_messages) / sizeof(error_messages[0]);
13582 + for (i = 0; i < table_size; i++) {
13583 + if (err == error_messages[i].err) {
13584 + return error_messages[i].msg;
13591 + * Current protocol version
13593 +static const char* PROTOCOL_VERSION = "1";
13596 + * Class: sun_tools_attach_VirtualMachineImpl
13597 + * Method: enqueue
13598 + * Signature: (JILjava/lang/String;[Ljava/lang/Object;)V
13600 +JNIEXPORT jint JNICALL Java_sun_tools_attach_VirtualMachineImpl_enqueue
13601 + (JNIEnv *env, jclass cls, jint fd, jstring cmd, jobjectArray args)
13603 + jint arg_count, i;
13606 + door_arg_t door_args;
13607 + char res_buffer[128];
13608 + jint result = -1;
13610 + const char* cstr;
13614 + * First we get the command string and create the start of the
13615 + * argument string to send to the target VM:
13618 + cstr = JNU_GetStringPlatformChars(env, cmd, &isCopy);
13619 + if (cstr == NULL) {
13620 + return -1; /* pending exception */
13622 + size = strlen(PROTOCOL_VERSION) + strlen(cstr) + 2;
13623 + buf = (char*)malloc(size);
13624 + if (buf != NULL) {
13626 + strcpy(buf, PROTOCOL_VERSION);
13627 + pos += strlen(PROTOCOL_VERSION)+1;
13628 + strcpy(pos, cstr);
13631 + JNU_ReleaseStringPlatformChars(env, cmd, cstr);
13633 + if (buf == NULL) {
13634 + JNU_ThrowOutOfMemoryError(env, "malloc failed");
13639 + * Next we iterate over the arguments and extend the buffer
13640 + * to include them.
13642 + arg_count = (*env)->GetArrayLength(env, args);
13644 + for (i = 0; i < arg_count; i++) {
13645 + jobject obj = (*env)->GetObjectArrayElement(env, args, i);
13646 + if (obj != NULL) {
13647 + cstr = JNU_GetStringPlatformChars(env, obj, &isCopy);
13648 + if (cstr != NULL) {
13649 + size_t len = strlen(cstr);
13650 + char* newbuf = (char*)realloc(buf, size+len+1);
13651 + if (newbuf != NULL) {
13653 + strcpy(buf+size, cstr);
13657 + JNU_ReleaseStringPlatformChars(env, obj, cstr);
13659 + if (newbuf == NULL) {
13661 + JNU_ThrowOutOfMemoryError(env, "realloc failed");
13666 + char* newbuf = (char*)realloc(buf, size + 1);
13667 + if (newbuf == NULL) {
13669 + JNU_ThrowOutOfMemoryError(env, "realloc failed");
13675 + if ((*env)->ExceptionOccurred(env)) {
13682 + * The arguments to the door function are in 'buf' so we now
13683 + * do the door call
13685 + door_args.data_ptr = buf;
13686 + door_args.data_size = size;
13687 + door_args.desc_ptr = NULL;
13688 + door_args.desc_num = 0;
13689 + door_args.rbuf = (char*)&res_buffer;
13690 + door_args.rsize = sizeof(res_buffer);
13692 + RESTARTABLE(door_call(fd, &door_args), rc);
13695 + * door_call failed
13698 + JNU_ThrowIOExceptionWithLastError(env, "door_call");
13701 + * door_call succeeded but the call didn't return the expected jint.
13703 + if (door_args.data_size < sizeof(jint)) {
13704 + JNU_ThrowIOException(env, "Enqueue error - reason unknown as result is truncated!");
13706 + jint* res = (jint*)(door_args.data_ptr);
13707 + if (*res != JNI_OK) {
13708 + const char* msg = translate_error(*res);
13710 + if (msg == NULL) {
13711 + sprintf(buf, "Unable to enqueue command to target VM: %d", *res);
13713 + sprintf(buf, "Unable to enqueue command to target VM: %s", msg);
13715 + JNU_ThrowIOException(env, buf);
13718 + * The door call should return a file descriptor to one end of
13721 + if ((door_args.desc_ptr != NULL) &&
13722 + (door_args.desc_num == 1) &&
13723 + (door_args.desc_ptr->d_attributes & DOOR_DESCRIPTOR)) {
13724 + result = door_args.desc_ptr->d_data.d_desc.d_descriptor;
13726 + JNU_ThrowIOException(env, "Reply from enqueue missing descriptor!");
13735 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java jdk24u-jdk-24-29/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java
13736 --- jdk24u-jdk-24-29.orig/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java 2024-12-29 15:19:41.090597839 +0100
13737 +++ jdk24u-jdk-24-29/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java 2024-12-29 15:20:25.099518367 +0100
13739 private static class Decoder extends CharsetDecoder {
13741 private static final String SJISName = getSJISName();
13742 - private static final String EUCJPName = "EUC_JP";
13743 + private static final String EUCJPName = getEUCJPName();
13744 private DelegatableDecoder detectedDecoder = null;
13746 public Decoder(Charset cs) {
13747 @@ -223,11 +223,24 @@
13748 * Returned Shift_JIS Charset name is OS dependent
13750 private static String getSJISName() {
13751 - if (OperatingSystem.isWindows())
13752 + if (OperatingSystem.isSolaris())
13754 + else if (OperatingSystem.isWindows())
13755 return("windows-31J");
13757 return("Shift_JIS");
13761 + * Returned EUC-JP Charset name is OS dependent
13764 + private static String getEUCJPName() {
13765 + if (OperatingSystem.isSolaris())
13766 + return("x-eucjp-open");
13768 + return("EUC_JP");
13773 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java jdk24u-jdk-24-29/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java
13774 --- jdk24u-jdk-24-29.orig/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java 2024-12-29 15:19:41.101019690 +0100
13775 +++ jdk24u-jdk-24-29/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java 2024-12-29 15:20:25.100100492 +0100
13776 @@ -725,10 +725,10 @@
13778 int i = lib.indexOf("/$ISA/");
13780 - // replace "/$ISA/" with "/"
13781 + // replace "/$ISA/" with "/amd64/" on Solaris AMD64.
13782 String prefix = lib.substring(0, i);
13783 String suffix = lib.substring(i + 5);
13784 - lib = prefix + suffix;
13785 + lib = prefix + "/amd64" + suffix;
13788 System.out.println(keyword + ": " + lib);
13789 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg jdk24u-jdk-24-29/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg
13790 --- jdk24u-jdk-24-29.orig/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg 1970-01-01 01:00:00.000000000 +0100
13791 +++ jdk24u-jdk-24-29/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg 2024-12-29 15:20:25.123411243 +0100
13794 +# Configuration file to allow the SunPKCS11 provider to utilize
13795 +# the Solaris Cryptographic Framework, if it is available
13800 +description = SunPKCS11 accessing Solaris Cryptographic Framework
13802 +library = /usr/lib/$ISA/libpkcs11.so
13804 +handleStartupErrors = ignoreAll
13806 +# Use the X9.63 encoding for EC points (do not wrap in an ASN.1 OctetString).
13807 +useEcX963Encoding = true
13809 +attributes = compatibility
13811 +disabledMechanisms = {
13812 + CKM_DSA_KEY_PAIR_GEN
13816 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java
13817 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java 1970-01-01 01:00:00.000000000 +0100
13818 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotSolarisVtblAccess.java 2024-12-29 15:20:25.123693838 +0100
13821 + * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
13822 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13824 + * This code is free software; you can redistribute it and/or modify it
13825 + * under the terms of the GNU General Public License version 2 only, as
13826 + * published by the Free Software Foundation.
13828 + * This code is distributed in the hope that it will be useful, but WITHOUT
13829 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13830 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13831 + * version 2 for more details (a copy is included in the LICENSE file that
13832 + * accompanied this code).
13834 + * You should have received a copy of the GNU General Public License version
13835 + * 2 along with this work; if not, write to the Free Software Foundation,
13836 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13838 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13839 + * or visit www.oracle.com if you need additional information or have any
13844 +package sun.jvm.hotspot;
13846 +import java.util.*;
13847 +import sun.jvm.hotspot.debugger.*;
13848 +import sun.jvm.hotspot.types.*;
13849 +import sun.jvm.hotspot.types.basic.*;
13851 +/** This class implements the compiler-specific access to the vtbl for
13852 + a given C++ type. */
13853 +public class HotSpotSolarisVtblAccess extends BasicVtblAccess {
13855 + public HotSpotSolarisVtblAccess(SymbolLookup symbolLookup,
13856 + String[] jvmLibNames) {
13857 + super(symbolLookup, jvmLibNames);
13860 + protected String vtblSymbolForType(Type type) {
13861 + String demangledSymbol = type.getName() + "::__vtbl";
13862 + return mangle(demangledSymbol);
13865 + //--------------------------------------------------------------------------------
13866 + // Internals only below this point
13869 + private String mangle(String symbol) {
13870 + String[] parts = symbol.split("::");
13871 + StringBuffer mangled = new StringBuffer("__1c");
13872 + for (int i = 0; i < parts.length; i++) {
13873 + int len = parts[i].length();
13875 + mangled.append((char)('a' + (len / 26)));
13878 + mangled.append((char)('A' + len));
13879 + mangled.append(parts[i]);
13881 + mangled.append("_");
13882 + return mangled.toString();
13885 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/solaris_amd64/SolarisAMD64JavaThreadPDAccess.java jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/solaris_amd64/SolarisAMD64JavaThreadPDAccess.java
13886 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/solaris_amd64/SolarisAMD64JavaThreadPDAccess.java 1970-01-01 01:00:00.000000000 +0100
13887 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/solaris_amd64/SolarisAMD64JavaThreadPDAccess.java 2024-12-29 15:20:25.124062932 +0100
13890 + * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
13891 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13893 + * This code is free software; you can redistribute it and/or modify it
13894 + * under the terms of the GNU General Public License version 2 only, as
13895 + * published by the Free Software Foundation.
13897 + * This code is distributed in the hope that it will be useful, but WITHOUT
13898 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13899 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13900 + * version 2 for more details (a copy is included in the LICENSE file that
13901 + * accompanied this code).
13903 + * You should have received a copy of the GNU General Public License version
13904 + * 2 along with this work; if not, write to the Free Software Foundation,
13905 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13907 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13908 + * or visit www.oracle.com if you need additional information or have any
13913 +package sun.jvm.hotspot.runtime.solaris_amd64;
13916 +import java.util.*;
13917 +import sun.jvm.hotspot.debugger.*;
13918 +import sun.jvm.hotspot.debugger.amd64.*;
13919 +import sun.jvm.hotspot.runtime.*;
13920 +import sun.jvm.hotspot.runtime.amd64.*;
13921 +import sun.jvm.hotspot.runtime.x86.*;
13922 +import sun.jvm.hotspot.types.*;
13923 +import sun.jvm.hotspot.utilities.*;
13924 +import sun.jvm.hotspot.utilities.Observable;
13925 +import sun.jvm.hotspot.utilities.Observer;
13927 +public class SolarisAMD64JavaThreadPDAccess implements JavaThreadPDAccess {
13928 + private static AddressField lastJavaFPField;
13929 + private static AddressField osThreadField;
13930 + private static AddressField baseOfStackPointerField;
13932 + // Field from OSThread
13933 + private static CIntegerField osThreadThreadIDField;
13935 + // This is currently unneeded but is being kept in case we change
13936 + // the currentFrameGuess algorithm
13937 + private static final long GUESS_SCAN_RANGE = 128 * 1024;
13941 + VM.registerVMInitializedObserver(new Observer() {
13942 + public void update(Observable o, Object data) {
13943 + initialize(VM.getVM().getTypeDataBase());
13948 + private static synchronized void initialize(TypeDataBase db) {
13949 + Type type = db.lookupType("JavaThread");
13950 + Type anchorType = db.lookupType("JavaFrameAnchor");
13952 + lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
13953 + osThreadField = type.getAddressField("_osthread");
13955 + type = db.lookupType("OSThread");
13956 + osThreadThreadIDField = type.getCIntegerField("_thread_id");
13959 + public Address getLastJavaFP(Address addr) {
13960 + return lastJavaFPField.getValue(addr.addOffsetTo(sun.jvm.hotspot.runtime.JavaThread.getAnchorField().getOffset()));
13963 + public Address getLastJavaPC(Address addr) {
13967 + public Address getBaseOfStackPointer(Address addr) {
13971 + public Frame getLastFramePD(JavaThread thread, Address addr) {
13972 + Address fp = thread.getLastJavaFP();
13973 + if (fp == null) {
13974 + return null; // no information
13976 + Address pc = thread.getLastJavaPC();
13977 + if ( pc != null ) {
13978 + return new X86Frame(thread.getLastJavaSP(), fp, pc);
13980 + return new X86Frame(thread.getLastJavaSP(), fp);
13984 + public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) {
13985 + return new X86RegisterMap(thread, updateMap);
13988 + public Frame getCurrentFrameGuess(JavaThread thread, Address addr) {
13989 + ThreadProxy t = getThreadProxy(addr);
13990 + AMD64ThreadContext context = (AMD64ThreadContext) t.getContext();
13991 + AMD64CurrentFrameGuess guesser = new AMD64CurrentFrameGuess(context, thread);
13992 + if (!guesser.run(GUESS_SCAN_RANGE)) {
13995 + if (guesser.getPC() == null) {
13996 + return new X86Frame(guesser.getSP(), guesser.getFP());
13998 + return new X86Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
14003 + public void printThreadIDOn(Address addr, PrintStream tty) {
14004 + tty.print(getThreadProxy(addr));
14008 + public void printInfoOn(Address threadAddr, PrintStream tty) {
14011 + public Address getLastSP(Address addr) {
14012 + ThreadProxy t = getThreadProxy(addr);
14013 + AMD64ThreadContext context = (AMD64ThreadContext) t.getContext();
14014 + return context.getRegisterAsAddress(AMD64ThreadContext.RSP);
14017 + public ThreadProxy getThreadProxy(Address addr) {
14018 + // Fetch the OSThread (for now and for simplicity, not making a
14019 + // separate "OSThread" class in this package)
14020 + Address osThreadAddr = osThreadField.getValue(addr);
14021 + // Get the address of the thread ID from the OSThread
14022 + Address tidAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
14024 + JVMDebugger debugger = VM.getVM().getDebugger();
14025 + return debugger.getThreadForIdentifierAddress(tidAddr);
14029 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java
14030 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java 2024-12-29 15:19:45.001712118 +0100
14031 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java 2024-12-29 15:20:25.100710945 +0100
14034 import sun.jvm.hotspot.debugger.*;
14035 import sun.jvm.hotspot.types.*;
14036 +import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess;
14037 import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
14038 import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess;
14039 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
14043 // FIXME: find the platform specific PD class by reflection?
14044 - if (os.equals("win32")) {
14045 + if (os.equals("solaris")) {
14046 + access = new SolarisAMD64JavaThreadPDAccess();
14047 + } else if (os.equals("win32")) {
14048 if (cpu.equals("amd64")) {
14049 access = new Win32AMD64JavaThreadPDAccess();
14050 } else if (cpu.equals("aarch64")) {
14051 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java
14052 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2024-12-29 15:19:44.942933939 +0100
14053 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2024-12-29 15:20:25.101150548 +0100
14054 @@ -28,10 +28,14 @@
14057 public class PlatformInfo {
14058 - /* Returns "win32" if Windows; "linux" if Linux. */
14059 + /* Returns "solaris" if on Solaris; "win32" if Windows; "linux" if
14060 + Linux. Used to determine location of dbx and import module, or
14061 + possible debugger agent on win32. */
14062 public static String getOS() throws UnsupportedPlatformException {
14063 String os = System.getProperty("os.name");
14064 - if (os.equals("Linux")) {
14065 + if (os.equals("SunOS")) {
14066 + return "solaris";
14067 + } else if (os.equals("Linux")) {
14069 } else if (os.equals("FreeBSD")) {
14071 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c
14072 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c 2024-12-29 15:19:45.051639500 +0100
14073 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c 2024-12-29 15:20:25.101599352 +0100
14078 +#include <jni.h> // just include something, or else solaris compiler will complain that this file is empty
14080 #if defined(LINUX) || defined(__APPLE__)
14081 #include <unistd.h>
14083 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/test/libproc/libproctest.sh jdk24u-jdk-24-29/src/jdk.hotspot.agent/test/libproc/libproctest.sh
14084 --- jdk24u-jdk-24-29.orig/src/jdk.hotspot.agent/test/libproc/libproctest.sh 2024-12-29 15:19:45.055781742 +0100
14085 +++ jdk24u-jdk-24-29/src/jdk.hotspot.agent/test/libproc/libproctest.sh 2024-12-29 15:20:25.101991056 +0100
14090 +OPTIONS="-Djava.library.path=$STARTDIR/../src/os/solaris/proc/`uname -p`:$STARTDIR/../solaris/`uname -p`"
14092 # run libproc client
14093 -$SA_JAVA -showversion -cp $STARTDIR/../../build/classes::$STARTDIR/../sa.jar:$STARTDIR LibprocClient x core.$pid
14094 +$SA_JAVA -showversion ${OPTIONS} -cp $STARTDIR/../../build/classes::$STARTDIR/../sa.jar:$STARTDIR LibprocClient x core.$pid
14098 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c jdk24u-jdk-24-29/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c
14099 --- jdk24u-jdk-24-29.orig/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c 2024-12-29 15:19:43.782615561 +0100
14100 +++ jdk24u-jdk-24-29/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c 2024-12-29 15:20:25.102510036 +0100
14103 #include <string.h>
14104 #include <sys/time.h>
14105 +#ifdef __solaris__
14106 +#include <thread.h>
14108 #include <pthread.h>
14112 #include "socket_md.h"
14113 #include "sysSocket.h"
14114 @@ -271,6 +275,35 @@
14118 +#ifdef __solaris__
14120 +dbgsysTlsAlloc() {
14122 + if (thr_keycreate(&tk, NULL)) {
14123 + perror("thr_keycreate");
14130 +dbgsysTlsFree(int index) {
14135 +dbgsysTlsPut(int index, void *value) {
14136 + thr_setspecific((thread_key_t)index, value) ;
14140 +dbgsysTlsGet(int index) {
14142 + thr_getspecific((thread_key_t)index, &r);
14150 @@ -296,6 +329,8 @@
14151 return pthread_getspecific((pthread_key_t)index);
14157 dbgsysCurrentTimeMillis() {
14159 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c jdk24u-jdk-24-29/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c
14160 --- jdk24u-jdk-24-29.orig/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c 1970-01-01 01:00:00.000000000 +0100
14161 +++ jdk24u-jdk-24-29/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c 2024-12-29 15:20:25.124493431 +0100
14164 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
14165 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14167 + * This code is free software; you can redistribute it and/or modify it
14168 + * under the terms of the GNU General Public License version 2 only, as
14169 + * published by the Free Software Foundation. Oracle designates this
14170 + * particular file as subject to the "Classpath" exception as provided
14171 + * by Oracle in the LICENSE file that accompanied this code.
14173 + * This code is distributed in the hope that it will be useful, but WITHOUT
14174 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14175 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14176 + * version 2 for more details (a copy is included in the LICENSE file that
14177 + * accompanied this code).
14179 + * You should have received a copy of the GNU General Public License version
14180 + * 2 along with this work; if not, write to the Free Software Foundation,
14181 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
14183 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
14184 + * or visit www.oracle.com if you need additional information or have any
14188 +#include <fcntl.h>
14189 +#include <kstat.h>
14190 +#include <procfs.h>
14191 +#include <unistd.h>
14192 +#include <stdlib.h>
14193 +#include <stdio.h>
14194 +#include <string.h>
14195 +#include <sys/sysinfo.h>
14196 +#include <sys/lwp.h>
14197 +#include <pthread.h>
14198 +#include <utmpx.h>
14199 +#include <dlfcn.h>
14200 +#include <sys/loadavg.h>
14203 +#include "com_sun_management_internal_OperatingSystemImpl.h"
14207 + uint64_t last_idle;
14208 + uint64_t last_total;
14209 + double last_ratio;
14212 +static cpuload_t *cpu_loads = NULL;
14213 +static unsigned int num_cpus;
14214 +static kstat_ctl_t *kstat_ctrl = NULL;
14216 +static void map_cpu_kstat_counters() {
14220 + // Get number of CPU(s)
14221 + if ((num_cpus = sysconf(_SC_NPROCESSORS_ONLN)) == -1) {
14225 + // Data structure for saving CPU load
14226 + if ((cpu_loads = calloc(num_cpus,sizeof(cpuload_t))) == NULL) {
14230 + // Get kstat cpu_stat counters for every CPU
14231 + // (loop over kstat to find our cpu_stat(s)
14233 + for (kstat = kstat_ctrl->kc_chain; kstat != NULL; kstat = kstat->ks_next) {
14234 + if (strncmp(kstat->ks_module, "cpu_stat", 8) == 0) {
14236 + if (kstat_read(kstat_ctrl, kstat, NULL) == -1) {
14237 + // Failed to initialize kstat for this CPU so ignore it
14241 + if (i == num_cpus) {
14242 + // Found more cpu_stats than reported CPUs
14246 + cpu_loads[i++].kstat = kstat;
14251 +static int init_cpu_kstat_counters() {
14252 + static int initialized = 0;
14254 + // Concurrence in this method is prevented by the lock in
14255 + // the calling method get_cpu_load();
14256 + if(!initialized) {
14257 + if ((kstat_ctrl = kstat_open()) != NULL) {
14258 + map_cpu_kstat_counters();
14262 + return initialized ? 0 : -1;
14265 +static void update_cpu_kstat_counters() {
14266 + if(kstat_chain_update(kstat_ctrl) != 0) {
14268 + map_cpu_kstat_counters();
14272 +int read_cpustat(cpuload_t *load, cpu_stat_t *cpu_stat) {
14273 + if (load->kstat == NULL) {
14277 + if (kstat_read(kstat_ctrl, load->kstat, cpu_stat) == -1) {
14278 + // disabling for now, a kstat chain update is likely to happen next time
14279 + load->kstat = NULL;
14285 +double get_single_cpu_load(unsigned int n) {
14287 + cpu_stat_t cpu_stat;
14290 + uint64_t c_total;
14292 + uint64_t d_total;
14295 + if (n >= num_cpus) {
14299 + load = &cpu_loads[n];
14300 + if (read_cpustat(load, &cpu_stat) < 0) {
14304 + usage = cpu_stat.cpu_sysinfo.cpu;
14305 + c_idle = usage[CPU_IDLE];
14307 + for (c_total = 0, i = 0; i < CPU_STATES; i++) {
14308 + c_total += usage[i];
14311 + // Calculate diff against previous snapshot
14312 + d_idle = c_idle - load->last_idle;
14313 + d_total = c_total - load->last_total;
14315 + /** update if weve moved */
14316 + if (d_total > 0) {
14317 + // Save current values for next time around
14318 + load->last_idle = c_idle;
14319 + load->last_total = c_total;
14320 + load->last_ratio = (double) (d_total - d_idle) / d_total;
14323 + return load->last_ratio;
14326 +int get_info(const char *path, void *info, size_t s, off_t o) {
14329 + if ((fd = open(path, O_RDONLY)) < 0) {
14332 + if (pread(fd, info, s, o) != s) {
14339 +#define MIN(a, b) ((a < b) ? a : b)
14341 +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
14344 + * Return the cpu load (0-1) for proc number 'which' (or average all if which == -1)
14346 +double get_cpu_load(int which) {
14349 + pthread_mutex_lock(&lock);
14350 + if(init_cpu_kstat_counters()==0) {
14352 + update_cpu_kstat_counters();
14354 + if (which == -1) {
14358 + for (t = .0, i = 0; i < num_cpus; i++) {
14359 + t += get_single_cpu_load(i);
14362 + // Cap total systemload to 1.0
14363 + load = MIN((t / num_cpus), 1.0);
14365 + load = MIN(get_single_cpu_load(which), 1.0);
14370 + pthread_mutex_unlock(&lock);
14376 + * Return the cpu load (0-1) for the current process (i.e the JVM)
14377 + * or -1.0 if the get_info() call failed
14379 +double get_process_load(void) {
14382 + // Get the percentage of "recent cpu usage" from all the lwp:s in the JVM:s
14383 + // process. This is returned as a value between 0.0 and 1.0 multiplied by 0x8000.
14384 + if (get_info("/proc/self/psinfo",&info.pr_pctcpu, sizeof(info.pr_pctcpu), offsetof(psinfo_t, pr_pctcpu)) == 0) {
14385 + return (double) info.pr_pctcpu / 0x8000;
14390 +JNIEXPORT jdouble JNICALL
14391 +Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0
14392 +(JNIEnv *env, jobject dummy)
14394 + return get_cpu_load(-1);
14397 +JNIEXPORT jdouble JNICALL
14398 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0
14399 +(JNIEnv *env, jobject dummy)
14401 + return get_process_load();
14404 +JNIEXPORT jdouble JNICALL
14405 +Java_com_sun_management_internal_OperatingSystemImpl_getSingleCpuLoad0
14406 +(JNIEnv *env, jobject mbean, jint cpu_number)
14411 +JNIEXPORT jint JNICALL
14412 +Java_com_sun_management_internal_OperatingSystemImpl_getHostConfiguredCpuCount0
14413 +(JNIEnv *env, jobject mbean)
14417 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c jdk24u-jdk-24-29/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c
14418 --- jdk24u-jdk-24-29.orig/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2024-12-29 15:19:43.636481591 +0100
14419 +++ jdk24u-jdk-24-29/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c 2024-12-29 15:20:25.103111617 +0100
14421 // true = get available swap in bytes
14422 // false = get total swap in bytes
14423 static jlong get_total_or_available_swap_space_size(JNIEnv* env, jboolean available) {
14424 -#if defined(__linux__)
14425 +#ifdef __solaris__
14426 + long total, avail;
14427 + int nswap, i, count;
14431 + // First get the number of swap resource entries
14432 + if ((nswap = swapctl(SC_GETNSWP, NULL)) == -1) {
14433 + throw_internal_error(env, "swapctl failed to get nswap");
14436 + if (nswap == 0) {
14440 + // Allocate storage for resource entries
14441 + stbl = (swaptbl_t*) malloc(nswap * sizeof(swapent_t) +
14442 + sizeof(struct swaptable));
14443 + if (stbl == NULL) {
14444 + JNU_ThrowOutOfMemoryError(env, 0);
14448 + // Allocate storage for the table
14449 + strtab = (char*) malloc((nswap + 1) * MAXPATHLEN);
14450 + if (strtab == NULL) {
14452 + JNU_ThrowOutOfMemoryError(env, 0);
14456 + for (i = 0; i < (nswap + 1); i++) {
14457 + stbl->swt_ent[i].ste_path = strtab + (i * MAXPATHLEN);
14459 + stbl->swt_n = nswap + 1;
14461 + // Get the entries
14462 + if ((count = swapctl(SC_LIST, stbl)) < 0) {
14465 + throw_internal_error(env, "swapctl failed to get swap list");
14469 + // Sum the entries to get total and free swap
14472 + for (i = 0; i < count; i++) {
14473 + total += stbl->swt_ent[i].ste_pages;
14474 + avail += stbl->swt_ent[i].ste_free;
14479 + return available ? ((jlong)avail * page_size) :
14480 + ((jlong)total * page_size);
14481 +#elif defined(__linux__)
14483 jlong total = 0, avail = 0;
14485 @@ -126,7 +182,37 @@
14486 Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0
14487 (JNIEnv *env, jobject mbean)
14489 -#if defined(__APPLE__)
14490 +#ifdef __solaris__
14493 + size_t remaining;
14497 + fd = open64("/proc/self/psinfo", O_RDONLY, 0);
14499 + throw_internal_error(env, "Unable to open /proc/self/psinfo");
14503 + addr = (char *)&psinfo;
14504 + for (remaining = sizeof(psinfo_t); remaining > 0;) {
14505 + result = read(fd, addr, remaining);
14506 + if (result < 0) {
14507 + if (errno != EINTR) {
14509 + throw_internal_error(env, "Unable to read /proc/self/psinfo");
14513 + remaining -= result;
14519 + return (jlong) psinfo.pr_size * 1024;
14520 +#elif defined(__APPLE__)
14521 struct task_basic_info t_info;
14522 mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
14524 @@ -182,7 +268,7 @@
14525 * BSDNOTE: FreeBSD implements _SC_CLK_TCK since FreeBSD 5, so
14526 * add a magic to handle it
14528 -#if defined(_SC_CLK_TCK)
14529 +#if defined(__solaris__) || defined(_SC_CLK_TCK)
14530 clk_tck = (jlong) sysconf(_SC_CLK_TCK);
14531 #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
14533 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java jdk24u-jdk-24-29/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java
14534 --- jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java 2024-12-29 15:19:41.186801079 +0100
14535 +++ jdk24u-jdk-24-29/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java 2024-12-29 15:20:25.103579921 +0100
14537 /* -- Miscellaneous SCTP utilities -- */
14539 private static boolean IPv4MappedAddresses() {
14541 + /* FIXME - nonportable hack */
14542 + /* Solaris supports IPv4Mapped Addresses with bindx */
14544 + } /* else { //other OS/implementations */
14546 /* lksctp/linux requires Ipv4 addresses */
14549 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/Sctp.h jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/Sctp.h
14550 --- jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/Sctp.h 2024-12-29 15:19:41.184657372 +0100
14551 +++ jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/Sctp.h 2024-12-29 15:20:25.104069218 +0100
14553 #ifndef SUN_NIO_CH_SCTP_H
14554 #define SUN_NIO_CH_SCTP_H
14556 +#ifdef __solaris__
14559 +#define __EXTENSIONS__
14560 +#include <sys/socket.h>
14561 +#include <netinet/sctp.h>
14564 +/* Current Solaris headers don't comply with draft rfc */
14566 +#define SCTP_EOF MSG_EOF
14569 +#ifndef SCTP_UNORDERED
14570 +#define SCTP_UNORDERED MSG_UNORDERED
14573 +/* The current version of the socket API extension shipped with Solaris does
14574 + * not define the following options that the Java API (optionally) supports */
14575 +#ifndef SCTP_EXPLICIT_EOR
14576 +#define SCTP_EXPLICIT_EOR -1
14578 +#ifndef SCTP_FRAGMENT_INTERLEAVE
14579 +#define SCTP_FRAGMENT_INTERLEAVE -1
14581 +#ifndef SCTP_SET_PEER_PRIMARY_ADDR
14582 +#define SCTP_SET_PEER_PRIMARY_ADDR -1
14585 +/* Function types to support dynamic linking of socket API extension functions
14586 + * for SCTP. This is so that there is no linkage dependency during build or
14587 + * runtime for libsctp.*/
14588 +typedef int sctp_getladdrs_func(int sock, sctp_assoc_t id, void **addrs);
14589 +typedef int sctp_freeladdrs_func(void* addrs);
14590 +typedef int sctp_getpaddrs_func(int sock, sctp_assoc_t id, void **addrs);
14591 +typedef int sctp_freepaddrs_func(void *addrs);
14592 +typedef int sctp_bindx_func(int sock, void *addrs, int addrcnt, int flags);
14593 +typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
14597 +#else /* __linux__ */
14598 #include <stdint.h>
14599 #include <linux/types.h>
14600 #include <sys/socket.h>
14601 @@ -278,6 +320,8 @@
14602 typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
14605 +#endif /* __linux__ */
14607 extern sctp_getladdrs_func* nio_sctp_getladdrs;
14608 extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
14609 extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
14610 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c
14611 --- jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c 2024-12-29 15:19:41.184494893 +0100
14612 +++ jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c 2024-12-29 15:20:25.104481587 +0100
14613 @@ -331,11 +331,10 @@
14615 case SCTP_ADDR_MADE_PRIM :
14616 event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_MADE_PRIM;
14617 +#ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */
14620 case SCTP_ADDR_CONFIRMED :
14621 event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_CONFIRMED;
14623 #endif /* __linux__ */
14626 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/SctpNet.c jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/SctpNet.c
14627 --- jdk24u-jdk-24-29.orig/src/jdk.sctp/unix/native/libsctp/SctpNet.c 2024-12-29 15:19:41.184839031 +0100
14628 +++ jdk24u-jdk-24-29/src/jdk.sctp/unix/native/libsctp/SctpNet.c 2024-12-29 15:20:25.104949120 +0100
14629 @@ -371,7 +371,11 @@
14633 +#ifdef __solaris__
14634 + if ((addrCount = nio_sctp_getladdrs(fd, 0, (void **)&addr_buf)) == -1) {
14635 +#else /* __linux__ */
14636 if ((addrCount = nio_sctp_getladdrs(fd, 0, (struct sockaddr **)&addr_buf)) == -1) {
14638 sctpHandleSocketError(env, errno);
14641 @@ -416,7 +420,11 @@
14645 +#if defined(__solaris__)
14646 + if ((addrCount = nio_sctp_getpaddrs(fd, id, (void **)&addr_buf)) == -1) {
14647 +#else /* __linux__ */
14648 if ((addrCount = nio_sctp_getpaddrs(fd, id, (struct sockaddr **)&addr_buf)) == -1) {
14650 sctpHandleSocketError(env, errno);
14653 diff -Nru jdk24u-jdk-24-29.orig/src/jdk.security.auth/unix/native/libjaas/Unix.c jdk24u-jdk-24-29/src/jdk.security.auth/unix/native/libjaas/Unix.c
14654 --- jdk24u-jdk-24-29.orig/src/jdk.security.auth/unix/native/libjaas/Unix.c 2024-12-29 15:19:45.200116844 +0100
14655 +++ jdk24u-jdk-24-29/src/jdk.security.auth/unix/native/libjaas/Unix.c 2024-12-29 15:20:25.105375094 +0100
14657 #include <stdlib.h>
14658 #include <string.h>
14660 +/* For POSIX-compliant getpwuid_r on Solaris */
14661 +#if defined(__solaris__)
14662 +#define _POSIX_PTHREAD_SEMANTICS