You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/10/12 10:59:02 UTC
(nuttx) branch master updated (4bcd031cf43 -> 00df758e473)
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 4bcd031cf43 include/elf.h: Add the missing section index and type constants.
new d0036ae5213 sched/task: Fix the nxstyle errors in task_setup.c.
new 00df758e473 sched: Add options for the argument limits of a new task.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
binfmt/binfmt_copyargv.c | 14 ++------------
include/limits.h | 2 +-
sched/Kconfig | 22 ++++++++++++++++++++++
sched/task/task_setup.c | 20 ++++++--------------
4 files changed, 31 insertions(+), 27 deletions(-)
(nuttx) 01/02: sched/task: Fix the nxstyle errors in task_setup.c.
Posted by ac...@apache.org.
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
commit d0036ae5213f8ca22c6d67bd800042dca682b3f4
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 11 10:56:52 2026 +0200
sched/task: Fix the nxstyle errors in task_setup.c.
Add the blank lines after declarations. No code change.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
sched/task/task_setup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c
index 65ee13e7f1c..90689819b3d 100644
--- a/sched/task/task_setup.c
+++ b/sched/task/task_setup.c
@@ -227,6 +227,7 @@ retry:
static inline void nxtask_inherit_affinity(FAR struct tcb_s *tcb)
{
FAR struct tcb_s *rtcb = this_task();
+
tcb->affinity = rtcb->affinity;
}
#else
@@ -359,6 +360,7 @@ static inline void nxtask_save_parent(FAR struct tcb_s *tcb, uint8_t ttype)
static inline void nxtask_dup_dspace(FAR struct tcb_s *tcb)
{
FAR struct tcb_s *rtcb = this_task();
+
if (rtcb->dspace != NULL)
{
/* Copy the D-Space structure reference and increment the reference
(nuttx) 02/02: sched: Add options for the argument limits of a new task.
Posted by ac...@apache.org.
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
commit 00df758e4734f1adaf2d2486938188be82cb1974
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 11 10:57:03 2026 +0200
sched: Add options for the argument limits of a new task.
ARG_MAX was fixed at the POSIX minimum of 4096 bytes, and the argument
count of a new task was fixed at 256 in two places. Programs that
build command lines, such as xargs, size them from ARG_MAX, and some
programs run commands with more than 256 arguments.
Add TASK_ARG_MAX, which sets _POSIX_ARG_MAX and so ARG_MAX, and
TASK_MAX_ARGS, which sets the argument count limit in binfmt and in
nxtask_setup_stackargs(). The defaults are the old values.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
binfmt/binfmt_copyargv.c | 14 ++------------
include/limits.h | 2 +-
sched/Kconfig | 22 ++++++++++++++++++++++
sched/task/task_setup.c | 18 ++++--------------
4 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/binfmt/binfmt_copyargv.c b/binfmt/binfmt_copyargv.c
index bb91847f321..d59aa62e3bf 100644
--- a/binfmt/binfmt_copyargv.c
+++ b/binfmt/binfmt_copyargv.c
@@ -37,16 +37,6 @@
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_BINFMT_DISABLE)
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* This is an artificial limit to detect error conditions where an argv[]
- * list is not properly terminated.
- */
-
-#define MAX_EXEC_ARGS 256
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -95,11 +85,11 @@ int binfmt_copyargv(FAR char * const **copy, FAR char * const *argv)
/* This is a sanity check to prevent running away with an
* unterminated argv[] list.
- * MAX_EXEC_ARGS should be sufficiently large that this
+ * CONFIG_TASK_MAX_ARGS should be sufficiently large that this
* never happens in normal usage.
*/
- if (nargs > MAX_EXEC_ARGS)
+ if (nargs > CONFIG_TASK_MAX_ARGS)
{
berr("ERROR: Too many arguments: %zu\n", argsize);
return -E2BIG;
diff --git a/include/limits.h b/include/limits.h
index a2da21497b2..974adc855fa 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -118,7 +118,7 @@
*
*/
-#define _POSIX_ARG_MAX 4096
+#define _POSIX_ARG_MAX CONFIG_TASK_ARG_MAX
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
diff --git a/sched/Kconfig b/sched/Kconfig
index b20c4be8584..4fb39a2ea40 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -664,6 +664,28 @@ config TASK_NAME_SIZE
will be TASK_NAME_SIZE + 1. The default of 31 then results in
a align-able 32-byte allocation.
+config TASK_ARG_MAX
+ int "Maximum size of the arguments and environment of a new task"
+ default 4096
+ range 4096 2097152
+ ---help---
+ _POSIX_ARG_MAX and ARG_MAX in limits.h, and sysconf(_SC_ARG_MAX): the
+ length in bytes of the arguments plus the environment that
+ programs may pass to exec() or posix_spawn(). POSIX requires at
+ least 4096. Programs such as xargs size their command lines from
+ it. The length is not checked when a task starts, but the
+ arguments are copied to the stack of the new task, so its stack
+ must be large enough for them.
+
+config TASK_MAX_ARGS
+ int "Maximum number of arguments of a new task"
+ default 256
+ range 16 65536
+ ---help---
+ The maximum number of arguments that a new task can get from
+ exec(), posix_spawn() or task_create(). A longer list fails with
+ E2BIG.
+
config SCHED_HAVE_PARENT
bool "Support parent/child task relationships"
default n
diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c
index 90689819b3d..b418f313481 100644
--- a/sched/task/task_setup.c
+++ b/sched/task/task_setup.c
@@ -45,16 +45,6 @@
#include "group/group.h"
#include "task/task.h"
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* This is an artificial limit to detect error conditions where an argv[]
- * list is not properly terminated.
- */
-
-#define MAX_STACK_ARGS 256
-
/****************************************************************************
* Private Data
****************************************************************************/
@@ -570,12 +560,12 @@ int nxtask_setup_stackargs(FAR struct tcb_s *tcb,
{
/* Increment the number of args. Here is a sanity check to
* prevent running away with an unterminated argv[] list.
- * MAX_STACK_ARGS should be sufficiently large that this never
- * happens in normal usage.
+ * CONFIG_TASK_MAX_ARGS should be sufficiently large that this
+ * never happens in normal usage.
*/
- DEBUGASSERT(argc <= MAX_STACK_ARGS);
- if (++argc > MAX_STACK_ARGS)
+ DEBUGASSERT(argc <= CONFIG_TASK_MAX_ARGS);
+ if (++argc > CONFIG_TASK_MAX_ARGS)
{
ret = -E2BIG;
}