6539707: (fc) MappedByteBuffer.force() method throws an IOException in a very simple test

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2021-03-15 17:24:24 +00:00
parent 189289d9c7
commit 46d78f0d24
5 changed files with 97 additions and 5 deletions

View file

@ -28,6 +28,8 @@ package java.nio;
import jdk.internal.misc.Unsafe;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.UncheckedIOException;
/* package */ class MappedMemoryUtils {
@ -94,7 +96,11 @@ import java.io.FileDescriptor;
} else {
// force writeback via file descriptor
long offset = mappingOffset(address, index);
force0(fd, mappingAddress(address, offset, index), mappingLength(offset, length));
try {
force0(fd, mappingAddress(address, offset, index), mappingLength(offset, length));
} catch (IOException cause) {
throw new UncheckedIOException(cause);
}
}
}
@ -103,7 +109,7 @@ import java.io.FileDescriptor;
private static native boolean isLoaded0(long address, long length, int pageCount);
private static native void load0(long address, long length);
private static native void unload0(long address, long length);
private static native void force0(FileDescriptor fd, long address, long length);
private static native void force0(FileDescriptor fd, long address, long length) throws IOException;
// utility methods