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

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

Issue 23001: Accept mutable bytes-like objects
Patch Set: Created 4 years, 8 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 | Doc/library/mmap.rst » ('j') | Doc/library/socket.rst » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`fcntl` --- The ``fcntl`` and ``ioctl`` system calls 1 :mod:`fcntl` --- The ``fcntl`` and ``ioctl`` system calls
2 ========================================================= 2 =========================================================
3 3
4 .. module:: fcntl 4 .. module:: fcntl
5 :platform: Unix 5 :platform: Unix
6 :synopsis: The fcntl() and ioctl() system calls. 6 :synopsis: The fcntl() and ioctl() system calls.
7 .. sectionauthor:: Jaap Vermeulen 7 .. sectionauthor:: Jaap Vermeulen
8 8
9 9
10 .. index:: 10 .. index::
(...skipping 17 matching lines...) Expand all
28 The module defines the following functions: 28 The module defines the following functions:
29 29
30 30
31 .. function:: fcntl(fd, op[, arg]) 31 .. function:: fcntl(fd, op[, arg])
32 32
33 Perform the operation *op* on file descriptor *fd* (file objects providing 33 Perform the operation *op* on file descriptor *fd* (file objects providing
34 a :meth:`~io.IOBase.fileno` method are accepted as well). The values used 34 a :meth:`~io.IOBase.fileno` method are accepted as well). The values used
35 for *op* are operating system dependent, and are available as constants 35 for *op* are operating system dependent, and are available as constants
36 in the :mod:`fcntl` module, using the same names as used in the relevant C 36 in the :mod:`fcntl` module, using the same names as used in the relevant C
37 header files. The argument *arg* is optional, and defaults to the integer 37 header files. The argument *arg* is optional, and defaults to the integer
38 value ``0``. When present, it can either be an integer value, or a string. 38 value ``0``. When present, it can either be an integer value, or a
39 With the argument missing or an integer value, the return value of this funct ion 39 :term:`bytes-like object`. With the argument missing or an integer value,
40 is the integer return value of the C :c:func:`fcntl` call. When the argument is 40 the return value of this function is the integer return value of the C
41 a string it represents a binary structure, e.g. created by :func:`struct.pack `. 41 :c:func:`fcntl` call. When the argument is a bytes-like object it
42 represents a binary structure, e.g. created by :func:`struct.pack`.
42 The binary data is copied to a buffer whose address is passed to the C 43 The binary data is copied to a buffer whose address is passed to the C
43 :c:func:`fcntl` call. The return value after a successful call is the conten ts 44 :c:func:`fcntl` call. The return value after a successful call is the conten ts
44 of the buffer, converted to a string object. The length of the returned stri ng 45 of the buffer, converted to a bytes object. The length of the returned bytes
45 will be the same as the length of the *arg* argument. This is limited to 102 4 46 will be the same as the length of the *arg* argument. This is limited to 102 4
46 bytes. If the information returned in the buffer by the operating system is 47 bytes. If the information returned in the buffer by the operating system is
47 larger than 1024 bytes, this is most likely to result in a segmentation 48 larger than 1024 bytes, this is most likely to result in a segmentation
48 violation or a more subtle data corruption. 49 violation or a more subtle data corruption.
49 50
50 If the :c:func:`fcntl` fails, an :exc:`OSError` is raised. 51 If the :c:func:`fcntl` fails, an :exc:`OSError` is raised.
52
53 .. versionchanged: 3.5
54 Writable :term:`bytes-like object` is now accepted as the *arg* argument.
51 55
52 56
53 .. function:: ioctl(fd, op[, arg[, mutate_flag]]) 57 .. function:: ioctl(fd, op[, arg[, mutate_flag]])
54 58
55 This function is identical to the :func:`~fcntl.fcntl` function, except 59 This function is identical to the :func:`~fcntl.fcntl` function, except
56 that the argument handling is even more complicated. 60 that the argument handling is even more complicated.
57 61
58 The op parameter is limited to values that can fit in 32-bits. 62 The op parameter is limited to values that can fit in 32-bits.
59 Additional constants of interest for use as the *op* argument can be 63 Additional constants of interest for use as the *op* argument can be
60 found in the :mod:`termios` module, under the same names as used in 64 found in the :mod:`termios` module, under the same names as used in
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 157
154 158
155 .. seealso:: 159 .. seealso::
156 160
157 Module :mod:`os` 161 Module :mod:`os`
158 If the locking flags :data:`~os.O_SHLOCK` and :data:`~os.O_EXLOCK` are 162 If the locking flags :data:`~os.O_SHLOCK` and :data:`~os.O_EXLOCK` are
159 present in the :mod:`os` module (on BSD only), the :func:`os.open` 163 present in the :mod:`os` module (on BSD only), the :func:`os.open`
160 function provides an alternative to the :func:`lockf` and :func:`flock` 164 function provides an alternative to the :func:`lockf` and :func:`flock`
161 functions. 165 functions.
162 166
OLDNEW
« no previous file with comments | « no previous file | Doc/library/mmap.rst » ('j') | Doc/library/socket.rst » ('J')

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