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

Alan Bateman alanb at openjdk.java.net
Tue Jun 22 07:04:26 UTC 2021


On Mon, 21 Jun 2021 20:39:02 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.

What would think about moving the original code that transfers via user-space buffers into its own static function? I think that would make UnixCopyFile_transfer a bit clearer so that it is reads

#if defined(__linux__)
..
#elif defined(_ALLBSD_SOURCE)
..
#else 
..
#endif

If code compiled for Linux can fallback to calling transfer without confusing #if !defined(_ALLBSD_SOURCE) code.

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

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


More information about the nio-dev mailing list