@@ -798,18 +798,32 @@ as internal buffering of data.
798
798
Copy *count * bytes from file descriptor *src *, starting from offset
799
799
*offset_src *, to file descriptor *dst *, starting from offset *offset_dst *.
800
800
If *offset_src * is None, then *src * is read from the current position;
801
- respectively for *offset_dst *. The files pointed by *src * and *dst *
801
+ respectively for *offset_dst *.
802
+
803
+ In Linux kernel older than 5.3, the files pointed by *src * and *dst *
802
804
must reside in the same filesystem, otherwise an :exc: `OSError ` is
803
805
raised with :attr: `~OSError.errno ` set to :data: `errno.EXDEV `.
804
806
805
807
This copy is done without the additional cost of transferring data
806
808
from the kernel to user space and then back into the kernel. Additionally,
807
- some filesystems could implement extra optimizations. The copy is done as if
808
- both files are opened as binary.
809
+ some filesystems could implement extra optimizations, such as the use of
810
+ reflinks (i.e., two or more inodes that share pointers to the same
811
+ copy-on-write disk blocks; supported file systems include btrfs and XFS)
812
+ and server-side copy (in the case of NFS).
813
+
814
+ The function copies bytes between two file descriptors. Text options, like
815
+ the encoding and the line ending, are ignored.
809
816
810
817
The return value is the amount of bytes copied. This could be less than the
811
818
amount requested.
812
819
820
+ .. note ::
821
+
822
+ On Linux, :func: `os.copy_file_range ` should not be used for copying a
823
+ range of a pseudo file from a special filesystem like procfs and sysfs.
824
+ It will always copy no bytes and return 0 as if the file was empty
825
+ because of a known Linux kernel issue.
826
+
813
827
.. availability :: Linux kernel >= 4.5 or glibc >= 2.27.
814
828
815
829
.. versionadded :: 3.8
0 commit comments