summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-05-31 18:39:47 (GMT)
committerGitHub <noreply@github.com>2019-05-31 18:39:47 (GMT)
commitaac4d0342c3e692731c189d003dbd73a8c681a34 (patch)
treeb888c0e2423d1b3422765db1cea5f3e0cf5c97f4 /Doc
parent545a3b8814dbf2a5391e830d69e796fb1a1d62ec (diff)
downloadcpython-aac4d0342c3e692731c189d003dbd73a8c681a34.zip
cpython-aac4d0342c3e692731c189d003dbd73a8c681a34.tar.gz
cpython-aac4d0342c3e692731c189d003dbd73a8c681a34.tar.bz2
bpo-26826: Expose copy_file_range in the os module (GH-7255)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/os.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index b53fd71..107764b 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -707,6 +707,28 @@ as internal buffering of data.
pass
+.. function:: copy_file_range(src, dst, count, offset_src=None, offset_dst=None)
+
+ Copy *count* bytes from file descriptor *src*, starting from offset
+ *offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.
+ If *offset_src* is None, then *src* is read from the current position;
+ respectively for *offset_dst*. The files pointed by *src* and *dst*
+ must reside in the same filesystem, otherwise an :exc:`OSError` is
+ raised with :attr:`~OSError.errno` set to :data:`errno.EXDEV`.
+
+ This copy is done without the additional cost of transferring data
+ from the kernel to user space and then back into the kernel. Additionally,
+ some filesystems could implement extra optimizations. The copy is done as if
+ both files are opened as binary.
+
+ The return value is the amount of bytes copied. This could be less than the
+ amount requested.
+
+ .. availability:: Linux kernel >= 4.5 or glibc >= 2.27.
+
+ .. versionadded:: 3.8
+
+
.. function:: device_encoding(fd)
Return a string describing the encoding of the device associated with *fd*