This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().

Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
This commit is contained in:
Gregory Nutt 2019-02-04 13:42:51 -06:00
parent 05b85c8717
commit bb623d1e04
60 changed files with 354 additions and 345 deletions

View file

@ -479,7 +479,7 @@ int task_delete(pid_t pid);
Its stack and TCB will be deallocated.
This function is the companion to <code>task_create()</code>.
This is the version of the function exposed to the user;
it is simply a wrapper around the internal, <code>task_terminate()</code> function.
it is simply a wrapper around the internal, <code>nxtask_terminate()</code> function.
</p>
<p>
The logic in this function only deletes non-running tasks.

View file

@ -71,8 +71,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -83,8 +83,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -72,8 +72,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -84,8 +84,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -101,7 +101,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
* configured and of what kind of thread is being started. That is
* because all threads, even user-mode threads will start in kernel
* trampoline at task_start() or pthread_start(). The thread's
* trampoline at nxtask_start() or pthread_start(). The thread's
* privileges will be dropped before transitioning to user code.
*/

View file

@ -73,8 +73,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB.
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB.
* This consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -85,8 +85,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -73,8 +73,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -85,8 +85,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -74,8 +74,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -86,8 +86,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -113,7 +113,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
* configured and of what kind of thread is being started. That is
* because all threads, even user-mode threads will start in kernel
* trampoline at task_start() or pthread_start(). The thread's
* trampoline at nxtask_start() or pthread_start(). The thread's
* privileges will be dropped before transitioning to user code.
*/

View file

@ -73,8 +73,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB.
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB.
* This consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -85,8 +85,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -167,7 +167,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -81,8 +81,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -93,10 +93,10 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
* nxtask_vforkabort() may be called if an error occurs between steps 3 and 6.
*
* Input Parameters:
* context - Caller context information saved by vfork()
@ -131,10 +131,10 @@ pid_t up_vfork(const struct vfork_s *context)
/* Allocate and initialize a TCB for the child task. */
child = task_vforksetup((start_t)(context->lr & ~1), &argsize);
child = nxtask_vforksetup((start_t)(context->lr & ~1), &argsize);
if (!child)
{
serr("ERROR: task_vforksetup failed\n");
serr("ERROR: nxtask_vforksetup failed\n");
return (pid_t)ERROR;
}
@ -154,7 +154,7 @@ pid_t up_vfork(const struct vfork_s *context)
if (ret != OK)
{
serr("ERROR: up_create_stack failed: %d\n", ret);
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
return (pid_t)ERROR;
}
@ -266,9 +266,9 @@ pid_t up_vfork(const struct vfork_s *context)
}
#endif
/* And, finally, start the child task. On a failure, task_vforkstart()
* will discard the TCB by calling task_vforkabort().
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
* will discard the TCB by calling nxtask_vforkabort().
*/
return task_vforkstart(child);
return nxtask_vforkstart(child);
}

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -168,7 +168,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -83,8 +83,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -95,10 +95,10 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
* nxtask_vforkabort() may be called if an error occurs between steps 3 and 6.
*
* Input Parameters:
* context - Caller context information saved by vfork()
@ -151,10 +151,10 @@ pid_t up_vfork(const struct vfork_s *context)
/* Allocate and initialize a TCB for the child task. */
child = task_vforksetup((start_t)context->ra, &argsize);
child = nxtask_vforksetup((start_t)context->ra, &argsize);
if (!child)
{
sinfo("task_vforksetup failed\n");
sinfo("nxtask_vforksetup failed\n");
return (pid_t)ERROR;
}
@ -174,7 +174,7 @@ pid_t up_vfork(const struct vfork_s *context)
if (ret != OK)
{
serr("ERROR: up_create_stack failed: %d\n", ret);
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
return (pid_t)ERROR;
}
@ -254,9 +254,9 @@ pid_t up_vfork(const struct vfork_s *context)
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
#endif
/* And, finally, start the child task. On a failure, task_vforkstart()
* will discard the TCB by calling task_vforkabort().
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
* will discard the TCB by calling nxtask_vforkabort().
*/
return task_vforkstart(child);
return nxtask_vforkstart(child);
}

View file

@ -71,8 +71,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -83,8 +83,8 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* None

View file

@ -161,7 +161,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -168,7 +168,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -83,8 +83,8 @@
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) up_vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -95,10 +95,10 @@
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
* nxtask_vforkabort() may be called if an error occurs between steps 3 and 6.
*
* Input Parameters:
* context - Caller context information saved by vfork()
@ -155,10 +155,10 @@ pid_t up_vfork(const struct vfork_s *context)
/* Allocate and initialize a TCB for the child task. */
child = task_vforksetup((start_t)context->ra, &argsize);
child = nxtask_vforksetup((start_t)context->ra, &argsize);
if (!child)
{
sinfo("task_vforksetup failed\n");
sinfo("nxtask_vforksetup failed\n");
return (pid_t)ERROR;
}
@ -178,7 +178,7 @@ pid_t up_vfork(const struct vfork_s *context)
if (ret != OK)
{
serr("ERROR: up_create_stack failed: %d\n", ret);
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
return (pid_t)ERROR;
}
@ -258,11 +258,11 @@ pid_t up_vfork(const struct vfork_s *context)
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
#endif
/* And, finally, start the child task. On a failure, task_vforkstart()
* will discard the TCB by calling task_vforkabort().
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
* will discard the TCB by calling nxtask_vforkabort().
*/
return task_vforkstart(child);
return nxtask_vforkstart(child);
}
#endif /* CONFIG_ARCH_HAVE_VFORK */

View file

@ -75,7 +75,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -173,7 +173,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -166,7 +166,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -168,7 +168,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)task_exit();
(void)nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.

View file

@ -257,7 +257,7 @@ int exec_module(FAR const struct binary_s *binp)
if (binp->nctors > 0)
{
task_starthook(tcb, exec_ctors, (FAR void *)binp);
nxtask_starthook(tcb, exec_ctors, (FAR void *)binp);
}
#endif

View file

@ -128,7 +128,7 @@ Status
until sched_resume_scheduler() runs. These commits were made:
commit 50ab5d638a37b539775d1e60085f182bf26be57f
sched/task: It is not appropriate for logic in task_exit() to call
sched/task: It is not appropriate for logic in nxtask_exit() to call
the new version of this_task(). sched/irq: Remove redundant fetch
of CPU index; configs/sabre-6quad: update README.

View file

