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 * 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 */ /* Task list manipulation functions */
bool nxsched_add_readytorun(FAR struct tcb_s *rtrtcb); bool nxsched_add_readytorun(FAR struct tcb_s *rtrtcb);

View File

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

View File

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