Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-101100: Fix broken xrefs in fcntl module doc #115691

Merged
merged 7 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@
('c:func', 'dlopen'),
('c:func', 'exec'),
('c:func', 'fcntl'),
('c:func', 'flock'),
('c:func', 'fork'),
('c:func', 'free'),
('c:func', 'gettimeofday'),
('c:func', 'gmtime'),
('c:func', 'grantpt'),
('c:func', 'ioctl'),
('c:func', 'localeconv'),
('c:func', 'localtime'),
('c:func', 'main'),
Expand Down
41 changes: 26 additions & 15 deletions Doc/library/fcntl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

----------------

This module performs file control and I/O control on file descriptors. It is an
interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a
complete description of these calls, see :manpage:`fcntl(2)` and
:manpage:`ioctl(2)` Unix manual pages.
This module performs file and I/O control on file descriptors. It is
an interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
See the :manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages
for full details.

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

Expand Down Expand Up @@ -101,7 +101,7 @@ The module defines the following functions:
most likely to result in a segmentation violation or a more subtle data
corruption.

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

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

Expand Down Expand Up @@ -139,7 +139,7 @@ The module defines the following functions:
buffer 1024 bytes long which is then passed to :func:`ioctl` and copied back
into the supplied buffer.

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

An example::

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

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

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

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

* :const:`LOCK_UN` -- unlock
* :const:`LOCK_SH` -- acquire a shared lock
* :const:`LOCK_EX` -- acquire an exclusive lock
.. data:: LOCK_UN

When *cmd* is :const:`LOCK_SH` or :const:`LOCK_EX`, it can also be
bitwise ORed with :const:`LOCK_NB` to avoid blocking on lock acquisition.
If :const:`LOCK_NB` is used and the lock cannot be acquired, an
release an existing lock

.. data:: LOCK_SH

acquire a shared lock

.. data:: LOCK_EX

acquire an exclusive lock
smontanaro marked this conversation as resolved.
Show resolved Hide resolved

.. data:: LOCK_NB

bitwise OR with any of the other three constantsoperations to make
the request non-blocking.
smontanaro marked this conversation as resolved.
Show resolved Hide resolved

If :const:`!LOCK_NB` is used and the lock cannot be acquired, an
:exc:`OSError` will be raised and the exception will have an *errno*
attribute set to :const:`EACCES` or :const:`EAGAIN` (depending on the
attribute set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending on the
operating system; for portability, check for both values). On at least some
systems, :const:`LOCK_EX` can only be used if the file descriptor refers to a
systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to a
CAM-Gerlach marked this conversation as resolved.
Show resolved Hide resolved
file opened for writing.

*len* is the number of bytes to lock, *start* is the byte offset at
Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Doc/library/email.parser.rst
Doc/library/email.policy.rst
Doc/library/exceptions.rst
Doc/library/faulthandler.rst
Doc/library/fcntl.rst
Doc/library/functools.rst
Doc/library/http.cookiejar.rst
Doc/library/http.server.rst
Expand Down
Loading