Kaben123 opened a new pull request, #4065:
URL: https://github.com/apache/nuttx-apps/pull/4065
## Summary
Two fixes for `CONFIG_NSH_BUILTIN_AS_COMMAND`, where builtin apps run
directly
in the NSH thread instead of a spawned task:
1. **Kconfig**: background execution cannot work in this mode, so
`NSH_DISABLEBG` is hidden (`depends on !NSH_BUILTIN_AS_COMMAND`).
`NSH_PIPELINE` now depends on `!NSH_DISABLEBG`: the pipeline code in
`nsh_parse.c` uses `np_bg`, which does not exist when `NSH_DISABLEBG` is
set,
so that combination did not compile.
2. **Ctrl+C**: `nsh_command()` called `builtin->main()` without `TIOCSCTTY`,
so the serial driver never recorded a foreground pid and Ctrl+C did not
send
`SIGINT` to the running builtin. `TIOCSCTTY`/`TIOCNOTTY` are now issued
around the call, as `nsh_builtin.c` already does for spawned builtins.
## Impact
Only configurations with `NSH_BUILTIN_AS_COMMAND=y` or with
`NSH_DISABLEBG=y` + `NSH_PIPELINE` are affected. No in-tree defconfig sets
`NSH_DISABLEBG=y` together with `NSH_PIPELINE` or `NSH_BUILTIN_AS_COMMAND`
(checked with grep over `boards/`), so savedefconfig output does not change.
## Testing
Host: Ubuntu 22.04 x86_64, GCC 13.1.0, apache/nuttx master 5c1746778e8.
- `sim:nsh` + `CONFIG_NSH_BUILTIN_AS_COMMAND=y`: builds (CMake and Make),
builtins run in the NSH thread:
```
nsh> hello
Hello, World!!
nsh> critmon
PRE-EMPTION CALLER CSECTION CALLER RUN
TIME PID DESCRIPTION
...
```
- `sim:smp` + `CONFIG_NSH_DISABLEBG=y`: `NSH_PIPELINE` is dropped by Kconfig
and
the build succeeds.
- `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]