Skip to content

gh-107801: Document SEEK_HOLE and SEEK_DATA #107936

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

Merged
merged 14 commits into from
Aug 17, 2023
23 changes: 21 additions & 2 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,27 @@ as internal buffering of data.
respectively.

.. versionadded:: 3.3
Some operating systems could support additional values, like
:const:`os.SEEK_HOLE` or :const:`os.SEEK_DATA`.

.. data:: SEEK_HOLE
SEEK_DATA

Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek`
method on file objects, for seeking file data and holes.

:data:`!SEEK_DATA`
Adjust the file offset to the next location in the file containing data.

:data:`!SEEK_HOLE`
Adjust the file offset to the next hole in the file.
A hole is defined as a sequence of zeros.

.. note::

These operations only make sense for filesystems that support them.

.. availability:: Linux >= 3.1, macOS, Unix

.. versionadded:: 3.1


.. function:: open(path, flags, mode=0o777, *, dir_fd=None)
Expand Down