Skip to content

Commit 7307b56

Browse files
willingcsmontanaroCAM-Gerlach
authored
[3.12] gh-101100: Fix broken xrefs in fcntl module doc (GH-115691) (#115924)
* clean up fcntl module doc * simplify * a few changes, based on suggestion by CAM-Gerlach * nitpick ignore for a couple other C functions mentioned in the fcntl module doc * more changes, especially related to LOCK_* constants * :data: back to :const: * Apply suggestions from code review --------- (cherry picked from commit 84a275c) Co-authored-by: Skip Montanaro <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 1245949 commit 7307b56

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

Doc/conf.py

+3
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@
9393
('c:func', 'dlopen'),
9494
('c:func', 'exec'),
9595
('c:func', 'fcntl'),
96+
('c:func', 'flock'),
9697
('c:func', 'fork'),
9798
('c:func', 'free'),
9899
('c:func', 'gettimeofday'),
99100
('c:func', 'gmtime'),
101+
('c:func', 'grantpt'),
102+
('c:func', 'ioctl'),
100103
('c:func', 'localeconv'),
101104
('c:func', 'localtime'),
102105
('c:func', 'main'),

Doc/library/fcntl.rst

+26-15
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
----------------
1515

16-
This module performs file control and I/O control on file descriptors. It is an
17-
interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a
18-
complete description of these calls, see :manpage:`fcntl(2)` and
19-
:manpage:`ioctl(2)` Unix manual pages.
16+
This module performs file and I/O control on file descriptors. It is an
17+
interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
18+
See the :manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages
19+
for full details.
2020

2121
.. availability:: Unix, not Emscripten, not WASI.
2222

@@ -80,7 +80,7 @@ The module defines the following functions:
8080
most likely to result in a segmentation violation or a more subtle data
8181
corruption.
8282

83-
If the :c:func:`fcntl` fails, an :exc:`OSError` is raised.
83+
If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised.
8484

8585
.. audit-event:: fcntl.fcntl fd,cmd,arg fcntl.fcntl
8686

@@ -118,7 +118,7 @@ The module defines the following functions:
118118
buffer 1024 bytes long which is then passed to :func:`ioctl` and copied back
119119
into the supplied buffer.
120120

121-
If the :c:func:`ioctl` fails, an :exc:`OSError` exception is raised.
121+
If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised.
122122

123123
An example::
124124

@@ -143,7 +143,7 @@ The module defines the following functions:
143143
:manpage:`flock(2)` for details. (On some systems, this function is emulated
144144
using :c:func:`fcntl`.)
145145

146-
If the :c:func:`flock` fails, an :exc:`OSError` exception is raised.
146+
If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised.
147147

148148
.. audit-event:: fcntl.flock fd,operation fcntl.flock
149149

@@ -155,17 +155,28 @@ The module defines the following functions:
155155
method are accepted as well) of the file to lock or unlock, and *cmd*
156156
is one of the following values:
157157

158-
* :const:`LOCK_UN` -- unlock
159-
* :const:`LOCK_SH` -- acquire a shared lock
160-
* :const:`LOCK_EX` -- acquire an exclusive lock
158+
.. data:: LOCK_UN
161159

162-
When *cmd* is :const:`LOCK_SH` or :const:`LOCK_EX`, it can also be
163-
bitwise ORed with :const:`LOCK_NB` to avoid blocking on lock acquisition.
164-
If :const:`LOCK_NB` is used and the lock cannot be acquired, an
160+
Release an existing lock.
161+
162+
.. data:: LOCK_SH
163+
164+
Acquire a shared lock.
165+
166+
.. data:: LOCK_EX
167+
168+
Acquire an exclusive lock.
169+
170+
.. data:: LOCK_NB
171+
172+
Bitwise OR with any of the other three ``LOCK_*`` constants to make
173+
the request non-blocking.
174+
175+
If :const:`!LOCK_NB` is used and the lock cannot be acquired, an
165176
:exc:`OSError` will be raised and the exception will have an *errno*
166-
attribute set to :const:`EACCES` or :const:`EAGAIN` (depending on the
177+
attribute set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending on the
167178
operating system; for portability, check for both values). On at least some
168-
systems, :const:`LOCK_EX` can only be used if the file descriptor refers to a
179+
systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to a
169180
file opened for writing.
170181

171182
*len* is the number of bytes to lock, *start* is the byte offset at

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Doc/library/email.parser.rst
3636
Doc/library/email.policy.rst
3737
Doc/library/exceptions.rst
3838
Doc/library/faulthandler.rst
39-
Doc/library/fcntl.rst
4039
Doc/library/functools.rst
4140
Doc/library/getopt.rst
4241
Doc/library/http.cookiejar.rst

0 commit comments

Comments
 (0)