Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(22)

Side by Side Diff: Doc/library/os.rst

Issue 26826: Expose new copy_file_range() syscal in os module and use it to improve shutils.copy()
Patch Set: Created 3 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/shutil.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`os` --- Miscellaneous operating system interfaces 1 :mod:`os` --- Miscellaneous operating system interfaces
2 ======================================================= 2 =======================================================
3 3
4 .. module:: os 4 .. module:: os
5 :synopsis: Miscellaneous operating system interfaces. 5 :synopsis: Miscellaneous operating system interfaces.
6 6
7 7
8 This module provides a portable way of using operating system dependent 8 This module provides a portable way of using operating system dependent
9 functionality. If you just want to read or write a file see :func:`open`, if 9 functionality. If you just want to read or write a file see :func:`open`, if
10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to 10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 663
664 Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive) , 664 Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive) ,
665 ignoring errors. Equivalent to (but much faster than):: 665 ignoring errors. Equivalent to (but much faster than)::
666 666
667 for fd in range(fd_low, fd_high): 667 for fd in range(fd_low, fd_high):
668 try: 668 try:
669 os.close(fd) 669 os.close(fd)
670 except OSError: 670 except OSError:
671 pass 671 pass
672 672
673
674 .. function:: copy_file_range(in, offset_in, out, offset_out, count, flags=0)
675
676 Copy *count* bytes from file descriptor *in*, starting from offset
677 *offset_in*, to file descriptor *out*, starting from offset *offset_out*.
678 If *offset_in* is None, then *in* is read from the current position;
679 respectively for *offset_out*.
680 This copy is done without using any user space buffers, and some
681 filesystems could implement optimizations. The flags argument is
682 provided to allow for future extensions and currently must be to 0.
Martin Panter 2016/04/27 03:07:34 currently must be 0. [no “to”]
683
684 Availability: some recent flavors of Unix (see the man page
685 :manpage:`copy_file_range(2)` for further information).
686
687 .. versionadded:: 3.6
673 688
674 .. function:: device_encoding(fd) 689 .. function:: device_encoding(fd)
675 690
676 Return a string describing the encoding of the device associated with *fd* 691 Return a string describing the encoding of the device associated with *fd*
677 if it is connected to a terminal; else return :const:`None`. 692 if it is connected to a terminal; else return :const:`None`.
678 693
679 694
680 .. function:: dup(fd) 695 .. function:: dup(fd)
681 696
682 Return a duplicate of file descriptor *fd*. The new file descriptor is 697 Return a duplicate of file descriptor *fd*. The new file descriptor is
(...skipping 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 :exc:`NotImplementedError` will be raised. 3780 :exc:`NotImplementedError` will be raised.
3766 3781
3767 For an easy-to-use interface to the random number generator 3782 For an easy-to-use interface to the random number generator
3768 provided by your platform, please see :class:`random.SystemRandom`. 3783 provided by your platform, please see :class:`random.SystemRandom`.
3769 3784
3770 .. versionchanged:: 3.5 3785 .. versionchanged:: 3.5
3771 On Linux 3.17 and newer, the ``getrandom()`` syscall is now used 3786 On Linux 3.17 and newer, the ``getrandom()`` syscall is now used
3772 when available. On OpenBSD 5.6 and newer, the C ``getentropy()`` 3787 when available. On OpenBSD 5.6 and newer, the C ``getentropy()``
3773 function is now used. These functions avoid the usage of an internal file 3788 function is now used. These functions avoid the usage of an internal file
3774 descriptor. 3789 descriptor.
OLDNEW
« no previous file with comments | « no previous file | Lib/shutil.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+