[jdk17] RFR: 8269074: (fs) Files.copy fails to copy from /proc on some linux kernel versions

Vyom Tewari vtewari at openjdk.java.net
Thu Jun 24 04:20:28 UTC 2021


On Wed, 23 Jun 2021 17:33:58 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.

src/java.base/unix/native/libnio/fs/UnixCopyFile.c line 123:

> 121:         RESTARTABLE(sendfile64(dst, src, NULL, count), bytes_sent);
> 122:         if (bytes_sent == -1) {
> 123:             if (errno == EINVAL) {

Don't you think we have have to take care of "ENOSYS" as well. Manual pages talks about "ENOSYS" as well.
 
"Applications may wish to fall back to read(2)/write(2) in the case where sendfile() fails with EINVAL or ENOSYS."

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

PR: https://git.openjdk.java.net/jdk17/pull/128


More information about the nio-dev mailing list