RFR: 8269074: (fs) Files.copy fails to copy from /proc on some linux kernel versions [v2]
Alan Bateman
alanb at openjdk.java.net
Tue Jun 22 18:41:28 UTC 2021
On Tue, 22 Jun 2021 17:17:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> On Linux, if while executing `java.nio.file.Files.copy(Path,Path,CopyOption...)` the native function `sendfile(2)` fails with `EINVAL`, fall back to transferring via user-space buffers.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8269074: Move user-space copy to separate function
src/java.base/unix/native/libnio/fs/UnixCopyFile.c line 40:
> 38: #include "sun_nio_fs_UnixCopyFile.h"
> 39:
> 40: #if ! defined(_ALLBSD_SOURCE)
The "#if ! defined(_ALLBSD_SOURCE)" looks odd here. Maybe we can get rid of it, it doesn't matter if this tiny function is compiled on macOS.
src/java.base/unix/native/libnio/fs/UnixCopyFile.c line 107:
> 105: } while (bytes_sent > 0);
> 106:
> 107: transfer(env, dst, src, cancel);
An alternative might be to call the transfer method at L95 so that it's
if (errno == EINVAL) {
transfer(env, dst, src, cancel);
} else {
throwUnixExceptin(env, errno);
}
return
I suspect it might be clearer.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4543
More information about the nio-dev
mailing list