# HG changeset patch # User bpb # Date 1503618078 25200 # Thu Aug 24 16:41:18 2017 -0700 # Node ID 73da33a05183d6e6684248ae53ef270299772e32 # Parent df236bc94cde4865b095af19e288cde9ee519cb1 8186707: Remove libnio FileChannelImpl native close0() function Summary: Remove Java_sun_nio_ch_FileChannelImpl_close0() on Unix and Windows Reviewed-by: XXX diff --git a/make/mapfiles/libnio/mapfile-linux b/make/mapfiles/libnio/mapfile-linux --- a/make/mapfiles/libnio/mapfile-linux +++ b/make/mapfiles/libnio/mapfile-linux @@ -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 --git a/make/mapfiles/libnio/mapfile-macosx b/make/mapfiles/libnio/mapfile-macosx --- a/make/mapfiles/libnio/mapfile-macosx +++ b/make/mapfiles/libnio/mapfile-macosx @@ -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 --git a/make/mapfiles/libnio/mapfile-solaris b/make/mapfiles/libnio/mapfile-solaris --- a/make/mapfiles/libnio/mapfile-solaris +++ b/make/mapfiles/libnio/mapfile-solaris @@ -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 --git a/src/java.base/unix/native/libnio/ch/FileChannelImpl.c b/src/java.base/unix/native/libnio/ch/FileChannelImpl.c --- a/src/java.base/unix/native/libnio/ch/FileChannelImpl.c +++ b/src/java.base/unix/native/libnio/ch/FileChannelImpl.c @@ -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 --git a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java --- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java +++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java @@ -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 --git a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c --- a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c +++ b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c @@ -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 --git a/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c b/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c --- a/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c +++ b/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c @@ -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) {