Skip to content

Commit 9d3c9b8

Browse files
aminalaeeAA-Turnerblaisep
authored
Docs: Add os.splice flags argument (#109847)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Blaise Pabon <blaise@gmail.com>
1 parent 4232976 commit 9d3c9b8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Doc/library/os.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,10 +1724,27 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
17241724
Added support for pipes on Windows.
17251725

17261726

1727-
.. function:: splice(src, dst, count, offset_src=None, offset_dst=None)
1727+
.. function:: splice(src, dst, count, offset_src=None, offset_dst=None, flags=0)
17281728

17291729
Transfer *count* bytes from file descriptor *src*, starting from offset
17301730
*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.
1731+
1732+
The splicing behaviour can be modified by specifying a *flags* value.
1733+
Any of the following variables may used, combined using bitwise OR
1734+
(the ``|`` operator):
1735+
1736+
* If :const:`SPLICE_F_MOVE` is specified,
1737+
the kernel is asked to move pages instead of copying,
1738+
but pages may still be copied if the kernel cannot move the pages from the pipe.
1739+
1740+
* If :const:`SPLICE_F_NONBLOCK` is specified,
1741+
the kernel is asked to not block on I/O.
1742+
This makes the splice pipe operations nonblocking,
1743+
but splice may nevertheless block because the spliced file descriptors may block.
1744+
1745+
* If :const:`SPLICE_F_MORE` is specified,
1746+
it hints to the kernel that more data will be coming in a subsequent splice.
1747+
17311748
At least one of the file descriptors must refer to a pipe. If *offset_src*
17321749
is ``None``, then *src* is read from the current position; respectively for
17331750
*offset_dst*. The offset associated to the file descriptor that refers to a
@@ -1746,6 +1763,8 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
17461763
make sense to block because there are no writers connected to the write end
17471764
of the pipe.
17481765

1766+
.. seealso:: The :manpage:`splice(2)` man page.
1767+
17491768
.. availability:: Linux >= 2.6.17 with glibc >= 2.5
17501769

17511770
.. versionadded:: 3.10

0 commit comments

Comments
 (0)