RFR: 8292562: (fc) Use copy_file_range in FileChannel::transferTo on Linux
Brian Burkhalter
bpb at openjdk.org
Fri Aug 19 22:09:10 UTC 2022
On Fri, 19 Aug 2022 06:41:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Add `copy_file_range(2)` to the native Linux implementation of `FileChannel::transferTo`.
>
> src/java.base/unix/native/libnio/ch/FileChannelImpl.c line 182:
>
>> 180: jlong n;
>> 181: if (my_copy_file_range_func != NULL) {
>> 182: n = my_copy_file_range_func(srcFD, &offset, dstFD, NULL, count, 0);
>
> I assume count will need to be cast to size_t for this to compile on all architectures.
Fixed in ee29211e7ebdfc6d9127bcf093de2a475f9c1a3a.
> src/java.base/unix/native/libnio/ch/FileChannelImpl.c line 186:
>
>> 184: switch (errno) {
>> 185: case EINTR:
>> 186: case EINVAL:
>
> For EINTR we could return IOS_INTERRUPTED if you want.
So changed in ee29211e7ebdfc6d9127bcf093de2a475f9c1a3a.
-------------
PR: https://git.openjdk.org/jdk/pull/9925
More information about the nio-dev
mailing list