# HG changeset patch # User bpb # Date 1503682992 25200 # Node ID ed227a8f92fb5fc6cb423bd84874203c7de1e31a # Parent d0f76f38fb56b0ddebfb44075d373e3f1a291b5f 8186707: Remove libnio FileChannelImpl native close0() function Summary: Remove Java_sun_nio_ch_FileChannelImpl_close0() on Unix and Windows and Java_sun_nio_ch_FileDispatcherImpl_closeByHandle on Windows only Reviewed-by: alanb diff -r d0f76f38fb56 -r ed227a8f92fb jdk/make/mapfiles/libnio/mapfile-linux --- a/jdk/make/mapfiles/libnio/mapfile-linux Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/make/mapfiles/libnio/mapfile-linux Fri Aug 25 10:43:12 2017 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,6 @@ Java_sun_nio_ch_EPollPort_drain1; Java_sun_nio_ch_EPollPort_interrupt; Java_sun_nio_ch_EPollPort_socketpair; - Java_sun_nio_ch_FileChannelImpl_close0; Java_sun_nio_ch_FileChannelImpl_initIDs; Java_sun_nio_ch_FileChannelImpl_map0; Java_sun_nio_ch_FileChannelImpl_position0; diff -r d0f76f38fb56 -r ed227a8f92fb jdk/make/mapfiles/libnio/mapfile-macosx --- a/jdk/make/mapfiles/libnio/mapfile-macosx Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/make/mapfiles/libnio/mapfile-macosx Fri Aug 25 10:43:12 2017 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,6 @@ Java_sun_nio_ch_DatagramDispatcher_readv0; Java_sun_nio_ch_DatagramDispatcher_write0; Java_sun_nio_ch_DatagramDispatcher_writev0; - Java_sun_nio_ch_FileChannelImpl_close0; Java_sun_nio_ch_FileChannelImpl_initIDs; Java_sun_nio_ch_FileChannelImpl_map0; Java_sun_nio_ch_FileChannelImpl_position0; diff -r d0f76f38fb56 -r ed227a8f92fb jdk/make/mapfiles/libnio/mapfile-solaris --- a/jdk/make/mapfiles/libnio/mapfile-solaris Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/make/mapfiles/libnio/mapfile-solaris Fri Aug 25 10:43:12 2017 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ Java_sun_nio_ch_DevPollArrayWrapper_poll0; Java_sun_nio_ch_DevPollArrayWrapper_register; Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple; - Java_sun_nio_ch_FileChannelImpl_close0; Java_sun_nio_ch_FileChannelImpl_initIDs; Java_sun_nio_ch_FileChannelImpl_map0; Java_sun_nio_ch_FileChannelImpl_position0; diff -r d0f76f38fb56 -r ed227a8f92fb jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c --- a/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c Fri Aug 25 10:43:12 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -140,18 +140,6 @@ } -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo) -{ - jint fd = fdval(env, fdo); - if (fd != -1) { - jlong result = close(fd); - if (result < 0) { - JNU_ThrowIOExceptionWithLastError(env, "Close failed"); - } - } -} - JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, jobject srcFDO, diff -r d0f76f38fb56 -r ed227a8f92fb jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java --- a/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Aug 25 10:43:12 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,7 +176,5 @@ static native void close0(FileDescriptor fd) throws IOException; - static native void closeByHandle(long fd) throws IOException; - static native long duplicateHandle(long fd) throws IOException; } diff -r d0f76f38fb56 -r ed227a8f92fb jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c --- a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c Fri Aug 25 10:43:12 2017 -0700 @@ -165,18 +165,6 @@ return (jlong)where.QuadPart; } -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo) -{ - HANDLE h = (HANDLE)(handleval(env, fdo)); - if (h != INVALID_HANDLE_VALUE) { - BOOL result = CloseHandle(h); - if (result == 0) { - JNU_ThrowIOExceptionWithLastError(env, "Close failed"); - } - } -} - JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, jobject srcFD, diff -r d0f76f38fb56 -r ed227a8f92fb jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c --- a/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c Fri Aug 25 10:39:02 2017 -0700 +++ b/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c Fri Aug 25 10:43:12 2017 -0700 @@ -433,8 +433,10 @@ } } -static void closeFile(JNIEnv *env, jlong fd) { - HANDLE h = (HANDLE)fd; +JNIEXPORT void JNICALL +Java_sun_nio_ch_FileDispatcherImpl_close0(JNIEnv *env, jclass clazz, jobject fdo) +{ + HANDLE h = (HANDLE)handleval(env, fdo); if (h != INVALID_HANDLE_VALUE) { int result = CloseHandle(h); if (result == 0) @@ -442,19 +444,6 @@ } } -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileDispatcherImpl_close0(JNIEnv *env, jclass clazz, jobject fdo) -{ - jlong fd = handleval(env, fdo); - closeFile(env, fd); -} - -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileDispatcherImpl_closeByHandle(JNIEnv *env, jclass clazz, jlong fd) -{ - closeFile(env, fd); -} - JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileDispatcherImpl_duplicateHandle(JNIEnv *env, jclass this, jlong handle) {