mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
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:
+13
-11
@@ -62,15 +62,16 @@
|
||||
* - 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
|
||||
@@ -81,7 +82,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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[])
|
||||
{
|
||||
@@ -153,7 +155,7 @@ int nxtask_init(FAR struct task_tcb_s *tcb, const char *name, int priority,
|
||||
|
||||
/* Setup to pass parameters to the new task */
|
||||
|
||||
nxtask_setup_arguments(tcb, name, argv);
|
||||
nxtask_setup_arguments(tcb, insert_name, name, argv);
|
||||
|
||||
/* Now we have enough in place that we can join the group */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user