netutils/rexecd: add -t option to serve connections without a thread#3569
Open
JianyuWang0623 wants to merge 1 commit into
Open
netutils/rexecd: add -t option to serve connections without a thread#3569JianyuWang0623 wants to merge 1 commit into
JianyuWang0623 wants to merge 1 commit into
Conversation
By default rexecd spawns a detached worker thread per accepted connection to allow concurrent sessions. Add a "-t" runtime option to instead handle each connection inline in the main task, avoiding the per-connection worker stack (CONFIG_NETUTILS_REXECD_STACKSIZE) allocation from the heap. This matters on low-memory targets with limited free heap. With "-t", connections are served strictly one at a time: a long-running or interactive command blocks the accept loop until it finishes. Without it, the existing thread-per-connection behaviour is unchanged. Assisted-by: GitHubCopilot:claude-4.8-opus Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
xiaoxiang781216
approved these changes
Jun 29, 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.
Note: Please adhere to Contributing Guidelines.
Summary
Add a
-truntime option torexecdto serve each accepted connectioninline in the main task, instead of spawning a detached worker thread
per connection.
By default
rexecdcallspthread_create()for every connection, with aCONFIG_NETUTILS_REXECD_STACKSIZEstack allocated from the heap, so thatsessions can run concurrently. With
-t, the thread attributes areskipped and
doit()is called directly in the accept loop, avoiding theper-connection worker stack. This helps on low-memory targets with
limited free heap. The trade-off is that connections are served one at a
time. Without
-t, the existing behaviour is unchanged.Impact
-tflag; usage text updated.-tis loss of concurrency.Testing
nuttx/tools/checkpatch.sh -f netutils/rexecd/rexecd.c=> all checks pass.rexecd+rexec, thread-per-connection path works.rexecd -t+rexec, command runs inline, singlesession works end to end.