RFR: 5041655: (ch) FileLock: negative param and overflow issues [v2]

Alan Bateman alanb at openjdk.java.net
Tue Feb 8 18:24:03 UTC 2022


On Tue, 8 Feb 2022 18:04:03 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> The change to the Windows version of `FileDispatcherImpl.c` brings it functionally in line with the Unix version, although on Windows `size` has to be promoted whereas on Unix if it is `Long.MAX_VALUE` it is changed to zero in accord with `fcntl()`.

With the proposal, fc.lock(pos, 0L, shared) returns a FileLock where size() returns 0L. Can you try having this create a FileLock that reports its size as Long.MAX_VALUE - pos ?  That should eliminate the inconsistencies in the proposal and the native code changes will go away too.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7254


More information about the nio-dev mailing list