nuttx-apps/system/popen
cuiziwei 0d35e2e0bb system/popen: add dpopen/dpclose fd-based interface
Add dpopen()/dpclose() as the descriptor-based counterpart of
popen()/pclose(), analogous to how dprintf() relates to fprintf().
dpopen() returns a raw file descriptor instead of a FILE stream,
avoiding the stdio.h dependency for callers that only need an fd.

Refactor popen() as a thin wrapper: dpopen() + fdopen() + FILE
container.  All pipe creation and process spawning logic now lives
in dpopen.c.

Also remove the hard dependency on NSH_LIBRARY from SYSTEM_POPEN.
When NSH is available, commands are executed through sh -c with full
shell syntax support.  When NSH is not available, commands are split
by whitespace and executed directly via posix_spawnp().

Add CONFIG_SYSTEM_POPEN_MAXARGUMENTS (default 7) to control the
argv array size for the no-shell path.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-06-02 23:35:28 +08:00
..
CMakeLists.txt system/popen: add dpopen/dpclose fd-based interface 2026-06-02 23:35:28 +08:00
dpopen.c system/popen: add dpopen/dpclose fd-based interface 2026-06-02 23:35:28 +08:00
Kconfig system/popen: add dpopen/dpclose fd-based interface 2026-06-02 23:35:28 +08:00
Make.defs system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Makefile system/popen: add dpopen/dpclose fd-based interface 2026-06-02 23:35:28 +08:00
popen.c system/popen: add dpopen/dpclose fd-based interface 2026-06-02 23:35:28 +08:00