sched/posix_spawn: Don't insert name at the begin of argv

since the standard require the caller pass the name explicitly
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html:
The argument argv is an array of character pointers to null-terminated strings.
The last member of this array shall be a null pointer and is not counted in argc.
These strings constitute the argument list available to the new process image.
The value in argv[0] should point to a filename that is associated with the
process image being started by the posix_spawn() or posix_spawnp() function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id79ffcc501ae9552dc4e908418ff555f498be7f1
This commit is contained in:
Xiang Xiao
2021-06-13 13:43:38 +08:00
committed by patacongo
parent 9b8e81ebc1
commit 032086870d
7 changed files with 78 additions and 67 deletions
+12 -10
View File
@@ -908,15 +908,16 @@ FAR struct streamlist *nxsched_get_streams(void);
* - Task type may be set in the TCB flags to create kernel thread
*
* Input Parameters:
* tcb - Address of the new task's TCB
* name - Name of the new task (not used)
* priority - Priority of the new task
* stack - Start of the pre-allocated stack
* stack_size - Size (in bytes) of the stack allocated
* entry - Application start point of the new task
* argv - A pointer to an array of input parameters. The array
* should be terminated with a NULL argv[] value. If no
* parameters are required, argv may be NULL.
* tcb - Address of the new task's TCB
* insert_name - Insert name to the first argv
* name - Name of the new task
* priority - Priority of the new task
* stack - Start of the pre-allocated stack
* stack_size - Size (in bytes) of the stack allocated
* entry - Application start point of the new task
* argv - A pointer to an array of input parameters. The array
* should be terminated with a NULL argv[] value. If no
* parameters are required, argv may be NULL.
*
* Returned Value:
* OK on success; negative error value on failure appropriately. (See
@@ -927,7 +928,8 @@ FAR struct streamlist *nxsched_get_streams(void);
*
****************************************************************************/
int nxtask_init(FAR struct task_tcb_s *tcb, const char *name, int priority,
int nxtask_init(FAR struct task_tcb_s *tcb, bool insert_name,
const char *name, int priority,
FAR void *stack, uint32_t stack_size, main_t entry,
FAR char * const argv[]);