This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 170a989ccb7 libc/builtin: support per-application priority/stacksize
under KERNEL build.
170a989ccb7 is described below
commit 170a989ccb78c29e250309644dc0f65c55cf8fd7
Author: liang.huang <[email protected]>
AuthorDate: Sun Jul 12 07:57:07 2026 +0800
libc/builtin: support per-application priority/stacksize under KERNEL build.
nsh_fileapp() could not apply an application's Kconfig-configured
priority/stacksize via posix_spawn() under CONFIG_BUILD_KERNEL, because
the registry table (struct builtin_s / g_builtins[]) was gated on
CONFIG_BUILTIN, which depends on !BUILD_KERNEL. Those settings were
silently ignored in KERNEL builds.
CONFIG_BUILTIN conflates the table with main_t-based dispatch, which is
meaningless under CONFIG_BUILD_KERNEL. Add a hidden derived symbol,
APP_REGISTRY, that tracks table availability independently of dispatch:
config APP_REGISTRY
bool
default y if BUILTIN || BUILD_KERNEL
Switch the guards on the table itself (Make.defs, builtin.h) from
CONFIG_BUILTIN to CONFIG_APP_REGISTRY. Call sites that dereference
builtin->main stay gated on CONFIG_BUILTIN and remain unreachable
under CONFIG_BUILD_KERNEL.
Signed-off-by: liang.huang <[email protected]>
---
include/nuttx/lib/builtin.h | 8 ++++++--
libs/libc/builtin/CMakeLists.txt | 2 +-
libs/libc/builtin/Kconfig | 12 ++++++++++++
libs/libc/builtin/Make.defs | 2 +-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/include/nuttx/lib/builtin.h b/include/nuttx/lib/builtin.h
index 70d9ad90ba9..51d32d75a19 100644
--- a/include/nuttx/lib/builtin.h
+++ b/include/nuttx/lib/builtin.h
@@ -30,12 +30,16 @@
#include <nuttx/config.h>
#include <sys/types.h>
-#ifdef CONFIG_BUILTIN
+#ifdef CONFIG_APP_REGISTRY
/****************************************************************************
* Public Types
****************************************************************************/
+/* Under CONFIG_BUILD_KERNEL, only priority/stacksize are consumed; main
+ * (and uid/gid/mode, if enabled) are populated but unused.
+ */
+
struct builtin_s
{
FAR const char *name; /* Invocation name and as seen under /sbin/ */
@@ -241,5 +245,5 @@ int builtin_getmode(int index);
}
#endif
-#endif /* CONFIG_BUILTIN */
+#endif /* CONFIG_APP_REGISTRY */
#endif /* __INCLUDE_NUTTX_LIB_BUILTIN_H */
diff --git a/libs/libc/builtin/CMakeLists.txt b/libs/libc/builtin/CMakeLists.txt
index 1be9f03b462..f7587c3a465 100644
--- a/libs/libc/builtin/CMakeLists.txt
+++ b/libs/libc/builtin/CMakeLists.txt
@@ -20,7 +20,7 @@
#
#
##############################################################################
-if(CONFIG_BUILTIN)
+if(CONFIG_APP_REGISTRY)
set(SRCS lib_builtin_getname.c lib_builtin_isavail.c lib_builtin_forindex.c)
if(CONFIG_BUILD_PROTECTED)
diff --git a/libs/libc/builtin/Kconfig b/libs/libc/builtin/Kconfig
index ad94cedee1c..8680ddb7958 100644
--- a/libs/libc/builtin/Kconfig
+++ b/libs/libc/builtin/Kconfig
@@ -13,3 +13,15 @@ config BUILTIN
those names in a file system from which they can be executed.
This feature
is also the underlying requirement to support built-in
applications in the
NuttShell (NSH).
+
+config APP_REGISTRY
+ bool
+ default y if BUILTIN || BUILD_KERNEL
+ ---help---
+ Hidden option indicating that the compile-time
name/priority/stacksize
+ registry table for applications (struct builtin_s /
g_builtins[]) is
+ available. This is a broader condition than BUILTIN:
BUILD_KERNEL
+ cannot select BUILTIN (main_t dispatch is meaningless when the
caller
+ and the application are in different address spaces), but it
still
+ needs this table so that posix_spawn() can pick up each
application's
+ configured priority and stack size.
diff --git a/libs/libc/builtin/Make.defs b/libs/libc/builtin/Make.defs
index afb284e18c7..268ee4f20d3 100644
--- a/libs/libc/builtin/Make.defs
+++ b/libs/libc/builtin/Make.defs
@@ -20,7 +20,7 @@
#
############################################################################
-ifeq ($(CONFIG_BUILTIN),y)
+ifneq ($(CONFIG_APP_REGISTRY),)
# Builtin library files