sched/spawn: Launch nxposix_spawn_proxy through nxthread_create

to ensure the caller environment variable always get copied

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-16 21:27:03 +08:00 committed by Masayuki Ishikawa
parent aed85964ff
commit 9ccddde6a9
3 changed files with 12 additions and 12 deletions

View File

@ -297,6 +297,10 @@ extern volatile spinlock_t g_cpu_tasklistlock;
* Public Function Prototypes
****************************************************************************/
int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
FAR void *stack_ptr, int stack_size, main_t entry,
FAR char * const argv[], FAR char * const envp[]);
/* Task list manipulation functions */
bool nxsched_add_readytorun(FAR struct tcb_s *rtrtcb);

View File

@ -39,7 +39,7 @@
#include "task/task.h"
/****************************************************************************
* Private Functions
* Public Functions
****************************************************************************/
/****************************************************************************
@ -70,7 +70,7 @@
*
****************************************************************************/
static int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
FAR void *stack_ptr, int stack_size, main_t entry,
FAR char * const argv[], FAR char * const envp[])
{
@ -112,10 +112,6 @@ static int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
return (int)pid;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxtask_create
*

View File

@ -388,10 +388,10 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
* task.
*/
proxy = kthread_create("nxposix_spawn_proxy", param.sched_priority,
proxy = nxthread_create("nxposix_spawn_proxy", TCB_FLAG_TTYPE_KERNEL,
param.sched_priority, NULL,
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
(main_t)nxposix_spawn_proxy,
(FAR char * const *)NULL);
nxposix_spawn_proxy, NULL, environ);
if (proxy < 0)
{
ret = -proxy;