casaroli opened a new pull request, #3890: URL: https://github.com/apache/nuttx-apps/pull/3890
## Summary libc has `popen()`, `pclose()`, `dpopen()` and `dpclose()` ([1/5] apache/nuttx#20778). The users of `popen()` in apps accept the libc copy ([2/5] apache/nuttx-apps#3877), and no nuttx configuration enables `CONFIG_SYSTEM_POPEN` any 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_EXECFUNCS` and `CONFIG_SCHED_WAITPID`. `CONFIG_SYSTEM_POPEN` stays as a deprecated option that only selects `CONFIG_LIBC_EXECFUNCS` and `CONFIG_SCHED_WAITPID`, so configurations that set it keep `popen()`. [5/5] (nuttx) removes the `CONFIG_SYSTEM_POPEN` check from the libc build and moves the documentation page of `system/popen` to the libc documentation. ## Impact No nuttx configuration changes: the 15 configurations that used `system/popen` already use the libc copy. The libc copy has all the functions of the apps copy. The options `CONFIG_SYSTEM_POPEN_SHPATH`, `CONFIG_SYSTEM_POPEN_STACKSIZE`, `CONFIG_SYSTEM_POPEN_PRIORITY` and `CONFIG_SYSTEM_POPEN_MAXARGUMENTS` are removed: libc starts `sh` from `PATH` (or `/bin/sh`) with the `posix_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()` with `O_RDWR` is still available. A configuration out of the tree that sets `CONFIG_SYSTEM_POPEN=y` keeps building and gets the libc copy. `CONFIG_SYSTEM_POPEN` selected `CONFIG_SCHED_WAITPID`, so a defconfig from `make savedefconfig` does not contain `CONFIG_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 call `waitpid()` (for example `system/nxinit`) would not compile. Tested with defconfigs from `make savedefconfig` of `qemu-armv8a:nsh` and `:netnsh` with `CONFIG_SYSTEM_POPEN=y`, with and without `CONFIG_SYSTEM_SYSTEM`: all build with the libc copy and lose no option. ## Testing Built with [5/5], all with `CONFIG_SYSTEM_POPEN` gone and the libc `lib_popen.o` and `lib_dpopen.o` built. After `make olddefconfig`, no option of the defconfig was lost: `CONFIG_SYSTEM_FASTBOOTD_SHELL=y` and `CONFIG_EXAMPLES_POPEN=y` stay set. | Configuration | Result | |---|---| | `qemu-armv8a:fastboot` | builds, `CONFIG_SYSTEM_FASTBOOTD_SHELL=y` | | `sabre-6quad:citest`, `rv-virt:citest`, `rv-virt:citest64` | build, `CONFIG_EXAMPLES_POPEN=y` | | `lx_cpu:nsh` | builds | | `esp32s3-devkit:fastboot`, `:fastboot_tcp`, `:fastboot_usb`, `lckfb-szpi-esp32s3:fastboot`, `:fastboot_tcp`, `:fastboot_usb` | build, `CONFIG_SYSTEM_FASTBOOTD_SHELL=y` | | `sim:citest`, `sim:quickjs` (x86_64 Linux in Docker) | build, `CONFIG_EXAMPLES_POPEN=y` in `sim:citest` | | `qemu-intel64:citest_smp` (x86_64 Linux in Docker) | builds, `CONFIG_EXAMPLES_POPEN=y` | `sim:sqlite` was not built: the build host has no `tclsh`, which the SQLite build needs. Runtime on `qemu-armv8a:knsh` (kernel build) and `qemu-armv8a:nsh` (flat build), QEMU with HVF, with `CONFIG_TESTING_POPEN`, `CONFIG_EXAMPLES_POPEN` and `CONFIG_SCHED_CHILD_STATUS`: `popen_test` passes all 8 tests (`=== Results: 0 failed ===`), incl. test 8 (`pclose()` returns the failure status of the command). `popen` (the example) reads the output of `help` to `End of data` and exits with 0. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
