8034043: Native methods for preferences API should not be in libjava
8034026: SCDynamicStoreConfig.m should not be in src/macosx/native/java/util Reviewed-by: erikj, weijun, mchung
This commit is contained in:
parent
d03152e11b
commit
f776be9c0f
@ -123,6 +123,7 @@ LIBJAVA_SRC_DIRS := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/l
|
|||||||
$(JDK_TOPDIR)/src/share/native/java/security \
|
$(JDK_TOPDIR)/src/share/native/java/security \
|
||||||
$(JDK_TOPDIR)/src/share/native/common \
|
$(JDK_TOPDIR)/src/share/native/common \
|
||||||
$(JDK_TOPDIR)/src/share/native/sun/misc \
|
$(JDK_TOPDIR)/src/share/native/sun/misc \
|
||||||
|
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/misc \
|
||||||
$(JDK_TOPDIR)/src/share/native/sun/reflect \
|
$(JDK_TOPDIR)/src/share/native/sun/reflect \
|
||||||
$(JDK_TOPDIR)/src/share/native/java/util \
|
$(JDK_TOPDIR)/src/share/native/java/util \
|
||||||
$(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
|
$(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
|
||||||
@ -187,7 +188,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
|
|||||||
LIBRARY := java, \
|
LIBRARY := java, \
|
||||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||||
SRC := $(LIBJAVA_SRC_DIRS), \
|
SRC := $(LIBJAVA_SRC_DIRS), \
|
||||||
EXCLUDES := fdlibm/src zip, \
|
EXCLUDES := fdlibm/src zip prefs, \
|
||||||
EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
|
EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
|
||||||
LANG := C, \
|
LANG := C, \
|
||||||
OPTIMIZATION := HIGH, \
|
OPTIMIZATION := HIGH, \
|
||||||
@ -285,6 +286,41 @@ BUILD_LIBRARIES += $(BUILD_LIBZIP)
|
|||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
|
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||||
|
LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/macosx/native/java/util/prefs
|
||||||
|
else
|
||||||
|
LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util/prefs
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
|
||||||
|
LIBRARY := prefs, \
|
||||||
|
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||||
|
SRC := $(LIBPREF_SRC_DIRS), \
|
||||||
|
LANG := C, \
|
||||||
|
OPTIMIZATION := HIGH, \
|
||||||
|
CFLAGS := $(CFLAGS_JDKLIB), \
|
||||||
|
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libprefs/mapfile-vers, \
|
||||||
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
|
LDFLAGS_SUFFIX_linux := -ljvm -ljava, \
|
||||||
|
LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lc, \
|
||||||
|
LDFLAGS_SUFFIX_aix := -ljvm -ljava, \
|
||||||
|
LDFLAGS_SUFFIX_windows := advapi32.lib, \
|
||||||
|
LDFLAGS_SUFFIX_macosx := -ljvm -framework CoreFoundation, \
|
||||||
|
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||||
|
RC_FLAGS := $(RC_FLAGS) \
|
||||||
|
-D "JDK_FNAME=prefs.dll" \
|
||||||
|
-D "JDK_INTERNAL_NAME=prefs" \
|
||||||
|
-D "JDK_FTYPE=0x2L", \
|
||||||
|
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libprefs, \
|
||||||
|
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||||
|
|
||||||
|
$(BUILD_LIBPREFS): $(BUILD_LIBJAVA)
|
||||||
|
|
||||||
|
BUILD_LIBRARIES += $(BUILD_LIBPREFS)
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
|
$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
|
||||||
LIBRARY := unpack, \
|
LIBRARY := unpack, \
|
||||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||||
|
@ -95,7 +95,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
|
|||||||
|
|
||||||
LIBOSX_DIRS := \
|
LIBOSX_DIRS := \
|
||||||
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
|
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
|
||||||
$(JDK_TOPDIR)/src/macosx/native/java/util \
|
|
||||||
$(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
|
$(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
|
||||||
$(JDK_TOPDIR)/src/macosx/native/apple/security \
|
$(JDK_TOPDIR)/src/macosx/native/apple/security \
|
||||||
$(JDK_TOPDIR)/src/macosx/native/apple/launcher
|
$(JDK_TOPDIR)/src/macosx/native/apple/launcher
|
||||||
|
@ -128,8 +128,13 @@ ifneq ($(BUILD_CRYPTO), no)
|
|||||||
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
|
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
|
||||||
else ifeq ($(OPENJDK_TARGET_OS), macosx)
|
else ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||||
BUILD_LIBKRB5_NAME := osxkrb5
|
BUILD_LIBKRB5_NAME := osxkrb5
|
||||||
BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5
|
BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
|
||||||
BUILD_LIBKRB5_LIBS := -framework Kerberos
|
$(JDK_TOPDIR)/src/macosx/native/sun/security/krb5
|
||||||
|
BUILD_LIBKRB5_LIBS := -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
|
||||||
|
-framework JavaNativeFoundation \
|
||||||
|
-framework Cocoa \
|
||||||
|
-framework SystemConfiguration \
|
||||||
|
-framework Kerberos
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(BUILD_LIBKRB5_NAME), )
|
ifneq ($(BUILD_LIBKRB5_NAME), )
|
||||||
@ -140,8 +145,9 @@ ifneq ($(BUILD_CRYPTO), no)
|
|||||||
LANG := C, \
|
LANG := C, \
|
||||||
OPTIMIZATION := LOW, \
|
OPTIMIZATION := LOW, \
|
||||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||||
-I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
|
-I$(JDK_TOPDIR)/src/share/native/sun/security/krb5, \
|
||||||
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5, \
|
CFLAGS_windows := -I$(JDK_TOPDIR)/src/windows/native/sun/security/krb5, \
|
||||||
|
CFLAGS_macosx := -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
|
LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
|
||||||
|
@ -236,10 +236,6 @@ SUNWprivate_1.1 {
|
|||||||
Java_java_util_TimeZone_getSystemTimeZoneID;
|
Java_java_util_TimeZone_getSystemTimeZoneID;
|
||||||
Java_java_util_TimeZone_getSystemGMTOffsetID;
|
Java_java_util_TimeZone_getSystemGMTOffsetID;
|
||||||
Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
|
Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
|
||||||
Java_java_util_prefs_FileSystemPreferences_chmod;
|
|
||||||
Java_java_util_prefs_FileSystemPreferences_lockFile0;
|
|
||||||
Java_java_util_prefs_FileSystemPreferences_unlockFile0;
|
|
||||||
Java_java_util_logging_FileHandler_isSetUID;
|
|
||||||
Java_sun_misc_MessageUtils_toStderr;
|
Java_sun_misc_MessageUtils_toStderr;
|
||||||
Java_sun_misc_MessageUtils_toStdout;
|
Java_sun_misc_MessageUtils_toStdout;
|
||||||
Java_sun_misc_NativeSignalHandler_handle0;
|
Java_sun_misc_NativeSignalHandler_handle0;
|
||||||
@ -274,17 +270,13 @@ SUNWprivate_1.1 {
|
|||||||
Java_sun_misc_Version_getJvmVersionInfo;
|
Java_sun_misc_Version_getJvmVersionInfo;
|
||||||
Java_sun_misc_Version_getJvmSpecialVersion;
|
Java_sun_misc_Version_getJvmSpecialVersion;
|
||||||
Java_sun_misc_VM_latestUserDefinedLoader;
|
Java_sun_misc_VM_latestUserDefinedLoader;
|
||||||
|
Java_sun_misc_VM_isSetUID;
|
||||||
Java_sun_misc_VM_initialize;
|
Java_sun_misc_VM_initialize;
|
||||||
Java_sun_misc_VMSupport_initAgentProperties;
|
Java_sun_misc_VMSupport_initAgentProperties;
|
||||||
|
|
||||||
# ZipFile.c needs this one
|
# ZipFile.c needs this one
|
||||||
throwFileNotFoundException;
|
throwFileNotFoundException;
|
||||||
|
|
||||||
# Java_sun_misc_VM_getState; threads.c
|
|
||||||
# Java_sun_misc_VM_threadsSuspended; threads.c
|
|
||||||
# Java_sun_misc_VM_unsuspendSomeThreads; threads.c
|
|
||||||
# Java_sun_misc_VM_unsuspendThreads; threads.c
|
|
||||||
|
|
||||||
# Outcalls from libjvm done using dlsym().
|
# Outcalls from libjvm done using dlsym().
|
||||||
|
|
||||||
VerifyClassCodes;
|
VerifyClassCodes;
|
||||||
|
36
jdk/make/mapfiles/libprefs/mapfile-vers
Normal file
36
jdk/make/mapfiles/libprefs/mapfile-vers
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
#
|
||||||
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License version 2 only, as
|
||||||
|
# published by the Free Software Foundation. Oracle designates this
|
||||||
|
# particular file as subject to the "Classpath" exception as provided
|
||||||
|
# by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
#
|
||||||
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
# version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
# accompanied this code).
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License version
|
||||||
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
# or visit www.oracle.com if you need additional information or have any
|
||||||
|
# questions.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Define public interface.
|
||||||
|
|
||||||
|
SUNWprivate_1.1 {
|
||||||
|
global:
|
||||||
|
Java_java_util_prefs_FileSystemPreferences_chmod;
|
||||||
|
Java_java_util_prefs_FileSystemPreferences_lockFile0;
|
||||||
|
Java_java_util_prefs_FileSystemPreferences_unlockFile0;
|
||||||
|
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
@ -130,6 +130,7 @@ PROFILE_3_JRE_LIB_FILES := \
|
|||||||
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
|
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
|
||||||
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
|
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
|
||||||
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
|
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
|
||||||
|
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \
|
||||||
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
|
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
|
||||||
jvm.hprof.txt \
|
jvm.hprof.txt \
|
||||||
management-agent.jar \
|
management-agent.jar \
|
||||||
|
@ -82,7 +82,7 @@ class MacOSXPreferencesFile {
|
|||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<Void>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("osx");
|
System.loadLibrary("prefs");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -535,7 +535,7 @@ public class FileHandler extends StreamHandler {
|
|||||||
continue;
|
continue;
|
||||||
} else if (ch2 == 'h') {
|
} else if (ch2 == 'h') {
|
||||||
file = new File(System.getProperty("user.home"));
|
file = new File(System.getProperty("user.home"));
|
||||||
if (isSetUID()) {
|
if (sun.misc.VM.isSetUID()) {
|
||||||
// Ok, we are in a set UID program. For safety's sake
|
// Ok, we are in a set UID program. For safety's sake
|
||||||
// we disallow attempts to open files relative to %h.
|
// we disallow attempts to open files relative to %h.
|
||||||
throw new IOException("can't use %h in set UID program");
|
throw new IOException("can't use %h in set UID program");
|
||||||
@ -669,9 +669,4 @@ public class FileHandler extends StreamHandler {
|
|||||||
lastException = ex;
|
lastException = ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* check if we are in a set UID program.
|
|
||||||
*/
|
|
||||||
private static native boolean isSetUID();
|
|
||||||
}
|
}
|
||||||
|
@ -367,6 +367,11 @@ public class VM {
|
|||||||
*/
|
*/
|
||||||
public static native ClassLoader latestUserDefinedLoader();
|
public static native ClassLoader latestUserDefinedLoader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if we are in a set UID program.
|
||||||
|
*/
|
||||||
|
public static native boolean isSetUID();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class SCDynamicStoreConfig {
|
|||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
String osname = System.getProperty("os.name");
|
String osname = System.getProperty("os.name");
|
||||||
if (osname.contains("OS X")) {
|
if (osname.contains("OS X")) {
|
||||||
System.loadLibrary("osx");
|
System.loadLibrary("osxkrb5");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -48,6 +48,15 @@ import sun.util.logging.PlatformLogger;
|
|||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
class FileSystemPreferences extends AbstractPreferences {
|
class FileSystemPreferences extends AbstractPreferences {
|
||||||
|
|
||||||
|
static {
|
||||||
|
PrivilegedAction<Void> load = () -> {
|
||||||
|
System.loadLibrary("prefs");
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
AccessController.doPrivileged(load);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync interval in seconds.
|
* Sync interval in seconds.
|
||||||
*/
|
*/
|
||||||
@ -868,7 +877,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the node name corresponding to the specified directory name.
|
* Returns the node name corresponding to the specified directory name.
|
||||||
* (Inverts the transformation of dirName(String).
|
* (Inverts the transformation of dirName(String).
|
||||||
*/
|
*/
|
||||||
private static String nodeName(String dirName) {
|
private static String nodeName(String dirName) {
|
||||||
if (dirName.charAt(0) != '_')
|
if (dirName.charAt(0) != '_')
|
||||||
|
@ -23,16 +23,12 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Solaris/Linux specific code to support logging.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "jni_util.h"
|
#include "jni_util.h"
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_java_util_logging_FileHandler_isSetUID(JNIEnv *env, jclass thisclass) {
|
Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
|
||||||
|
|
||||||
/* Return true if we are in a set UID or set GID process. */
|
/* Return true if we are in a set UID or set GID process. */
|
||||||
if (getuid() != geteuid() || getgid() != getegid()) {
|
if (getuid() != geteuid() || getgid() != getegid()) {
|
@ -29,6 +29,9 @@ import java.util.Map;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +48,14 @@ import sun.util.logging.PlatformLogger;
|
|||||||
|
|
||||||
class WindowsPreferences extends AbstractPreferences{
|
class WindowsPreferences extends AbstractPreferences{
|
||||||
|
|
||||||
|
static {
|
||||||
|
PrivilegedAction<Void> load = () -> {
|
||||||
|
System.loadLibrary("prefs");
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
AccessController.doPrivileged(load);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger for error messages
|
* Logger for error messages
|
||||||
*/
|
*/
|
||||||
|
@ -23,15 +23,11 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Win32 specific code to support logging.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "jni_util.h"
|
#include "jni_util.h"
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_java_util_logging_FileHandler_isSetUID(JNIEnv *env, jclass thisclass) {
|
Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
|
||||||
|
|
||||||
/* There is no set UID on Windows. */
|
/* There is no set UID on Windows. */
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
Loading…
Reference in New Issue
Block a user