RFR: 8293122: (fs) Use file cloning in macOS version of Files::copy method

Brian Burkhalter bpb at openjdk.org
Wed Sep 7 00:55:40 UTC 2022


On Wed, 7 Sep 2022 00:48:31 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Use BSD system call `clonefile` if possible when using `Files::copy` on macOS.

src/java.base/macosx/classes/sun/nio/fs/BsdFileSystem.java line 110:

> 108:             switch (x.errno()) {
> 109:                 case ENOTSUP: // cloning not supported by filesystem
> 110:                     return IOStatus.UNSUPPORTED;

It might be that `ENOTSUP` should instead result in `UNSUPPORTED_CASE` and that the static variable `cloneFileNotSupported` is unnecessary.

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

PR: https://git.openjdk.org/jdk/pull/10188


More information about the nio-dev mailing list