Skip to content

improve os.mknod() documentation #107979

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

Open
calestyo opened this issue Aug 15, 2023 · 0 comments
Open

improve os.mknod() documentation #107979

calestyo opened this issue Aug 15, 2023 · 0 comments
Labels
docs Documentation in the Doc dir

Comments

@calestyo
Copy link
Contributor

calestyo commented Aug 15, 2023

Documentation

Split out from #107924:

cpython/Doc/library/os.rst

Lines 2398 to 2417 in cc2cf85

.. function:: mknod(path, mode=0o600, device=0, *, dir_fd=None)
Create a filesystem node (file, device special file or named pipe) named
*path*. *mode* specifies both the permissions to use and the type of node
to be created, being combined (bitwise OR) with one of ``stat.S_IFREG``,
``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are
available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``,
*device* defines the newly created device special file (probably using
:func:`os.makedev`), otherwise it is ignored.
This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.
.. availability:: Unix, not Emscripten, not WASI.
.. versionadded:: 3.3
The *dir_fd* argument.
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.

mknod(), just as its POSIX counterpart, seems to work just fine with S_IFSOCK as well.

However, POSIX documents any but S_IFIFO as being “non-portable” and mkfifo() as being preferred when creating FIFOs.

I think all these things should somehow be reflected.

@calestyo calestyo added the docs Documentation in the Doc dir label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant