The current copy_file implementation is suboptimal. It only uses sendfile for files smaller than 2GB, falling back to a userspace copy, and does not support copy_file_range at all. copy_file_range is particularly of increasing importance with the adoption of reflinks in filesystems. I am pretty sure I got some of the formatting wrong, feel free to tear apart. I don't know if sendfile has identical semantics on linux as it does on solaris, if someone could test with a big file that'd be great. Otherwise, this should not regress. The implementation will fall back to sendfile / userspace copy if copy_file_range is not available for the target paths. The copy implementations for sendfile and copy_file_range were put into separate functions and the callee code simplified to the point where you can basically just copy-paste it to add a new implementation, should new interesting syscalls pop up. Best Jannik