@ -875,7 +875,7 @@ FAR struct socketlist *sched_getsockets(void);
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
/********************************************************************************
* Name: task_starthook
* Name: nxtask_starthook
*
* Description:
* Configure a start hook... a function that will be called on the thread
@ -894,8 +894,8 @@ FAR struct socketlist *sched_getsockets(void);
********************************************************************************/
#ifdef CONFIG_SCHED_STARTHOOK
void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
FAR void *arg);
void nxtask_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
FAR void *arg);
#endif
/********************************************************************************
@ -903,8 +903,8 @@ void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
*
* 1) User code calls vfork(). vfork() is provided in architecture-specific
* code.
* 2) vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -915,16 +915,16 @@ void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
* nxtask_vforkabort() may be called if an error occurs between steps 3 and 6.
*
********************************************************************************/
FAR struct task_tcb_s *task_vforksetup(start_t retaddr, size_t *argsize);
pid_t task_vforkstart(FAR struct task_tcb_s *child);
void task_vforkabort(FAR struct task_tcb_s *child, int errcode);
FAR struct task_tcb_s *nxtask_vforksetup(start_t retaddr, size_t *argsize);
pid_t nxtask_vforkstart(FAR struct task_tcb_s *child);
void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode);
/****************************************************************************
* Name: group_exitinfo

View file

@ -113,24 +113,24 @@ struct userspace_s
/* Task/thread startup routines */
void (*task_startup)(main_t entrypt, int argc, FAR char *argv[])
CODE void (*task_startup)(main_t entrypt, int argc, FAR char *argv[])
noreturn_function;
#ifndef CONFIG_DISABLE_PTHREAD
void (*pthread_startup)(pthread_startroutine_t entrypt,
CODE void (*pthread_startup)(pthread_startroutine_t entrypt,
pthread_addr_t arg);
#endif
/* Signal handler trampoline */
#ifndef CONFIG_DISABLE_SIGNALS
void (*signal_handler)(_sa_sigaction_t sighand, int signo,
CODE void (*signal_handler)(_sa_sigaction_t sighand, int signo,
FAR siginfo_t *info, FAR void *ucontext);
#endif
/* User-space work queue support */
#ifdef CONFIG_LIB_USRWORK
int (*work_usrstart)(void);
CODE int (*work_usrstart)(void);
#endif
};

View file

@ -1212,8 +1212,8 @@ config SCHED_STARTHOOK
bool "Enable startup hook"
default n
---help---
Enable a non-standard, internal OS API call task_starthook().
task_starthook() registers a function that will be called on task
Enable a non-standard, internal OS API call nxtask_starthook().
nxtask_starthook() registers a function that will be called on task
startup before that actual task entry point is called. The
starthook is useful, for example, for setting up automatic
configuration of C++ constructors.

View file

@ -84,7 +84,7 @@ static const char g_idlename[] = "CPUn Idle"
* This is the common start-up logic for the IDLE task for CPUs 1 through
* (CONFIG_SMP_NCPUS-1). Having a start-up function such as this for the
* IDLE is not really an architectural necessity. It is used only for
* symmetry with now other threads are started (see task_start() and
* symmetry with now other threads are started (see nxtask_start() and
* pthread_start()).
*
* Input Parameters:

View file

@ -72,7 +72,7 @@
void nxmq_recover(FAR struct tcb_s *tcb)
{
/* If were were waiting for a timed message queue event, then the
* timer was canceled and deleted in task_recover() before this
* timer was canceled and deleted in nxtask_recover() before this
* function was called.
*/

View file

@ -124,7 +124,7 @@ int pthread_cancel(pthread_t thread)
if (tcb->cmn.cpcount > 0)
{
notify_cancellation(&tcb->cmn);
nxnotify_cancellation(&tcb->cmn);
}
sched_unlock();
@ -168,7 +168,7 @@ int pthread_cancel(pthread_t thread)
pthread_mutex_inconsistent(tcb);
#endif
/* Then let task_terminate do the real work */
/* Then let nxtask_terminate do the real work */
return task_terminate((pid_t)thread, false);
return nxtask_terminate((pid_t)thread, false);
}

View file

@ -94,7 +94,7 @@ static const char g_pthreadname[] = "<pthread>";
* This functions sets up parameters in the Task Control Block (TCB) in
* preparation for starting a new thread.
*
* pthread_argsetup() is called from task_init() and task_start() to create
* pthread_argsetup() is called from task_init() and nxtask_start() to create
* a new task (with arguments cloned via strdup) or pthread_create() which
* has one argument passed by value (distinguished by the pthread boolean
* argument).

View file

@ -137,7 +137,7 @@ void pthread_exit(FAR void *exit_value)
* (2) so that we can flush buffered I/O (which may required suspending).
*/
task_exithook(tcb, EXIT_SUCCESS, false);
nxtask_exithook(tcb, EXIT_SUCCESS, false);
/* Then just exit, retaining all file descriptors and without
* calling atexit() functions.

View file

@ -53,7 +53,7 @@
* Name: nxsem_recover
*
* Description:
* This function is called from task_recover() when a task is deleted via
* This function is called from nxtask_recover() when a task is deleted via
* task_delete() or via pthread_cancel(). It current only checks on the
* case where a task is waiting for semaphore at the time that is was
* killed.

View file

@ -527,7 +527,7 @@ bool nxsig_iscatchable(int signo)
* Name: nxsig_default_initialize
*
* Description:
* Set all signals to their default action. This is called from task_start
* Set all signals to their default action. This is called from nxtask_start
* to configure the newly started task.
*
* Input Parameters:

View file

@ -92,7 +92,7 @@ void exit(int status)
* so that we can flush buffered I/O (both of which may required suspending).
*/
task_exithook(tcb, status, false);
nxtask_exithook(tcb, status, false);
/* Then "really" exit. Only the lower 8 bits of the exit status are used. */

View file

@ -67,23 +67,23 @@ struct tcb_s; /* Forward reference */
/* Task start-up */
void task_start(void);
int task_schedsetup(FAR struct task_tcb_s *tcb, int priority,
void nxtask_start(void);
int nxtask_schedsetup(FAR struct task_tcb_s *tcb, int priority,
start_t start, main_t main, uint8_t ttype);
int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
int nxtask_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
FAR char * const argv[]);
/* Task exit */
int task_exit(void);
int task_terminate(pid_t pid, bool nonblocking);
void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking);
void task_recover(FAR struct tcb_s *tcb);
int nxtask_exit(void);
int nxtask_terminate(pid_t pid, bool nonblocking);
void nxtask_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking);
void nxtask_recover(FAR struct tcb_s *tcb);
/* Cancellation points */
#ifdef CONFIG_CANCELLATION_POINTS
void notify_cancellation(FAR struct tcb_s *tcb);
void nxnotify_cancellation(FAR struct tcb_s *tcb);
#endif
#endif /* __SCHED_TASK_TASK_H */

View file

@ -54,7 +54,7 @@
* Name: task_activate
*
* Description:
* This function activates tasks initialized by task_schedsetup(). Without
* This function activates tasks initialized by nxtask_schedsetup(). Without
* activation, a task is ineligible for execution by the scheduler.
*
* Input Parameters:

View file

