8065595: Wrong JNI_OnLoad called if just loaded lib does not have JNI_OnLoad function

Add nio_util.c containing JNI_OnLoad bare bones implementation.

Reviewed-by: rriggs
This commit is contained in:
Brian Burkhalter 2015-08-13 09:36:14 -07:00
parent d45350bdb1
commit 10207de32f
5 changed files with 45 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#
BUILD_LIBNIO_SRC := \
$(JDK_TOPDIR)/src/java.base/share/native/libnio \
$(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \
$(sort $(wildcard \

View File

@ -25,6 +25,7 @@
SUNWprivate_1.1 {
global:
JNI_OnLoad;
Java_java_nio_MappedByteBuffer_force0;
Java_java_nio_MappedByteBuffer_isLoaded0;
Java_java_nio_MappedByteBuffer_load0;

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
SUNWprivate_1.1 {
global:
JNI_OnLoad;
Java_java_nio_MappedByteBuffer_force0;
Java_java_nio_MappedByteBuffer_isLoaded0;
Java_java_nio_MappedByteBuffer_load0;

View File

@ -25,6 +25,7 @@
SUNWprivate_1.1 {
global:
JNI_OnLoad;
Java_java_nio_MappedByteBuffer_force0;
Java_java_nio_MappedByteBuffer_isLoaded0;
Java_java_nio_MappedByteBuffer_load0;

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "jni.h"
#include "jvm.h"
#include "jni_util.h"
JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM *vm, void *reserved)
{
JNIEnv *env;
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) {
return JNI_EVERSION; /* JNI version not supported */
}
return JNI_VERSION_1_2;
}