Repository navigation
Conversation
libc has popen(), pclose(), dpopen() and dpclose() when CONFIG_PIPES, CONFIG_LIBC_EXECFUNCS and CONFIG_SCHED_WAITPID are set, and no configuration in nuttx enables CONFIG_SYSTEM_POPEN any more. Remove the code of system/popen. The fastboot shell command, the popen test, the popen example, dhcpd and gdbstub now depend on the libc conditions only. Remove CONFIG_SYSTEM_POPEN too. It selected CONFIG_LIBC_EXECFUNCS and CONFIG_SCHED_WAITPID, so a configuration that sets only it must now set these two options in its place. The options of the old copy for the priority, the stack size, the shell path and the number of arguments have no replacement: popen() uses the posix_spawn() defaults. popen() does not accept the modes "r+" and "w+"; dpopen() with O_RDWR gives a bidirectional pipe. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]>
casaroli
force-pushed
the
popen-delete-apps
branch
from
October 21, 2026 11:32
05d0004 to
becc96d
Compare
xiaoxiang781216
approved these changes
Oct 21, 2026
JianyuWang0623
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libc has
popen(),pclose(),dpopen()anddpclose()([1/5] apache/nuttx#20778). The users ofpopen()in apps accept the libc copy ([2/5] #3877), and no nuttx configuration enablesCONFIG_SYSTEM_POPENany more ([3/5] apache/nuttx#20792).This PR removes the code of
system/popen. The fastboot shell command, the popen test, the popen example, dhcpd and gdbstub now depend only on the libc conditions:CONFIG_PIPES,CONFIG_LIBC_EXECFUNCSandCONFIG_SCHED_WAITPID.CONFIG_SYSTEM_POPENstays as a deprecated option that only selectsCONFIG_LIBC_EXECFUNCSandCONFIG_SCHED_WAITPID, so configurations that set it keeppopen().[5/5] apache/nuttx#20839 removes the
CONFIG_SYSTEM_POPENcheck from the libc build and moves the documentation page ofsystem/popento the libc documentation.Impact
No nuttx configuration changes: the 15 configurations that used
system/popenalready use the libc copy. The libc copy has all the functions of the apps copy. The optionsCONFIG_SYSTEM_POPEN_SHPATH,CONFIG_SYSTEM_POPEN_STACKSIZE,CONFIG_SYSTEM_POPEN_PRIORITYandCONFIG_SYSTEM_POPEN_MAXARGUMENTSare removed: libc startsshfromPATH(or/bin/sh) with theposix_spawn()defaults, and has no limit on the number of arguments.popen()of libc accepts only the POSIX modes"r"and"w"; the apps copy also accepted"r+"and"w+".dpopen()withO_RDWRis still available.A configuration out of the tree that sets
CONFIG_SYSTEM_POPEN=ykeeps building and gets the libc copy.CONFIG_SYSTEM_POPENselectedCONFIG_SCHED_WAITPID, so a defconfig frommake savedefconfigdoes not containCONFIG_SCHED_WAITPID; without the deprecated option, such a configuration would lose it,popen()would not be built, the popen users would be disabled without a message, and programs that callwaitpid()(for examplesystem/nxinit) would not compile. Tested with defconfigs frommake savedefconfigofqemu-armv8a:nshand:netnshwithCONFIG_SYSTEM_POPEN=y, with and withoutCONFIG_SYSTEM_SYSTEM: all build with the libc copy and lose no option.Testing
Built with [5/5], all with
CONFIG_SYSTEM_POPENgone and the libclib_popen.oandlib_dpopen.obuilt. Aftermake olddefconfig, no option of the defconfig was lost:CONFIG_SYSTEM_FASTBOOTD_SHELL=yandCONFIG_EXAMPLES_POPEN=ystay set.qemu-armv8a:fastbootCONFIG_SYSTEM_FASTBOOTD_SHELL=ysabre-6quad:citest,rv-virt:citest,rv-virt:citest64CONFIG_EXAMPLES_POPEN=ylx_cpu:nshesp32s3-devkit:fastboot,:fastboot_tcp,:fastboot_usb,lckfb-szpi-esp32s3:fastboot,:fastboot_tcp,:fastboot_usbCONFIG_SYSTEM_FASTBOOTD_SHELL=ysim:citest,sim:quickjs(x86_64 Linux in Docker)CONFIG_EXAMPLES_POPEN=yinsim:citestqemu-intel64:citest_smp(x86_64 Linux in Docker)CONFIG_EXAMPLES_POPEN=ysim:sqlitewas not built: the build host has notclsh, which the SQLite build needs.Runtime on
qemu-armv8a:knsh(kernel build) andqemu-armv8a:nsh(flat build), QEMU with HVF, withCONFIG_TESTING_POPEN,CONFIG_EXAMPLES_POPENandCONFIG_SCHED_CHILD_STATUS:popen_testpasses all 8 tests (=== Results: 0 failed ===), incl. test 8 (pclose()returns the failure status of the command).popen(the example) reads the output ofhelptoEnd of dataand exits with 0.tools/checkpatch.sh -c -u -m -gpasses.