@ -315,7 +315,7 @@ bool check_cancellation_point(void)
}
/****************************************************************************
* Name: notify_cancellation
* Name: nxnotify_cancellation
*
* Description:
* Called by task_delete() or pthread_cancel() if the cancellation occurs
@ -327,7 +327,7 @@ bool check_cancellation_point(void)
*
****************************************************************************/
void notify_cancellation(FAR struct tcb_s *tcb)
void nxnotify_cancellation(FAR struct tcb_s *tcb)
{
irqstate_t flags;

View file

@ -1,8 +1,8 @@
/****************************************************************************
* sched/task/task_create.c
*
* Copyright (C) 2007-2010, 2013-2014, 2016, 2018 Gregory Nutt. All rights
* reserved.
* Copyright (C) 2007-2010, 2013-2014, 2016, 2018-2019 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -58,7 +58,7 @@
****************************************************************************/
/****************************************************************************
* Name: thread_create
* Name: nxthread_create
*
* Description:
* This function creates and activates a new thread of the specified type
@ -83,9 +83,9 @@
*
****************************************************************************/
static int thread_create(FAR const char *name, uint8_t ttype, int priority,
int stack_size, main_t entry,
FAR char * const argv[])
static int nxthread_create(FAR const char *name, uint8_t ttype,
int priority, int stack_size, main_t entry,
FAR char * const argv[])
{
FAR struct task_tcb_s *tcb;
pid_t pid;
@ -140,7 +140,7 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
/* Initialize the task control block */
ret = task_schedsetup(tcb, priority, task_start, entry, ttype);
ret = nxtask_schedsetup(tcb, priority, nxtask_start, entry, ttype);
if (ret < OK)
{
goto errout_with_tcb;
@ -148,7 +148,7 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
/* Setup to pass parameters to the new task */
(void)task_argsetup(tcb, name, argv);
(void)nxtask_argsetup(tcb, name, argv);
#ifdef HAVE_TASK_GROUP
/* Now we have enough in place that we can join the group */
@ -172,7 +172,7 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
ret = -get_errno();
DEBUGASSERT(ret < 0);
/* The TCB was added to the active task list by task_schedsetup() */
/* The TCB was added to the active task list by nxtask_schedsetup() */
dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
goto errout_with_tcb;
@ -230,8 +230,8 @@ errout_with_tcb:
int nxtask_create(FAR const char *name, int priority,
int stack_size, main_t entry, FAR char * const argv[])
{
return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size,
entry, argv);
return nxthread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size,
entry, argv);
}
/****************************************************************************
@ -308,6 +308,6 @@ int task_create(FAR const char *name, int priority,
int kthread_create(FAR const char *name, int priority,
int stack_size, main_t entry, FAR char *const argv[])
{
return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size,
entry, argv);
return nxthread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size,
entry, argv);
}

View file

@ -59,7 +59,7 @@
* This function causes a specified task to cease to exist. Its stack and
* TCB will be deallocated. This function is the companion to
* task_create(). This is the version of the function exposed to the
* user; it is simply a wrapper around the internal, task_terminate
* user; it is simply a wrapper around the internal, nxtask_terminate
* function.
*
* The logic in this function only deletes non-running tasks. If the
@ -175,7 +175,7 @@ int task_delete(pid_t pid)
if (dtcb->cpcount > 0)
{
notify_cancellation(dtcb);
nxnotify_cancellation(dtcb);
}
sched_unlock();
@ -196,10 +196,10 @@ int task_delete(pid_t pid)
}
/* Otherwise, perform the asynchronous cancellation, letting
* task_terminate() do all of the heavy lifting.
* nxtask_terminate() do all of the heavy lifting.
*/
ret = task_terminate(pid, false);
ret = nxtask_terminate(pid, false);
if (ret < 0)
{
errcode = -ret;

View file

@ -54,7 +54,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_exit
* Name: nxtask_exit
*
* Description:
* This is a part of the logic used to implement _exit(). The full
@ -81,7 +81,7 @@
*
****************************************************************************/
int task_exit(void)
int nxtask_exit(void)
{
FAR struct tcb_s *dtcb;
FAR struct tcb_s *rtcb;
@ -149,13 +149,13 @@ int task_exit(void)
rtcb->task_state = TSTATE_TASK_READYTORUN;
/* Move the TCB to the specified blocked task list and delete it. Calling
* task_terminate with non-blocking true will suppress atexit() and on-exit()
* nxtask_terminate with non-blocking true will suppress atexit() and on-exit()
* calls and will cause buffered I/O to fail to be flushed. The former
* is required _exit() behavior; the latter is optional _exit() behavior.
*/
sched_addblocked(dtcb, TSTATE_TASK_INACTIVE);
ret = task_terminate(dtcb->pid, true);
ret = nxtask_terminate(dtcb->pid, true);
rtcb->task_state = TSTATE_TASK_RUNNING;
/* Decrement the lockcount on rctb. */

View file

@ -1,7 +1,8 @@
/****************************************************************************
* sched/task/task_exithook.c
*
* Copyright (C) 2011-2013, 2015. 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013, 2015. 2018-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -58,7 +59,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_atexit
* Name: nxtask_atexit
*
* Description:
* Call any registered atexit function(s)
@ -66,7 +67,7 @@
****************************************************************************/
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
static inline void task_atexit(FAR struct tcb_s *tcb)
static inline void nxtask_atexit(FAR struct tcb_s *tcb)
{
FAR struct task_group_s *group = tcb->group;
@ -128,11 +129,11 @@ static inline void task_atexit(FAR struct tcb_s *tcb)
}
}
#else
# define task_atexit(tcb)
# define nxtask_atexit(tcb)
#endif
/****************************************************************************
* Name: task_onexit
* Name: nxtask_onexit
*
* Description:
* Call any registered on_exit function(s)
@ -140,7 +141,7 @@ static inline void task_atexit(FAR struct tcb_s *tcb)
****************************************************************************/
#ifdef CONFIG_SCHED_ONEXIT
static inline void task_onexit(FAR struct tcb_s *tcb, int status)
static inline void nxtask_onexit(FAR struct tcb_s *tcb, int status)
{
FAR struct task_group_s *group = tcb->group;
@ -202,11 +203,11 @@ static inline void task_onexit(FAR struct tcb_s *tcb, int status)
}
}
#else
# define task_onexit(tcb,status)
# define nxtask_onexit(tcb,status)
#endif
/****************************************************************************
* Name: task_exitstatus
* Name: nxtask_exitstatus
*
* Description:
* Report exit status when main task of a task group exits
@ -214,7 +215,8 @@ static inline void task_onexit(FAR struct tcb_s *tcb, int status)
****************************************************************************/
#ifdef CONFIG_SCHED_CHILD_STATUS
static inline void task_exitstatus(FAR struct task_group_s *group, int status)
static inline void nxtask_exitstatus(FAR struct task_group_s *group,
int status)
{
FAR struct child_status_s *child;
@ -245,12 +247,12 @@ static inline void task_exitstatus(FAR struct task_group_s *group, int status)
}
#else
# define task_exitstatus(group,status)
# define nxtask_exitstatus(group,status)
#endif /* CONFIG_SCHED_CHILD_STATUS */
/****************************************************************************
* Name: task_groupexit
* Name: nxtask_groupexit
*
* Description:
* Mark that the final thread of a child task group as exited.
@ -258,7 +260,7 @@ static inline void task_exitstatus(FAR struct task_group_s *group, int status)
****************************************************************************/
#ifdef CONFIG_SCHED_CHILD_STATUS
static inline void task_groupexit(FAR struct task_group_s *group)
static inline void nxtask_groupexit(FAR struct task_group_s *group)
{
FAR struct child_status_s *child;
@ -282,12 +284,12 @@ static inline void task_groupexit(FAR struct task_group_s *group)
#else
# define task_groupexit(group)
# define nxtask_groupexit(group)
#endif /* CONFIG_SCHED_CHILD_STATUS */
/****************************************************************************
* Name: task_sigchild
* Name: nxtask_sigchild
*
* Description:
* Send the SIGCHILD signal to the parent thread
@ -296,7 +298,8 @@ static inline void task_groupexit(FAR struct task_group_s *group)
#if defined(CONFIG_SCHED_HAVE_PARENT) && !defined(CONFIG_DISABLE_SIGNALS)
#ifdef HAVE_GROUP_MEMBERS
static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status)
static inline void nxtask_sigchild(gid_t pgid, FAR struct tcb_s *ctcb,
int status)
{
FAR struct task_group_s *chgrp = ctcb->group;
FAR struct task_group_s *pgrp;
@ -329,7 +332,7 @@ static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status)
if ((ctcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD)
#endif
{
task_exitstatus(pgrp, status);
nxtask_exitstatus(pgrp, status);
}
/* But only the final exiting thread in a task group, whatever it is,
@ -340,7 +343,7 @@ static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status)
{
/* Mark that all of the threads in the task group have exited */
task_groupexit(pgrp);
nxtask_groupexit(pgrp);
/* Create the siginfo structure. We don't actually know the cause.
* That is a bug. Let's just say that the child task just exited
@ -366,8 +369,8 @@ static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status)
#else /* HAVE_GROUP_MEMBERS */
static inline void task_sigchild(FAR struct tcb_s *ptcb,
FAR struct tcb_s *ctcb, int status)
static inline void nxtask_sigchild(FAR struct tcb_s *ptcb,
FAR struct tcb_s *ctcb, int status)
{
siginfo_t info;
@ -383,7 +386,7 @@ static inline void task_sigchild(FAR struct tcb_s *ptcb,
#ifdef CONFIG_SCHED_CHILD_STATUS
/* Save the exit status now of the main thread */
task_exitstatus(ptcb->group, status);
nxtask_exitstatus(ptcb->group, status);
#else /* CONFIG_SCHED_CHILD_STATUS */
/* Exit status is not retained. Just decrement the number of
@ -422,12 +425,12 @@ static inline void task_sigchild(FAR struct tcb_s *ptcb,
#endif /* HAVE_GROUP_MEMBERS */
#else /* CONFIG_SCHED_HAVE_PARENT && !CONFIG_DISABLE_SIGNALS */
# define task_sigchild(x,ctcb,status)
# define nxtask_sigchild(x,ctcb,status)
#endif /* CONFIG_SCHED_HAVE_PARENT && !CONFIG_DISABLE_SIGNALS */
/****************************************************************************
* Name: task_signalparent
* Name: nxtask_signalparent
*
* Description:
* Send the SIGCHILD signal to the parent task group
@ -435,7 +438,7 @@ static inline void task_sigchild(FAR struct tcb_s *ptcb,
****************************************************************************/
#ifdef CONFIG_SCHED_HAVE_PARENT
static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status)
{
#ifdef HAVE_GROUP_MEMBERS
DEBUGASSERT(ctcb && ctcb->group);
@ -446,7 +449,7 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
/* Send SIGCHLD to all members of the parent's task group */
task_sigchild(ctcb->group->tg_pgid, ctcb, status);
nxtask_sigchild(ctcb->group->tg_pgid, ctcb, status);
sched_unlock();
#else
FAR struct tcb_s *ptcb;
@ -456,7 +459,7 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
sched_lock();
/* Get the TCB of the receiving, parent task. We do this early to
* handle multiple calls to task_signalparent. ctcb->group->tg_ppid is
* handle multiple calls to nxtask_signalparent. ctcb->group->tg_ppid is
* set to an invalid value below and the following call will fail if we
* are called again.
*/
@ -472,7 +475,7 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
/* Send SIGCHLD to all members of the parent's task group */
task_sigchild(ptcb, ctcb, status);
nxtask_sigchild(ptcb, ctcb, status);
/* Forget who our parent was */
@ -481,11 +484,11 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
#endif
}
#else
# define task_signalparent(ctcb,status)
# define nxtask_signalparent(ctcb,status)
#endif
/****************************************************************************
* Name: task_exitwakeup
* Name: nxtask_exitwakeup
*
* Description:
* Wakeup any tasks waiting for this task to exit
@ -493,7 +496,7 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
****************************************************************************/
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
static inline void task_exitwakeup(FAR struct tcb_s *tcb, int status)
static inline void nxtask_exitwakeup(FAR struct tcb_s *tcb, int status)
{
FAR struct task_group_s *group = tcb->group;
@ -549,11 +552,11 @@ static inline void task_exitwakeup(FAR struct tcb_s *tcb, int status)
}
}
#else
# define task_exitwakeup(tcb, status)
# define nxtask_exitwakeup(tcb, status)
#endif
/****************************************************************************
* Name: task_flushstreams
* Name: nxtask_flushstreams
*
* Description:
* Flush all streams when the final thread of a group exits.
@ -561,7 +564,7 @@ static inline void task_exitwakeup(FAR struct tcb_s *tcb, int status)
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0
static inline void task_flushstreams(FAR struct tcb_s *tcb)
static inline void nxtask_flushstreams(FAR struct tcb_s *tcb)
{
FAR struct task_group_s *group = tcb->group;
@ -578,7 +581,7 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb)
}
}
#else
# define task_flushstreams(tcb)
# define nxtask_flushstreams(tcb)
#endif
/****************************************************************************
@ -586,7 +589,7 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb)
****************************************************************************/
/****************************************************************************
* Name: task_exithook
* Name: nxtask_exithook
*
* Description:
* This function implements some of the internal logic of exit() and
@ -601,20 +604,20 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb)
* to-run list. The following logic is safe because we will not be
* returning from the exit() call.
*
* When called from task_terminate() we are operating on a different thread;
* on the thread that called task_delete(). In this case, task_delete
* will have already removed the tcb from the ready-to-run list to prevent
* any further action on this task.
* When called from nxtask_terminate() we are operating on a different
* thread; on the thread that called task_delete(). In this case,
* task_delete will have already removed the tcb from the ready-to-run
* list to prevent any further action on this task.
*
* nonblocking will be set true only when we are called from task_terminate()
* via _exit(). In that case, we must be careful to do nothing that can
* cause the cause the thread to block.
* nonblocking will be set true only when we are called from
* nxtask_terminate() via _exit(). In that case, we must be careful to do
* nothing that can cause the cause the thread to block.
*
****************************************************************************/
void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
void nxtask_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
{
/* Under certain conditions, task_exithook() can be called multiple times.
/* Under certain conditions, nxtask_exithook() can be called multiple times.
* A bit in the TCB was set the first time this function was called. If
* that bit is set, then just exit doing nothing more..
*/
@ -653,11 +656,11 @@ void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
if (!nonblocking)
{
task_atexit(tcb);
nxtask_atexit(tcb);
/* Call any registered on_exit function(s) */
task_onexit(tcb, status);
nxtask_onexit(tcb, status);
}
#endif
@ -665,15 +668,15 @@ void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
* state. Make some feeble effort to recover the state.
*/
task_recover(tcb);
nxtask_recover(tcb);
/* Send the SIGCHILD signal to the parent task group */
task_signalparent(tcb, status);
nxtask_signalparent(tcb, status);
/* Wakeup any tasks waiting for this task to exit */
task_exitwakeup(tcb, status);
nxtask_exitwakeup(tcb, status);
/* If this is the last thread in the group, then flush all streams (File
* descriptors will be closed when the TCB is deallocated).
@ -688,7 +691,7 @@ void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
if (!nonblocking)
{
task_flushstreams(tcb);
nxtask_flushstreams(tcb);
}
#ifdef HAVE_TASK_GROUP

View file

@ -80,7 +80,7 @@
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately. (See
* task_schedsetup() for possible failure conditions). On failure, the
* nxtask_schedsetup() for possible failure conditions). On failure, the
* caller is responsible for freeing the stack memory and for calling
* sched_releasetcb() to free the TCB (which could be in most any state).
*
@ -129,8 +129,8 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
/* Initialize the task control block */
ret = task_schedsetup(ttcb, priority, task_start, entry,
TCB_FLAG_TTYPE_TASK);
ret = nxtask_schedsetup(ttcb, priority, nxtask_start, entry,
TCB_FLAG_TTYPE_TASK);
if (ret < OK)
{
errcode = -ret;
@ -139,7 +139,7 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
/* Setup to pass parameters to the new task */
(void)task_argsetup(ttcb, name, argv);
(void)nxtask_argsetup(ttcb, name, argv);
/* Now we have enough in place that we can join the group */

View file

@ -1,7 +1,7 @@
/****************************************************************************
* sched/task/task_posixspawn.c
*
* Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -58,7 +58,7 @@
****************************************************************************/
/****************************************************************************
* Name: posix_spawn_exec
* Name: nxposix_spawn_exec
*
* Description:
* Execute the task from the file system.
@ -96,9 +96,9 @@
*
****************************************************************************/
static int posix_spawn_exec(FAR pid_t *pidp, FAR const char *path,
FAR const posix_spawnattr_t *attr,
FAR char * const argv[])
static int nxposix_spawn_exec(FAR pid_t *pidp, FAR const char *path,
FAR const posix_spawnattr_t *attr,
FAR char * const argv[])
{
FAR const struct symtab_s *symtab;
int nsymbols;
@ -153,18 +153,18 @@ errout:
}
/****************************************************************************
* Name: posix_spawn_proxy
* Name: nxposix_spawn_proxy
*
* Description:
* Perform file_actions, then execute the task from the file system.
*
* Do we really need this proxy task? Isn't that wasteful?
*
* Q: Why not use a starthook so that there is callout from task_start()
* Q: Why not use a starthook so that there is callout from nxtask_start()
* to perform these operations after the file is loaded from
* the file system?
* A: That existing task_starthook() implementation cannot be used in
* this context; any of task_starthook() will also conflict with
* A: That existing nxtask_starthook() implementation cannot be used in
* this context; any of nxtask_starthook() will also conflict with
* binfmt's use of the start hook to call C++ static initializers.
* task_restart() would also be an issue.
*
@ -176,7 +176,7 @@ errout:
*
****************************************************************************/
static int posix_spawn_proxy(int argc, FAR char *argv[])
static int nxposix_spawn_proxy(int argc, FAR char *argv[])
{
int ret;
@ -200,8 +200,8 @@ static int posix_spawn_proxy(int argc, FAR char *argv[])
{
/* Start the task */
ret = posix_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.posix.path,
g_spawn_parms.attr, g_spawn_parms.argv);
ret = nxposix_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.posix.path,
g_spawn_parms.attr, g_spawn_parms.argv);
#ifdef CONFIG_SCHED_HAVE_PARENT
if (ret == OK)
@ -363,7 +363,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
if (file_actions == NULL || *file_actions == NULL)
#endif
{
return posix_spawn_exec(pid, path, attr, argv);
return nxposix_spawn_exec(pid, path, attr, argv);
}
/* Otherwise, we will have to go through an intermediary/proxy task in order
@ -401,9 +401,9 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
}
/* Disable pre-emption so that the proxy does not run until waitpid
* is called. This is probably unnecessary since the posix_spawn_proxy has
* the same priority as this thread; it should be schedule behind this
* task in the ready-to-run list.
* is called. This is probably unnecessary since the nxposix_spawn_proxy
* has the same priority as this thread; it should be schedule behind
* this task in the ready-to-run list.
*/
#ifdef CONFIG_SCHED_WAITPID
@ -414,14 +414,14 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
* task.
*/
proxy = kthread_create("posix_spawn_proxy", param.sched_priority,
proxy = kthread_create("nxposix_spawn_proxy", param.sched_priority,
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
(main_t)posix_spawn_proxy,
(main_t)nxposix_spawn_proxy,
(FAR char * const *)NULL);
if (proxy < 0)
{
ret = -proxy;
serr("ERROR: Failed to start posix_spawn_proxy: %d\n", ret);
serr("ERROR: Failed to start nxposix_spawn_proxy: %d\n", ret);
goto errout_with_lock;
}

View file

@ -56,7 +56,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_recover
* Name: nxtask_recover
*
* Description:
* This function is called when a task is deleted via task_delete() or
@ -74,7 +74,7 @@
*
****************************************************************************/
void task_recover(FAR struct tcb_s *tcb)
void nxtask_recover(FAR struct tcb_s *tcb)
{
/* The task is being deleted. Cancel in pending timeout events. */

View file

@ -137,7 +137,7 @@ int task_restart(pid_t pid)
/* Try to recover from any bad states */
task_recover((FAR struct tcb_s *)tcb);
nxtask_recover((FAR struct tcb_s *)tcb);
/* Kill any children of this thread */
@ -219,7 +219,7 @@ int task_restart(pid_t pid)
ret = task_activate((FAR struct tcb_s *)tcb);
if (ret != OK)
{
(void)task_terminate(pid, true);
(void)nxtask_terminate(pid, true);
errcode = -ret;
goto errout_with_lock;
}

View file

@ -122,7 +122,7 @@ int task_setcancelstate(int state, FAR int *oldstate)
if (tcb->cpcount > 0)
{
notify_cancellation(tcb);
nxnotify_cancellation(tcb);
}
}
else

View file

@ -1,7 +1,8 @@
/****************************************************************************
* sched/task/task_setup.c
*
* Copyright (C) 2007-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2014, 2016-2017, 2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -77,7 +78,7 @@ static const char g_noname[] = "<noname>";
****************************************************************************/
/****************************************************************************
* Name: task_assignpid
* Name: nxtask_assignpid
*
* Description:
* This function assigns the next unique task ID to a task.
@ -90,7 +91,7 @@ static const char g_noname[] = "<noname>";
*
****************************************************************************/
static int task_assignpid(FAR struct tcb_s *tcb)
static int nxtask_assignpid(FAR struct tcb_s *tcb)
{
pid_t next_pid;
int hash_ndx;
@ -149,7 +150,7 @@ static int task_assignpid(FAR struct tcb_s *tcb)
}
/****************************************************************************
* Name: task_inherit_affinity
* Name: nxtask_inherit_affinity
*
* Description:
* exec(), task_create(), and vfork() all inherit the affinity mask from
@ -171,21 +172,22 @@ static int task_assignpid(FAR struct tcb_s *tcb)
****************************************************************************/
#ifdef CONFIG_SMP
static inline void task_inherit_affinity(FAR struct tcb_s *tcb)
static inline void nxtask_inherit_affinity(FAR struct tcb_s *tcb)
{
FAR struct tcb_s *rtcb = this_task();
tcb->affinity = rtcb->affinity;
}
#else
# define task_inherit_affinity(tcb)
# define nxtask_inherit_affinity(tcb)
#endif
/****************************************************************************
* Name: task_saveparent
* Name: nxtask_saveparent
*
* Description:
* Save the task ID of the parent task in the child task's group and allocate
* a child status structure to catch the child task's exit status.
* Save the task ID of the parent task in the child task's group and
* allocate a child status structure to catch the child task's exit
* status.
*
* Input Parameters:
* tcb - The TCB of the new, child task.
@ -201,7 +203,7 @@ static inline void task_inherit_affinity(FAR struct tcb_s *tcb)
****************************************************************************/
#ifdef CONFIG_SCHED_HAVE_PARENT
static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
static inline void nxtask_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
{
DEBUGASSERT(tcb != NULL && tcb->group != NULL);
@ -285,11 +287,11 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
}
}
#else
# define task_saveparent(tcb,ttype)
# define nxtask_saveparent(tcb,ttype)
#endif
/****************************************************************************
* Name: task_dupdspace
* Name: nxtask_dupdspace
*
* Description:
* When a new task or thread is created from a PIC module, then that
@ -309,7 +311,7 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
****************************************************************************/
#ifdef CONFIG_PIC
static inline void task_dupdspace(FAR struct tcb_s *tcb)
static inline void nxtask_dupdspace(FAR struct tcb_s *tcb)
{
FAR struct tcb_s *rtcb = this_task();
if (rtcb->dspace != NULL)
@ -324,17 +326,17 @@ static inline void task_dupdspace(FAR struct tcb_s *tcb)
}
}
#else
# define task_dupdspace(tcb)
# define nxtask_dupdspace(tcb)
#endif
/****************************************************************************
* Name: thread_schedsetup
* Name: nxthread_schedsetup
*
* Description:
* This functions initializes the common portions of the Task Control Block
* (TCB) in preparation for starting a new thread.
*
* thread_schedsetup() is called from task_schedsetup() and
* nxthread_schedsetup() is called from nxtask_schedsetup() and
* pthread_schedsetup().
*
* Input Parameters:
@ -352,14 +354,15 @@ static inline void task_dupdspace(FAR struct tcb_s *tcb)
*
****************************************************************************/
static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
start_t start, CODE void *entry, uint8_t ttype)
static int nxthread_schedsetup(FAR struct tcb_s *tcb, int priority,
start_t start, CODE void *entry,
uint8_t ttype)
{
int ret;
/* Assign a unique task ID to the task. */
ret = task_assignpid(tcb);
ret = nxtask_assignpid(tcb);
if (ret == OK)
{
/* Save task priority and entry point in the TCB */
@ -390,7 +393,7 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
* a child status structure.
*/
task_saveparent(tcb, ttype);
nxtask_saveparent(tcb, ttype);
#ifdef CONFIG_SMP
/* exec(), task_create(), and vfork() all inherit the affinity mask
@ -400,7 +403,7 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
* affinity mask in this case.
*/
task_inherit_affinity(tcb);
nxtask_inherit_affinity(tcb);
#endif
#ifndef CONFIG_DISABLE_SIGNALS
@ -422,7 +425,7 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
* state setup will take the PIC address base into account.
*/
task_dupdspace(tcb);
nxtask_dupdspace(tcb);
/* Initialize the processor-specific portion of the TCB */
@ -440,7 +443,7 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
}
/****************************************************************************
* Name: task_namesetup
* Name: nxtask_namesetup
*
* Description:
* Assign the task name.
@ -455,7 +458,8 @@ static int thread_schedsetup(FAR struct tcb_s *tcb, int priority,
****************************************************************************/
#if CONFIG_TASK_NAME_SIZE > 0
static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name)
static void nxtask_namesetup(FAR struct task_tcb_s *tcb,
FAR const char *name)
{
/* Give a name to the unnamed tasks */
@ -470,14 +474,14 @@ static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name)
tcb->cmn.name[CONFIG_TASK_NAME_SIZE] = '\0';
}
#else
# define task_namesetup(t,n)
# define nxtask_namesetup(t,n)
#endif /* CONFIG_TASK_NAME_SIZE */
/****************************************************************************
* Name: task_stackargsetup
* Name: nxtask_stackargsetup
*
* Description:
* This functions is called only from task_argsetup() It will allocate
* This functions is called only from nxtask_argsetup() It will allocate
* space on the new task's stack and will copy the argv[] array and all
* strings to the task's stack where it is readily accessible to the
* task. Data on the stack, on the other hand, is guaranteed to be
@ -494,8 +498,8 @@ static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name)
*
****************************************************************************/
static inline int task_stackargsetup(FAR struct task_tcb_s *tcb,
FAR char * const argv[])
static inline int nxtask_stackargsetup(FAR struct task_tcb_s *tcb,
FAR char * const argv[])
{
FAR char **stackargv;
FAR const char *name;
@ -600,7 +604,7 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb,
/* Put a terminator entry at the end of the argv[] array. Then save the
* argv[] arry pointer in the TCB where it will be recovered later by
* task_start().
* nxtask_start().
*/
stackargv[argc + 1] = NULL;
@ -614,18 +618,18 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb,
****************************************************************************/
/****************************************************************************
* Name: task_schedsetup
* Name: nxtask_schedsetup
*
* Description:
* This functions initializes a Task Control Block (TCB) in preparation
* for starting a new task.
*
* task_schedsetup() is called from task_init() and task_start().
* nxtask_schedsetup() is called from task_init() and nxtask_start().
*
* Input Parameters:
* tcb - Address of the new task's TCB
* priority - Priority of the new task
* start - Start-up function (probably task_start())
* start - Start-up function (probably nxtask_start())
* main - Application start point of the new task
* ttype - Type of the new thread: task or kernel thread
*
@ -637,13 +641,13 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb,
*
****************************************************************************/
int task_schedsetup(FAR struct task_tcb_s *tcb, int priority, start_t start,
main_t main, uint8_t ttype)
int nxtask_schedsetup(FAR struct task_tcb_s *tcb, int priority, start_t start,
main_t main, uint8_t ttype)
{
/* Perform common thread setup */
return thread_schedsetup((FAR struct tcb_s *)tcb, priority, start,
(CODE void *)main, ttype);
return nxthread_schedsetup((FAR struct tcb_s *)tcb, priority, start,
(CODE void *)main, ttype);
}
/****************************************************************************
@ -676,19 +680,19 @@ int pthread_schedsetup(FAR struct pthread_tcb_s *tcb, int priority,
{
/* Perform common thread setup */
return thread_schedsetup((FAR struct tcb_s *)tcb, priority, start,
(CODE void *)entry, TCB_FLAG_TTYPE_PTHREAD);
return nxthread_schedsetup((FAR struct tcb_s *)tcb, priority, start,
(CODE void *)entry, TCB_FLAG_TTYPE_PTHREAD);
}
#endif
/****************************************************************************
* Name: task_argsetup
* Name: nxtask_argsetup
*
* Description:
* This functions sets up parameters in the Task Control Block (TCB) in
* preparation for starting a new thread.
*
* task_argsetup() is called only from task_init() and task_start() to
* nxtask_argsetup() is called only from task_init() and nxtask_start() to
* create a new task. In the "normal" case, the argv[] array is a
* structure in the TCB, the arguments are cloned via strdup.
*
@ -710,17 +714,17 @@ int pthread_schedsetup(FAR struct pthread_tcb_s *tcb, int priority,
*
****************************************************************************/
int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
FAR char * const argv[])
int nxtask_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
FAR char * const argv[])
{
/* Setup the task name */
task_namesetup(tcb, name);
nxtask_namesetup(tcb, name);
/* Copy the argv[] array and all strings are to the task's stack. Data on
* the stack is guaranteed to be accessible by the ask no matter what
* privilege mode the task runs in.
*/
return task_stackargsetup(tcb, argv);
return nxtask_stackargsetup(tcb, argv);
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
* sched/task/task_spawn.c
*
* Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -59,7 +59,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_spawn_exec
* Name: nxtask_spawn_exec
*
* Description:
* Execute the task from the file system.
@ -83,7 +83,7 @@
* - POSIX_SPAWN_SETSCHEDULER: Set the new tasks scheduler priority to
* the sched_policy value.
*
* NOTE: POSIX_SPAWN_SETSIGMASK is handled in task_spawn_proxy().
* NOTE: POSIX_SPAWN_SETSIGMASK is handled in nxtask_spawn_proxy().
*
* argv - argv[] is the argument list for the new task. argv[] is an
* array of pointers to null-terminated strings. The list is terminated
@ -97,9 +97,9 @@
*
****************************************************************************/
static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name,
main_t entry, FAR const posix_spawnattr_t *attr,
FAR char * const *argv)
static int nxtask_spawn_exec(FAR pid_t *pidp, FAR const char *name,
main_t entry, FAR const posix_spawnattr_t *attr,
FAR char * const *argv)
{
size_t stacksize;
int priority;
@ -172,7 +172,7 @@ errout:
}
/****************************************************************************
* Name: task_spawn_proxy
* Name: nxtask_spawn_proxy
*
* Description:
* Perform file_actions, then execute the task from the file system.
@ -186,9 +186,9 @@ errout:
* that NuttX supports task_restart(), and you would never be able to
* restart a task from this point.
*
* Q: Why not use a starthook so that there is callout from task_start()
* Q: Why not use a starthook so that there is callout from nxtask_start()
* to perform these operations?
* A: Good idea, except that existing task_starthook() implementation
* A: Good idea, except that existing nxtask_starthook() implementation
* cannot be used here unless we get rid of task_create and, instead,
* use task_init() and task_activate(). start_taskhook() could then
* be called between task_init() and task)activate(). task_restart()
@ -202,7 +202,7 @@ errout:
*
****************************************************************************/
static int task_spawn_proxy(int argc, FAR char *argv[])
static int nxtask_spawn_proxy(int argc, FAR char *argv[])
{
int ret;
@ -226,9 +226,9 @@ static int task_spawn_proxy(int argc, FAR char *argv[])
{
/* Start the task */
ret = task_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.task.name,
g_spawn_parms.u.task.entry, g_spawn_parms.attr,
g_spawn_parms.argv);
ret = nxtask_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.task.name,
g_spawn_parms.u.task.entry, g_spawn_parms.attr,
g_spawn_parms.argv);
#ifdef CONFIG_SCHED_HAVE_PARENT
if (ret == OK)
@ -342,7 +342,8 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
pid, name, entry, file_actions, attr, argv);
/* If there are no file actions to be performed and there is no change to
* the signal mask, then start the new child task directly from the parent task.
* the signal mask, then start the new child task directly from the parent
* task.
*/
#ifndef CONFIG_DISABLE_SIGNALS
@ -352,7 +353,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
if (file_actions == NULL || *file_actions == NULL)
#endif
{
return task_spawn_exec(pid, name, entry, attr, argv);
return nxtask_spawn_exec(pid, name, entry, attr, argv);
}
/* Otherwise, we will have to go through an intermediary/proxy task in order
@ -392,9 +393,9 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
#ifdef CONFIG_SCHED_WAITPID
/* Disable pre-emption so that the proxy does not run until waitpid
* is called. This is probably unnecessary since the task_spawn_proxy has
* the same priority as this thread; it should be schedule behind this
* task in the ready-to-run list.
* is called. This is probably unnecessary since the nxtask_spawn_proxy
* has the same priority as this thread; it should be schedule behind
* this task in the ready-to-run list.
*
* REVISIT: This will may not have the desired effect in SMP mode.
*/
@ -406,14 +407,14 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
* task.
*/
proxy = nxtask_create("task_spawn_proxy", param.sched_priority,
proxy = nxtask_create("nxtask_spawn_proxy", param.sched_priority,
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
(main_t)task_spawn_proxy,
(main_t)nxtask_spawn_proxy,
(FAR char * const *)NULL);
if (proxy < 0)
{
ret = -proxy;
serr("ERROR: Failed to start task_spawn_proxy: %d\n", ret);
serr("ERROR: Failed to start nxtask_spawn_proxy: %d\n", ret);
goto errout_with_lock;
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
* sched/task/task_spawnparms.c
*
* Copyright (C) 2013, 2015, 2017-2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015, 2017-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -66,7 +66,7 @@ struct spawn_parms_s g_spawn_parms;
****************************************************************************/
/****************************************************************************
* Name: spawn_close, spawn_dup2, and spawn_open
* Name: nxspawn_close, nxspawn_dup2, and nxspawn_open
*
* Description:
* Implement individual file actions
@ -81,7 +81,7 @@ struct spawn_parms_s g_spawn_parms;
*
****************************************************************************/
static inline int spawn_close(FAR struct spawn_close_file_action_s *action)
static inline int nxspawn_close(FAR struct spawn_close_file_action_s *action)
{
/* The return value from close() is ignored */
@ -91,7 +91,7 @@ static inline int spawn_close(FAR struct spawn_close_file_action_s *action)
return OK;
}
static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action)
static inline int nxspawn_dup2(FAR struct spawn_dup2_file_action_s *action)
{
int ret;
@ -111,7 +111,7 @@ static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action)
return OK;
}
static inline int spawn_open(FAR struct spawn_open_file_action_s *action)
static inline int nxspawn_open(FAR struct spawn_open_file_action_s *action)
{
int fd;
int ret = OK;
@ -342,15 +342,15 @@ int spawn_proxyattrs(FAR const posix_spawnattr_t *attr,
switch (entry->action)
{
case SPAWN_FILE_ACTION_CLOSE:
ret = spawn_close((FAR struct spawn_close_file_action_s *)entry);
ret = nxspawn_close((FAR struct spawn_close_file_action_s *)entry);
break;
case SPAWN_FILE_ACTION_DUP2:
ret = spawn_dup2((FAR struct spawn_dup2_file_action_s *)entry);
ret = nxspawn_dup2((FAR struct spawn_dup2_file_action_s *)entry);
break;
case SPAWN_FILE_ACTION_OPEN:
ret = spawn_open((FAR struct spawn_open_file_action_s *)entry);
ret = nxspawn_open((FAR struct spawn_open_file_action_s *)entry);
break;
case SPAWN_FILE_ACTION_NONE:

View file

@ -71,7 +71,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_start
* Name: nxtask_start
*
* Description:
* This function is the low level entry point into the main thread of
@ -86,7 +86,7 @@
*
****************************************************************************/
void task_start(void)
void nxtask_start(void)
{
FAR struct task_tcb_s *tcb = (FAR struct task_tcb_s *)this_task();
int exitcode;

View file

@ -50,7 +50,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_starthook
* Name: nxtask_starthook
*
* Description:
* Configure a start hook... a function that will be called on the thread
@ -68,8 +68,8 @@
*
****************************************************************************/
void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
FAR void *arg)
void nxtask_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
FAR void *arg)
{
/* Only tasks can have starthooks. The starthook will be called when the
* task is started (or restarted).

View file

@ -59,7 +59,7 @@
****************************************************************************/
/****************************************************************************
* Name: task_terminate
* Name: nxtask_terminate
*
* Description:
* This function causes a specified task to cease to exist. Its stack and
@ -68,20 +68,20 @@
* to determine if blocking is permitted or not.
*
* This function is the final function called all task termination
* sequences. task_terminate() is called only from task_delete() (with
* nonblocking == false) and from task_exit() (with nonblocking == true).
* sequences. nxtask_terminate() is called only from task_delete() (with
* nonblocking == false) and from nxtask_exit() (with nonblocking == true).
*
* The path through task_exit() supports the final stops of the exit(),
* The path through nxtask_exit() supports the final stops of the exit(),
* _exit(), and pthread_exit
*
* - pthread_exit(). Calls _exit()
* - exit(). Calls _exit()
* - _exit(). Calls task_exit() making the currently running task
* non-running. task_exit then calls task_terminate() (with nonblocking
* - _exit(). Calls nxtask_exit() making the currently running task
* non-running. nxtask_exit then calls nxtask_terminate() (with nonblocking
* == true) to terminate the non-running task.
*
* NOTE: that the state of non-blocking is irrelevant when called through
* exit() and pthread_exit(). In those cases task_exithook() has already
* exit() and pthread_exit(). In those cases nxtask_exithook() has already
* been called with nonblocking == false;
*
* Input Parameters:
@ -98,7 +98,7 @@
*
****************************************************************************/
int task_terminate(pid_t pid, bool nonblocking)
int nxtask_terminate(pid_t pid, bool nonblocking)
{
FAR struct tcb_s *dtcb;
FAR dq_queue_t *tasklist;
@ -182,13 +182,13 @@ int task_terminate(pid_t pid, bool nonblocking)
* this as early as possible so that higher level clean-up logic
* can run in a healthy tasking environment.
*
* In the case where the task exits via exit(), task_exithook()
* In the case where the task exits via exit(), nxtask_exithook()
* may be called twice.
*
* I suppose EXIT_SUCCESS is an appropriate return value???
*/
task_exithook(dtcb, EXIT_SUCCESS, nonblocking);
nxtask_exithook(dtcb, EXIT_SUCCESS, nonblocking);
/* Since all tasks pass through this function as the final step in their
* exit sequence, this is an appropriate place to inform any instrumentation

View file

@ -1,7 +1,7 @@
/****************************************************************************
* sched/task/task_vfork
*
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -73,7 +73,7 @@
****************************************************************************/
/****************************************************************************
* Name: vfork_namesetup
* Name: nxvfork_namesetup
*
* Description:
* Copy the task name.
@ -88,19 +88,19 @@
****************************************************************************/
#if CONFIG_TASK_NAME_SIZE > 0
static inline void vfork_namesetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
static inline void nxvfork_namesetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
{
/* Copy the name from the parent into the child TCB */
strncpy(child->cmn.name, parent->name, CONFIG_TASK_NAME_SIZE);
}
#else
# define vfork_namesetup(p,c)
# define nxvfork_namesetup(p,c)
#endif /* CONFIG_TASK_NAME_SIZE */
/****************************************************************************
* Name: vfork_stackargsetup
* Name: nxvfork_stackargsetup
*
* Description:
* Clone the task arguments in the same relative positions on the child's
@ -115,8 +115,8 @@ static inline void vfork_namesetup(FAR struct tcb_s *parent,
*
****************************************************************************/
static inline int vfork_stackargsetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
static inline int nxvfork_stackargsetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
{
/* Is the parent a task? or a pthread? Only tasks (and kernel threads)
* have command line arguments.
@ -169,7 +169,7 @@ static inline int vfork_stackargsetup(FAR struct tcb_s *parent,
}
/****************************************************************************
* Name: vfork_argsetup
* Name: nxvfork_argsetup
*
* Description:
* Clone the argument list from the parent to the child.
@ -183,20 +183,20 @@ static inline int vfork_stackargsetup(FAR struct tcb_s *parent,
*
****************************************************************************/
static inline int vfork_argsetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
static inline int nxvfork_argsetup(FAR struct tcb_s *parent,
FAR struct task_tcb_s *child)
{
/* Clone the task name */
vfork_namesetup(parent, child);
nxvfork_namesetup(parent, child);
/* Adjust and copy the argv[] array. */
return vfork_stackargsetup(parent, child);
return nxvfork_stackargsetup(parent, child);
}
/****************************************************************************
* Name: vfork_argsize
* Name: nxvfork_argsize
*
* Description:
* Get the parent's argument size.
@ -209,7 +209,7 @@ static inline int vfork_argsetup(FAR struct tcb_s *parent,
*
****************************************************************************/
static inline size_t vfork_argsize(FAR struct tcb_s *parent)
static inline size_t nxvfork_argsize(FAR struct tcb_s *parent)
{
if ((parent->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD)
{
@ -239,7 +239,7 @@ static inline size_t vfork_argsize(FAR struct tcb_s *parent)
****************************************************************************/
/****************************************************************************
* Name: task_vforksetup
* Name: nxtask_vforksetup
*
* Description:
* The vfork() function has the same effect as fork(), except that the
@ -254,8 +254,8 @@ static inline size_t vfork_argsize(FAR struct tcb_s *parent)
*
* 1) User code calls vfork(). vfork() is provided in architecture-specific
* code.
* 2) vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* 2) vfork()and calls nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
@ -266,21 +266,21 @@ static inline size_t vfork_argsize(FAR struct tcb_s *parent)
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) up_vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* retaddr - Return address
* argsize - Location to return the argument size
*
* Returned Value:
* Upon successful completion, task_vforksetup() returns a pointer to
* Upon successful completion, nxtask_vforksetup() returns a pointer to
* newly allocated and initialized child task's TCB. NULL is returned
* on any failure and the errno is set appropriately.
*
****************************************************************************/
FAR struct task_tcb_s *task_vforksetup(start_t retaddr, size_t *argsize)
FAR struct task_tcb_s *nxtask_vforksetup(start_t retaddr, size_t *argsize)
{
struct tcb_s *parent = this_task();
struct task_tcb_s *child;
@ -346,7 +346,7 @@ FAR struct task_tcb_s *task_vforksetup(start_t retaddr, size_t *argsize)
/* Initialize the task control block. This calls up_initial_state() */
sinfo("Child priority=%d start=%p\n", priority, retaddr);
ret = task_schedsetup(child, priority, retaddr, parent->entry.main, ttype);
ret = nxtask_schedsetup(child, priority, retaddr, parent->entry.main, ttype);
if (ret < OK)
{
goto errout_with_tcb;
@ -354,7 +354,7 @@ FAR struct task_tcb_s *task_vforksetup(start_t retaddr, size_t *argsize)
/* Return the argument size */
*argsize = vfork_argsize(parent);
*argsize = nxvfork_argsize(parent);
sinfo("parent=%p, returning child=%p\n", parent, child);
return child;
@ -366,7 +366,7 @@ errout_with_tcb:
}
/****************************************************************************
* Name: task_vforkstart
* Name: nxtask_vforkstart
*
* Description:
* The vfork() function has the same effect as fork(), except that the
@ -381,9 +381,10 @@ errout_with_tcb:
* sequence is:
*
* 1) User code calls vfork()
* 2) Architecture-specific code provides vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* 2) Architecture-specific code provides vfork()and calls
* nxtask_vforksetup().
* 3) nxtask_vforksetup() allocates and configures the child task's TCB.
* This consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
* - Configuration of environment variables
@ -393,8 +394,8 @@ errout_with_tcb:
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
* 5) vfork() then calls nxtask_vforkstart()
* 6) nxtask_vforkstart() then executes the child thread.
*
* Input Parameters:
* retaddr - The return address from vfork() where the child task
@ -408,7 +409,7 @@ errout_with_tcb:
*
****************************************************************************/
pid_t task_vforkstart(FAR struct task_tcb_s *child)
pid_t nxtask_vforkstart(FAR struct task_tcb_s *child)
{
struct tcb_s *parent = this_task();
pid_t pid;
@ -420,10 +421,10 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
/* Duplicate the original argument list in the forked child TCB */
ret = vfork_argsetup(parent, child);
ret = nxvfork_argsetup(parent, child);
if (ret < 0)
{
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
return ERROR;
}
@ -433,7 +434,7 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
ret = group_initialize(child);
if (ret < 0)
{
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
return ERROR;
}
#endif
@ -455,7 +456,7 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
ret = task_activate((FAR struct tcb_s *)child);
if (ret < OK)
{
task_vforkabort(child, -ret);
nxtask_vforkabort(child, -ret);
sched_unlock();
return ERROR;
}
@ -494,19 +495,19 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
}
/****************************************************************************
* Name: task_vforkabort
* Name: nxtask_vforkabort
*
* Description:
* Recover from any errors after task_vforksetup() was called.
* Recover from any errors after nxtask_vforksetup() was called.
*
* Returned Value:
* None
*
****************************************************************************/
void task_vforkabort(FAR struct task_tcb_s *child, int errcode)
void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode)
{
/* The TCB was added to the active task list by task_schedsetup() */
/* The TCB was added to the active task list by nxtask_schedsetup() */
dq_rem((FAR dq_entry_t *)child, (FAR dq_queue_t *)&g_inactivetasks);

View file

@ -54,7 +54,7 @@
* Name: wd_recover
*
* Description:
* This function is called from task_recover() when a task is deleted via
* This function is called from nxtask_recover() when a task is deleted via
* task_delete() or via pthread_cancel(). It checks if the deleted task
* is waiting for a timed event and if so cancels the timeout
*

View file

@ -170,7 +170,7 @@ void wd_timer(void);
* Name: wd_recover
*
* Description:
* This function is called from task_recover() when a task is deleted via
* This function is called from nxtask_recover() when a task is deleted via
* task_delete() or via pthread_cancel(). It checks if the deleted task
* is waiting for a timed event and if so cancels the timeout
*