This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 717c93cec9179b1b70153cb44754fa39fc56c290 Author: Marco Casaroli <[email protected]> AuthorDate: Mon Oct 19 15:55:20 2026 +0200 Documentation: Move the popen() page from apps to libc. apps/system/popen is removed, so remove its page. Describe the libc popen(), pclose(), dpopen() and dpclose() in a new page of the libc documentation: the options they need, the shell they start, and the fallback when there is no shell. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- Documentation/applications/system/popen/index.rst | 14 -------------- Documentation/os/libs/libc/index.rst | 1 + Documentation/os/libs/libc/popen.rst | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Documentation/applications/system/popen/index.rst b/Documentation/applications/system/popen/index.rst deleted file mode 100644 index 47626e49aac..00000000000 --- a/Documentation/applications/system/popen/index.rst +++ /dev/null @@ -1,14 +0,0 @@ -==================================== -``popen`` popen()/pclose() Functions -==================================== - -This library provides ``popen()``, ``pclose()``, ``dpopen()`` and -``dpclose()``. Without a shell (no ``CONFIG_NSH_LIBRARY``), it starts the -command directly with ``posix_spawnp()``. - -libc also has these functions when ``CONFIG_PIPES``, -``CONFIG_LIBC_EXECFUNCS`` and ``CONFIG_SCHED_WAITPID`` are enabled. The -libc version starts ``sh -c command``. If there is no shell, it splits -the command at blanks and starts the program directly, without shell -syntax. When ``CONFIG_SYSTEM_POPEN`` is selected, libc does not build its -copy and this library is used. diff --git a/Documentation/os/libs/libc/index.rst b/Documentation/os/libs/libc/index.rst index d779cb73da0..496938f68cd 100644 --- a/Documentation/os/libs/libc/index.rst +++ b/Documentation/os/libs/libc/index.rst @@ -176,6 +176,7 @@ Implementation Details :maxdepth: 1 :caption: Contents: + popen.rst search.rst stdbit.rst stream.rst diff --git a/Documentation/os/libs/libc/popen.rst b/Documentation/os/libs/libc/popen.rst new file mode 100644 index 00000000000..8971e0364ae --- /dev/null +++ b/Documentation/os/libs/libc/popen.rst @@ -0,0 +1,19 @@ +==================== +popen() and dpopen() +==================== + +libc has ``popen()``, ``pclose()``, ``dpopen()`` and ``dpclose()`` when +``CONFIG_PIPES``, ``CONFIG_LIBC_EXECFUNCS`` and ``CONFIG_SCHED_WAITPID`` are +enabled. + +``popen()`` starts ``sh -c command``. With ``CONFIG_LIBC_ENVPATH``, ``PATH`` +gives the location of ``sh``; else it is ``/bin/sh``. If there is no shell, +the command is split at blanks and the program is started directly, without +shell syntax. The command starts with the ``posix_spawn()`` defaults for +priority and stack size. ``pclose()`` returns the termination status of the +shell, as from ``waitpid()``. + +``dpopen()`` and ``dpclose()`` are NuttX extensions in ``unistd.h``. They +use a file descriptor instead of a stream. ``dpopen()`` with ``O_RDWR`` +connects both the standard input and output of the command through a socket +pair (needs ``CONFIG_NET_LOCAL`` and ``CONFIG_NET_LOCAL_STREAM``).
