This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 82fb188 sched/spawn: Support the stack address argument
82fb188 is described below
commit 82fb188d02c0c58eb860c4eea8ed9308b29b788c
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed May 12 19:58:35 2021 +0800
sched/spawn: Support the stack address argument
Signed-off-by: Xiang Xiao <[email protected]>
---
include/spawn.h | 10 ++++++++--
libs/libc/spawn/Make.defs | 1 +
...lib_psa_getstacksize.c => lib_psa_getstackaddr.c} | 18 +++++++++---------
libs/libc/spawn/lib_psa_getstacksize.c | 2 +-
...lib_psa_getstacksize.c => lib_psa_setstackaddr.c} | 20 ++++++++++----------
5 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/include/spawn.h b/include/spawn.h
index c999f1b..41649e2 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -85,7 +85,8 @@ struct posix_spawnattr_s
#ifndef CONFIG_BUILD_KERNEL
/* Used only by task_spawn (non-standard) */
- size_t stacksize; /* Task stack size */
+ FAR void *stackaddr; /* Task stack address */
+ size_t stacksize; /* Task stack size */
#endif
#ifdef CONFIG_SCHED_SPORADIC
@@ -211,8 +212,13 @@ int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr,
* task_spawn()
*/
+int task_spawnattr_getstackaddr(FAR const posix_spawnattr_t *attr,
+ FAR void **stackaddr);
+int task_spawnattr_setstackaddr(FAR posix_spawnattr_t *attr,
+ FAR void *stackaddr);
+
int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
- size_t *stacksize);
+ FAR size_t *stacksize);
int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr,
size_t stacksize);
diff --git a/libs/libc/spawn/Make.defs b/libs/libc/spawn/Make.defs
index 972770b..8b55813 100644
--- a/libs/libc/spawn/Make.defs
+++ b/libs/libc/spawn/Make.defs
@@ -32,6 +32,7 @@ CSRCS += lib_psa_init.c lib_psa_setflags.c
lib_psa_setschedparam.c
CSRCS += lib_psa_setschedpolicy.c lib_psa_getsigmask.c lib_psa_setsigmask.c
ifneq ($(CONFIG_BUILD_KERNEL),y)
+CSRCS += lib_psa_getstackaddr.c lib_psa_setstackaddr.c
CSRCS += lib_psa_getstacksize.c lib_psa_setstacksize.c
ifeq ($(CONFIG_LIB_SYSCALL),y)
CSRCS += lib_task_spawn.c
diff --git a/libs/libc/spawn/lib_psa_getstacksize.c
b/libs/libc/spawn/lib_psa_getstackaddr.c
similarity index 80%
copy from libs/libc/spawn/lib_psa_getstacksize.c
copy to libs/libc/spawn/lib_psa_getstackaddr.c
index e94347e..f1c776b 100644
--- a/libs/libc/spawn/lib_psa_getstacksize.c
+++ b/libs/libc/spawn/lib_psa_getstackaddr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/spawn/lib_psa_getstacksize.c
+ * libs/libc/spawn/lib_psa_getstackaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -35,16 +35,16 @@
****************************************************************************/
/****************************************************************************
- * Name: task_spawnattr_getstacksize
+ * Name: task_spawnattr_getstackaddr
*
* Description:
- * The task_spawnattr_getstacksize() function will obtain the value of
- * the spawn-stacksize attribute from the attributes object referenced
+ * The task_spawnattr_getstackaddr() function will obtain the value of
+ * the spawn-stackaddr attribute from the attributes object referenced
* by attr.
*
* Input Parameters:
* attr - The address spawn attributes to be queried.
- * stacksize - The location to return the spawn-stacksize value.
+ * stackaddr - The location to return the spawn-stackaddr value.
*
* Returned Value:
* On success, these functions return 0; on failure they return an error
@@ -52,11 +52,11 @@
*
****************************************************************************/
-int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
- size_t *stacksize)
+int task_spawnattr_getstackaddr(FAR const posix_spawnattr_t *attr,
+ FAR void **stackaddr)
{
- DEBUGASSERT(attr && stacksize);
- *stacksize = attr->stacksize;
+ DEBUGASSERT(attr && stackaddr);
+ *stackaddr = attr->stackaddr;
return OK;
}
diff --git a/libs/libc/spawn/lib_psa_getstacksize.c
b/libs/libc/spawn/lib_psa_getstacksize.c
index e94347e..748fb52 100644
--- a/libs/libc/spawn/lib_psa_getstacksize.c
+++ b/libs/libc/spawn/lib_psa_getstacksize.c
@@ -53,7 +53,7 @@
****************************************************************************/
int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
- size_t *stacksize)
+ FAR size_t *stacksize)
{
DEBUGASSERT(attr && stacksize);
*stacksize = attr->stacksize;
diff --git a/libs/libc/spawn/lib_psa_getstacksize.c
b/libs/libc/spawn/lib_psa_setstackaddr.c
similarity index 77%
copy from libs/libc/spawn/lib_psa_getstacksize.c
copy to libs/libc/spawn/lib_psa_setstackaddr.c
index e94347e..dc24aee 100644
--- a/libs/libc/spawn/lib_psa_getstacksize.c
+++ b/libs/libc/spawn/lib_psa_setstackaddr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/spawn/lib_psa_getstacksize.c
+ * libs/libc/spawn/lib_psa_setstackaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -35,16 +35,16 @@
****************************************************************************/
/****************************************************************************
- * Name: task_spawnattr_getstacksize
+ * Name: task_spawnattr_setstackaddr
*
* Description:
- * The task_spawnattr_getstacksize() function will obtain the value of
- * the spawn-stacksize attribute from the attributes object referenced
+ * The task_spawnattr_setstackaddr() function shall set the spawn-
+ * stackaddr attribute in an initialized attributes object referenced
* by attr.
*
* Input Parameters:
- * attr - The address spawn attributes to be queried.
- * stacksize - The location to return the spawn-stacksize value.
+ * attr - The address spawn attributes to be used.
+ * stackaddr - The new stackaddr to set.
*
* Returned Value:
* On success, these functions return 0; on failure they return an error
@@ -52,11 +52,11 @@
*
****************************************************************************/
-int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
- size_t *stacksize)
+int task_spawnattr_setstackaddr(FAR posix_spawnattr_t *attr,
+ FAR void *stackaddr)
{
- DEBUGASSERT(attr && stacksize);
- *stacksize = attr->stacksize;
+ DEBUGASSERT(attr);
+ attr->stackaddr = stackaddr;
return OK;
}