This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 53c00f9e7811c3914e89cc68a8aee582eb5711b9
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Oct 22 01:55:22 2026 +0200

    Documentation: Describe register_pseudodir() and the shm directory.
    
    Describe register_pseudodir(), which creates an empty directory in the
    pseudo file system for the device files of a driver, and say that the
    directory of the shared memory objects exists from boot.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/os/filesystem/shmfs.rst                 |  5 +++++
 Documentation/os/filesystem/special_files_dev_num.rst | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Documentation/os/filesystem/shmfs.rst 
b/Documentation/os/filesystem/shmfs.rst
index f23d79c7e1d..e570b2fc2ac 100644
--- a/Documentation/os/filesystem/shmfs.rst
+++ b/Documentation/os/filesystem/shmfs.rst
@@ -11,6 +11,11 @@ from NSH command line.
 
 This file system doesn't support mount operations though.
 
+The objects are files in the directory ``CONFIG_FS_SHMFS_VFS_PATH``
+(default ``/var/shm``; ``/dev/shm`` as on Linux is a common choice).  The
+directory exists from boot, also before the first object, and anyone can
+create an object in it (mode 1777).
+
 If comment the line using ``shm_unlink()`` in the example app, we can see
 a file under ``/var/shm/`` from NSH command line after running the example.
 We can also remove that file from command line.
diff --git a/Documentation/os/filesystem/special_files_dev_num.rst 
b/Documentation/os/filesystem/special_files_dev_num.rst
index 2e0fd615f62..2038e4e5b86 100644
--- a/Documentation/os/filesystem/special_files_dev_num.rst
+++ b/Documentation/os/filesystem/special_files_dev_num.rst
@@ -104,6 +104,18 @@ The ``path`` argument determines where in the pseudo-file 
system the
 device file should be placed. ``mode`` provides device file privileges. 
 The ``fops`` and ``priv`` provide the internal information for the 
``registry``.
 
+A driver that creates its device files below a directory later, as the
+pseudo-terminal driver does with ``/dev/pts/N``, creates the empty
+directory when it initializes:
+
+.. code-block:: c
+
+    int register_pseudodir(FAR const char *path, mode_t mode);
+
+Then the directory exists before the first device file does.  User code
+cannot do this with ``mkdir()`` once a file system is mounted at ``/``:
+``mkdir()`` creates the directory in that file system.
+
 So the when you open a device driver in NuttX, many fewer steps are 
 involved: The system must still open the device file, but then 
 since the pseudo-file system `is` the device registry, all of the 

Reply via email to