This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new bcd56699e nshlib: honor CONFIG_ELF_STACKSIZE for file apps
bcd56699e is described below

commit bcd56699e54b808479ddb056b85f1f7df1559b20
Author: anjiahao <[email protected]>
AuthorDate: Thu Nov 26 21:11:40 2026 +0800

    nshlib: honor CONFIG_ELF_STACKSIZE for file apps
    
    The ELF loader already sizes task stacks from CONFIG_ELF_STACKSIZE
    when the attribute is absent.  Set it explicitly from nsh so a file
    app started through nsh receives the configured stack size instead of
    the loader default.
    
    Signed-off-by: anjiahao <[email protected]>
---
 nshlib/nsh_fileapps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/nshlib/nsh_fileapps.c b/nshlib/nsh_fileapps.c
index 565d5ed62..0947178d0 100644
--- a/nshlib/nsh_fileapps.c
+++ b/nshlib/nsh_fileapps.c
@@ -108,6 +108,16 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const 
char *cmd,
       goto errout_with_actions;
     }
 
+#ifdef CONFIG_ELF_STACKSIZE
+  ret = posix_spawnattr_setstacksize(&attr, CONFIG_ELF_STACKSIZE);
+  if (ret != 0)
+    {
+      nsh_error(vtbl, g_fmtcmdfailed, cmd,
+                "posix_spawnattr_setstacksize", NSH_ERRNO);
+      goto errout_with_actions;
+    }
+#endif
+
   if (param)
     {
       /* Handle redirection of input */

Reply via email to