8286734: (fc) FileChannelImpl#map() cleanup after merge of Foreign Function & Memory API

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2022-05-17 19:43:15 +00:00
parent 0c5ab6daa9
commit 5bea46110c

@ -1014,6 +1014,10 @@ public class FileChannelImpl
unmap();
}
public long capacity() {
return cap;
}
public void unmap() {
if (address == 0)
return;
@ -1126,15 +1130,15 @@ public class FileChannelImpl
else
return Util.newMappedByteBuffer(0, 0, dummy, null, isSync);
} else if ((!writable) || (prot == MAP_RO)) {
return Util.newMappedByteBufferR((int)unmapper.cap,
unmapper.address + unmapper.pagePosition,
unmapper.fd,
unmapper, isSync);
return Util.newMappedByteBufferR((int)unmapper.capacity(),
unmapper.address(),
unmapper.fileDescriptor(),
unmapper, unmapper.isSync());
} else {
return Util.newMappedByteBuffer((int)unmapper.cap,
unmapper.address + unmapper.pagePosition,
unmapper.fd,
unmapper, isSync);
return Util.newMappedByteBuffer((int)unmapper.capacity(),
unmapper.address(),
unmapper.fileDescriptor(),
unmapper, unmapper.isSync());
}
}