mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
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:
@@ -479,7 +479,7 @@ int task_delete(pid_t pid);
|
|||||||
Its stack and TCB will be deallocated.
|
Its stack and TCB will be deallocated.
|
||||||
This function is the companion to <code>task_create()</code>.
|
This function is the companion to <code>task_create()</code>.
|
||||||
This is the version of the function exposed to the user;
|
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>
|
||||||
<p>
|
<p>
|
||||||
The logic in this function only deletes non-running tasks.
|
The logic in this function only deletes non-running tasks.
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -72,8 +72,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
|
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
|
||||||
* configured and of what kind of thread is being started. That is
|
* configured and of what kind of thread is being started. That is
|
||||||
* because all threads, even user-mode threads will start in kernel
|
* 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.
|
* privileges will be dropped before transitioning to user code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB.
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB.
|
||||||
* This consists of:
|
* This consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -85,8 +85,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -73,8 +73,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -85,8 +85,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -74,8 +74,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -86,8 +86,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
|
/* Set supervisor-mode and disable FIQs, regardless of how NuttX is
|
||||||
* configured and of what kind of thread is being started. That is
|
* configured and of what kind of thread is being started. That is
|
||||||
* because all threads, even user-mode threads will start in kernel
|
* 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.
|
* privileges will be dropped before transitioning to user code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB.
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB.
|
||||||
* This consists of:
|
* This consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -85,8 +85,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -81,8 +81,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -93,10 +93,10 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 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:
|
* Input Parameters:
|
||||||
* context - Caller context information saved by vfork()
|
* 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. */
|
/* 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)
|
if (!child)
|
||||||
{
|
{
|
||||||
serr("ERROR: task_vforksetup failed\n");
|
serr("ERROR: nxtask_vforksetup failed\n");
|
||||||
return (pid_t)ERROR;
|
return (pid_t)ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
serr("ERROR: up_create_stack failed: %d\n", ret);
|
serr("ERROR: up_create_stack failed: %d\n", ret);
|
||||||
task_vforkabort(child, -ret);
|
nxtask_vforkabort(child, -ret);
|
||||||
return (pid_t)ERROR;
|
return (pid_t)ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,9 +266,9 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* And, finally, start the child task. On a failure, task_vforkstart()
|
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
|
||||||
* will discard the TCB by calling task_vforkabort().
|
* will discard the TCB by calling nxtask_vforkabort().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return task_vforkstart(child);
|
return nxtask_vforkstart(child);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -83,8 +83,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -95,10 +95,10 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 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:
|
* Input Parameters:
|
||||||
* context - Caller context information saved by vfork()
|
* 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. */
|
/* 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)
|
if (!child)
|
||||||
{
|
{
|
||||||
sinfo("task_vforksetup failed\n");
|
sinfo("nxtask_vforksetup failed\n");
|
||||||
return (pid_t)ERROR;
|
return (pid_t)ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
serr("ERROR: up_create_stack failed: %d\n", ret);
|
serr("ERROR: up_create_stack failed: %d\n", ret);
|
||||||
task_vforkabort(child, -ret);
|
nxtask_vforkabort(child, -ret);
|
||||||
return (pid_t)ERROR;
|
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 */
|
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* And, finally, start the child task. On a failure, task_vforkstart()
|
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
|
||||||
* will discard the TCB by calling task_vforkabort().
|
* will discard the TCB by calling nxtask_vforkabort().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return task_vforkstart(child);
|
return nxtask_vforkstart(child);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,8 +71,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 6) nxtask_vforkstart() then executes the child thread.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -83,8 +83,8 @@
|
|||||||
*
|
*
|
||||||
* 1) User code calls vfork(). vfork() collects context information and
|
* 1) User code calls vfork(). vfork() collects context information and
|
||||||
* transfers control up up_vfork().
|
* transfers control up up_vfork().
|
||||||
* 2) up_vfork()and calls task_vforksetup().
|
* 2) up_vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - Initialization of file descriptors and streams
|
||||||
@@ -95,10 +95,10 @@
|
|||||||
* - Allocate and initialize the stack
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) up_vfork() then calls task_vforkstart()
|
* 5) up_vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 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:
|
* Input Parameters:
|
||||||
* context - Caller context information saved by vfork()
|
* 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. */
|
/* 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)
|
if (!child)
|
||||||
{
|
{
|
||||||
sinfo("task_vforksetup failed\n");
|
sinfo("nxtask_vforksetup failed\n");
|
||||||
return (pid_t)ERROR;
|
return (pid_t)ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
serr("ERROR: up_create_stack failed: %d\n", ret);
|
serr("ERROR: up_create_stack failed: %d\n", ret);
|
||||||
task_vforkabort(child, -ret);
|
nxtask_vforkabort(child, -ret);
|
||||||
return (pid_t)ERROR;
|
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 */
|
child->cmn.xcp.regs[REG_GP] = newsp; /* Global pointer */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* And, finally, start the child task. On a failure, task_vforkstart()
|
/* And, finally, start the child task. On a failure, nxtask_vforkstart()
|
||||||
* will discard the TCB by calling task_vforkabort().
|
* will discard the TCB by calling nxtask_vforkabort().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return task_vforkstart(child);
|
return nxtask_vforkstart(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_ARCH_HAVE_VFORK */
|
#endif /* CONFIG_ARCH_HAVE_VFORK */
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void _exit(int status)
|
|||||||
|
|
||||||
/* Destroy the task at the head of the ready to run list. */
|
/* 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
|
/* Now, perform the context switch to the new ready-to-run task at the
|
||||||
* head of the list.
|
* head of the list.
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ int exec_module(FAR const struct binary_s *binp)
|
|||||||
|
|
||||||
if (binp->nctors > 0)
|
if (binp->nctors > 0)
|
||||||
{
|
{
|
||||||
task_starthook(tcb, exec_ctors, (FAR void *)binp);
|
nxtask_starthook(tcb, exec_ctors, (FAR void *)binp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ Status
|
|||||||
until sched_resume_scheduler() runs. These commits were made:
|
until sched_resume_scheduler() runs. These commits were made:
|
||||||
|
|
||||||
commit 50ab5d638a37b539775d1e60085f182bf26be57f
|
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
|
the new version of this_task(). sched/irq: Remove redundant fetch
|
||||||
of CPU index; configs/sabre-6quad: update README.
|
of CPU index; configs/sabre-6quad: update README.
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -875,7 +875,7 @@ FAR struct socketlist *sched_getsockets(void);
|
|||||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Name: task_starthook
|
* Name: nxtask_starthook
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Configure a start hook... a function that will be called on the thread
|
* Configure a start hook... a function that will be called on the thread
|
||||||
@@ -894,7 +894,7 @@ FAR struct socketlist *sched_getsockets(void);
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_STARTHOOK
|
#ifdef CONFIG_SCHED_STARTHOOK
|
||||||
void task_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
|
void nxtask_starthook(FAR struct task_tcb_s *tcb, starthook_t starthook,
|
||||||
FAR void *arg);
|
FAR void *arg);
|
||||||
#endif
|
#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
|
* 1) User code calls vfork(). vfork() is provided in architecture-specific
|
||||||
* code.
|
* code.
|
||||||
* 2) vfork()and calls task_vforksetup().
|
* 2) vfork()and calls nxtask_vforksetup().
|
||||||
* 3) task_vforksetup() allocates and configures the child task's TCB. This
|
* 3) nxtask_vforksetup() allocates and configures the child task's TCB. This
|
||||||
* consists of:
|
* consists of:
|
||||||
* - Allocation of the child task's TCB.
|
* - Allocation of the child task's TCB.
|
||||||
* - Initialization of file descriptors and streams
|
* - 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
|
* - Allocate and initialize the stack
|
||||||
* - Initialize special values in any CPU registers that were not
|
* - Initialize special values in any CPU registers that were not
|
||||||
* already configured by up_initial_state()
|
* already configured by up_initial_state()
|
||||||
* 5) vfork() then calls task_vforkstart()
|
* 5) vfork() then calls nxtask_vforkstart()
|
||||||
* 6) task_vforkstart() then executes the child thread.
|
* 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);
|
FAR struct task_tcb_s *nxtask_vforksetup(start_t retaddr, size_t *argsize);
|
||||||
pid_t task_vforkstart(FAR struct task_tcb_s *child);
|
pid_t nxtask_vforkstart(FAR struct task_tcb_s *child);
|
||||||
void task_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: group_exitinfo
|
* Name: group_exitinfo
|
||||||
|
|||||||
@@ -113,24 +113,24 @@ struct userspace_s
|
|||||||
|
|
||||||
/* Task/thread startup routines */
|
/* 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;
|
noreturn_function;
|
||||||
#ifndef CONFIG_DISABLE_PTHREAD
|
#ifndef CONFIG_DISABLE_PTHREAD
|
||||||
void (*pthread_startup)(pthread_startroutine_t entrypt,
|
CODE void (*pthread_startup)(pthread_startroutine_t entrypt,
|
||||||
pthread_addr_t arg);
|
pthread_addr_t arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Signal handler trampoline */
|
/* Signal handler trampoline */
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#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);
|
FAR siginfo_t *info, FAR void *ucontext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* User-space work queue support */
|
/* User-space work queue support */
|
||||||
|
|
||||||
#ifdef CONFIG_LIB_USRWORK
|
#ifdef CONFIG_LIB_USRWORK
|
||||||
int (*work_usrstart)(void);
|
CODE int (*work_usrstart)(void);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1212,8 +1212,8 @@ config SCHED_STARTHOOK
|
|||||||
bool "Enable startup hook"
|
bool "Enable startup hook"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable a non-standard, internal OS API call task_starthook().
|
Enable a non-standard, internal OS API call nxtask_starthook().
|
||||||
task_starthook() registers a function that will be called on task
|
nxtask_starthook() registers a function that will be called on task
|
||||||
startup before that actual task entry point is called. The
|
startup before that actual task entry point is called. The
|
||||||
starthook is useful, for example, for setting up automatic
|
starthook is useful, for example, for setting up automatic
|
||||||
configuration of C++ constructors.
|
configuration of C++ constructors.
|
||||||
|
|||||||
@@ -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
|
* 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
|
* (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
|
* 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()).
|
* pthread_start()).
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
void nxmq_recover(FAR struct tcb_s *tcb)
|
void nxmq_recover(FAR struct tcb_s *tcb)
|
||||||
{
|
{
|
||||||
/* If were were waiting for a timed message queue event, then the
|
/* 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.
|
* function was called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ int pthread_cancel(pthread_t thread)
|
|||||||
|
|
||||||
if (tcb->cmn.cpcount > 0)
|
if (tcb->cmn.cpcount > 0)
|
||||||
{
|
{
|
||||||
notify_cancellation(&tcb->cmn);
|
nxnotify_cancellation(&tcb->cmn);
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
@@ -168,7 +168,7 @@ int pthread_cancel(pthread_t thread)
|
|||||||
pthread_mutex_inconsistent(tcb);
|
pthread_mutex_inconsistent(tcb);
|
||||||
#endif
|
#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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ static const char g_pthreadname[] = "<pthread>";
|
|||||||
* This functions sets up parameters in the Task Control Block (TCB) in
|
* This functions sets up parameters in the Task Control Block (TCB) in
|
||||||
* preparation for starting a new thread.
|
* 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
|
* a new task (with arguments cloned via strdup) or pthread_create() which
|
||||||
* has one argument passed by value (distinguished by the pthread boolean
|
* has one argument passed by value (distinguished by the pthread boolean
|
||||||
* argument).
|
* argument).
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void pthread_exit(FAR void *exit_value)
|
|||||||
* (2) so that we can flush buffered I/O (which may required suspending).
|
* (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
|
/* Then just exit, retaining all file descriptors and without
|
||||||
* calling atexit() functions.
|
* calling atexit() functions.
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
* Name: nxsem_recover
|
* Name: nxsem_recover
|
||||||
*
|
*
|
||||||
* Description:
|
* 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
|
* 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
|
* case where a task is waiting for semaphore at the time that is was
|
||||||
* killed.
|
* killed.
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ bool nxsig_iscatchable(int signo)
|
|||||||
* Name: nxsig_default_initialize
|
* Name: nxsig_default_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* 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.
|
* to configure the newly started task.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ void exit(int status)
|
|||||||
* so that we can flush buffered I/O (both of which may required suspending).
|
* 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. */
|
/* Then "really" exit. Only the lower 8 bits of the exit status are used. */
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -67,23 +67,23 @@ struct tcb_s; /* Forward reference */
|
|||||||
|
|
||||||
/* Task start-up */
|
/* Task start-up */
|
||||||
|
|
||||||
void task_start(void);
|
void nxtask_start(void);
|
||||||
int task_schedsetup(FAR struct task_tcb_s *tcb, int priority,
|
int nxtask_schedsetup(FAR struct task_tcb_s *tcb, int priority,
|
||||||
start_t start, main_t main, uint8_t ttype);
|
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[]);
|
FAR char * const argv[]);
|
||||||
|
|
||||||
/* Task exit */
|
/* Task exit */
|
||||||
|
|
||||||
int task_exit(void);
|
int nxtask_exit(void);
|
||||||
int task_terminate(pid_t pid, bool nonblocking);
|
int nxtask_terminate(pid_t pid, bool nonblocking);
|
||||||
void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking);
|
void nxtask_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking);
|
||||||
void task_recover(FAR struct tcb_s *tcb);
|
void nxtask_recover(FAR struct tcb_s *tcb);
|
||||||
|
|
||||||
/* Cancellation points */
|
/* Cancellation points */
|
||||||
|
|
||||||
#ifdef CONFIG_CANCELLATION_POINTS
|
#ifdef CONFIG_CANCELLATION_POINTS
|
||||||
void notify_cancellation(FAR struct tcb_s *tcb);
|
void nxnotify_cancellation(FAR struct tcb_s *tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __SCHED_TASK_TASK_H */
|
#endif /* __SCHED_TASK_TASK_H */
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
* Name: task_activate
|
* Name: task_activate
|
||||||
*
|
*
|
||||||
* Description:
|
* 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.
|
* activation, a task is ineligible for execution by the scheduler.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ bool check_cancellation_point(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: notify_cancellation
|
* Name: nxnotify_cancellation
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called by task_delete() or pthread_cancel() if the cancellation occurs
|
* 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;
|
irqstate_t flags;
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,8 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_create.c
|
* sched/task/task_create.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010, 2013-2014, 2016, 2018 Gregory Nutt. All rights
|
* Copyright (C) 2007-2010, 2013-2014, 2016, 2018-2019 Gregory Nutt. All
|
||||||
* reserved.
|
* rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: thread_create
|
* Name: nxthread_create
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates and activates a new thread of the specified type
|
* This function creates and activates a new thread of the specified type
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int thread_create(FAR const char *name, uint8_t ttype, int priority,
|
static int nxthread_create(FAR const char *name, uint8_t ttype,
|
||||||
int stack_size, main_t entry,
|
int priority, int stack_size, main_t entry,
|
||||||
FAR char * const argv[])
|
FAR char * const argv[])
|
||||||
{
|
{
|
||||||
FAR struct task_tcb_s *tcb;
|
FAR struct task_tcb_s *tcb;
|
||||||
@@ -140,7 +140,7 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
|
|||||||
|
|
||||||
/* Initialize the task control block */
|
/* 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)
|
if (ret < OK)
|
||||||
{
|
{
|
||||||
goto errout_with_tcb;
|
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 */
|
/* Setup to pass parameters to the new task */
|
||||||
|
|
||||||
(void)task_argsetup(tcb, name, argv);
|
(void)nxtask_argsetup(tcb, name, argv);
|
||||||
|
|
||||||
#ifdef HAVE_TASK_GROUP
|
#ifdef HAVE_TASK_GROUP
|
||||||
/* Now we have enough in place that we can join the 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();
|
ret = -get_errno();
|
||||||
DEBUGASSERT(ret < 0);
|
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);
|
dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
|
||||||
goto errout_with_tcb;
|
goto errout_with_tcb;
|
||||||
@@ -230,7 +230,7 @@ errout_with_tcb:
|
|||||||
int nxtask_create(FAR const char *name, int priority,
|
int nxtask_create(FAR const char *name, int priority,
|
||||||
int stack_size, main_t entry, FAR char * const argv[])
|
int stack_size, main_t entry, FAR char * const argv[])
|
||||||
{
|
{
|
||||||
return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size,
|
return nxthread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size,
|
||||||
entry, argv);
|
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 kthread_create(FAR const char *name, int priority,
|
||||||
int stack_size, main_t entry, FAR char *const argv[])
|
int stack_size, main_t entry, FAR char *const argv[])
|
||||||
{
|
{
|
||||||
return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size,
|
return nxthread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size,
|
||||||
entry, argv);
|
entry, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
* This function causes a specified task to cease to exist. Its stack and
|
* This function causes a specified task to cease to exist. Its stack and
|
||||||
* TCB will be deallocated. This function is the companion to
|
* TCB will be deallocated. This function is the companion to
|
||||||
* task_create(). This is the version of the function exposed to the
|
* 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.
|
* function.
|
||||||
*
|
*
|
||||||
* The logic in this function only deletes non-running tasks. If the
|
* 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)
|
if (dtcb->cpcount > 0)
|
||||||
{
|
{
|
||||||
notify_cancellation(dtcb);
|
nxnotify_cancellation(dtcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
@@ -196,10 +196,10 @@ int task_delete(pid_t pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, perform the asynchronous cancellation, letting
|
/* 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)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
errcode = -ret;
|
errcode = -ret;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_exit
|
* Name: nxtask_exit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a part of the logic used to implement _exit(). The full
|
* 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 *dtcb;
|
||||||
FAR struct tcb_s *rtcb;
|
FAR struct tcb_s *rtcb;
|
||||||
@@ -149,13 +149,13 @@ int task_exit(void)
|
|||||||
rtcb->task_state = TSTATE_TASK_READYTORUN;
|
rtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||||
|
|
||||||
/* Move the TCB to the specified blocked task list and delete it. Calling
|
/* 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
|
* calls and will cause buffered I/O to fail to be flushed. The former
|
||||||
* is required _exit() behavior; the latter is optional _exit() behavior.
|
* is required _exit() behavior; the latter is optional _exit() behavior.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sched_addblocked(dtcb, TSTATE_TASK_INACTIVE);
|
sched_addblocked(dtcb, TSTATE_TASK_INACTIVE);
|
||||||
ret = task_terminate(dtcb->pid, true);
|
ret = nxtask_terminate(dtcb->pid, true);
|
||||||
rtcb->task_state = TSTATE_TASK_RUNNING;
|
rtcb->task_state = TSTATE_TASK_RUNNING;
|
||||||
|
|
||||||
/* Decrement the lockcount on rctb. */
|
/* Decrement the lockcount on rctb. */
|
||||||
|
|||||||
+51
-48
@@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_exithook.c
|
* 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>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -58,7 +59,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_atexit
|
* Name: nxtask_atexit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Call any registered atexit function(s)
|
* Call any registered atexit function(s)
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
|
#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;
|
FAR struct task_group_s *group = tcb->group;
|
||||||
|
|
||||||
@@ -128,11 +129,11 @@ static inline void task_atexit(FAR struct tcb_s *tcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define task_atexit(tcb)
|
# define nxtask_atexit(tcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_onexit
|
* Name: nxtask_onexit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Call any registered on_exit function(s)
|
* 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
|
#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;
|
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
|
#else
|
||||||
# define task_onexit(tcb,status)
|
# define nxtask_onexit(tcb,status)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_exitstatus
|
* Name: nxtask_exitstatus
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Report exit status when main task of a task group exits
|
* 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
|
#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;
|
FAR struct child_status_s *child;
|
||||||
|
|
||||||
@@ -245,12 +247,12 @@ static inline void task_exitstatus(FAR struct task_group_s *group, int status)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define task_exitstatus(group,status)
|
# define nxtask_exitstatus(group,status)
|
||||||
|
|
||||||
#endif /* CONFIG_SCHED_CHILD_STATUS */
|
#endif /* CONFIG_SCHED_CHILD_STATUS */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_groupexit
|
* Name: nxtask_groupexit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Mark that the final thread of a child task group as exited.
|
* 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
|
#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;
|
FAR struct child_status_s *child;
|
||||||
|
|
||||||
@@ -282,12 +284,12 @@ static inline void task_groupexit(FAR struct task_group_s *group)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define task_groupexit(group)
|
# define nxtask_groupexit(group)
|
||||||
|
|
||||||
#endif /* CONFIG_SCHED_CHILD_STATUS */
|
#endif /* CONFIG_SCHED_CHILD_STATUS */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_sigchild
|
* Name: nxtask_sigchild
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send the SIGCHILD signal to the parent thread
|
* 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)
|
#if defined(CONFIG_SCHED_HAVE_PARENT) && !defined(CONFIG_DISABLE_SIGNALS)
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#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 *chgrp = ctcb->group;
|
||||||
FAR struct task_group_s *pgrp;
|
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)
|
if ((ctcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
task_exitstatus(pgrp, status);
|
nxtask_exitstatus(pgrp, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* But only the final exiting thread in a task group, whatever it is,
|
/* 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 */
|
/* 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.
|
/* 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
|
* That is a bug. Let's just say that the child task just exited
|
||||||
@@ -366,7 +369,7 @@ static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status)
|
|||||||
|
|
||||||
#else /* HAVE_GROUP_MEMBERS */
|
#else /* HAVE_GROUP_MEMBERS */
|
||||||
|
|
||||||
static inline void task_sigchild(FAR struct tcb_s *ptcb,
|
static inline void nxtask_sigchild(FAR struct tcb_s *ptcb,
|
||||||
FAR struct tcb_s *ctcb, int status)
|
FAR struct tcb_s *ctcb, int status)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
siginfo_t info;
|
||||||
@@ -383,7 +386,7 @@ static inline void task_sigchild(FAR struct tcb_s *ptcb,
|
|||||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||||
/* Save the exit status now of the main thread */
|
/* Save the exit status now of the main thread */
|
||||||
|
|
||||||
task_exitstatus(ptcb->group, status);
|
nxtask_exitstatus(ptcb->group, status);
|
||||||
|
|
||||||
#else /* CONFIG_SCHED_CHILD_STATUS */
|
#else /* CONFIG_SCHED_CHILD_STATUS */
|
||||||
/* Exit status is not retained. Just decrement the number of
|
/* 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 */
|
#endif /* HAVE_GROUP_MEMBERS */
|
||||||
#else /* CONFIG_SCHED_HAVE_PARENT && !CONFIG_DISABLE_SIGNALS */
|
#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 */
|
#endif /* CONFIG_SCHED_HAVE_PARENT && !CONFIG_DISABLE_SIGNALS */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_signalparent
|
* Name: nxtask_signalparent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send the SIGCHILD signal to the parent task group
|
* 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
|
#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
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
DEBUGASSERT(ctcb && ctcb->group);
|
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 */
|
/* 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();
|
sched_unlock();
|
||||||
#else
|
#else
|
||||||
FAR struct tcb_s *ptcb;
|
FAR struct tcb_s *ptcb;
|
||||||
@@ -456,7 +459,7 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
|
|||||||
sched_lock();
|
sched_lock();
|
||||||
|
|
||||||
/* Get the TCB of the receiving, parent task. We do this early to
|
/* 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
|
* set to an invalid value below and the following call will fail if we
|
||||||
* are called again.
|
* 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 */
|
/* 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 */
|
/* Forget who our parent was */
|
||||||
|
|
||||||
@@ -481,11 +484,11 @@ static inline void task_signalparent(FAR struct tcb_s *ctcb, int status)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define task_signalparent(ctcb,status)
|
# define nxtask_signalparent(ctcb,status)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_exitwakeup
|
* Name: nxtask_exitwakeup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wakeup any tasks waiting for this task to exit
|
* 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)
|
#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;
|
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
|
#else
|
||||||
# define task_exitwakeup(tcb, status)
|
# define nxtask_exitwakeup(tcb, status)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_flushstreams
|
* Name: nxtask_flushstreams
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Flush all streams when the final thread of a group exits.
|
* 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
|
#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;
|
FAR struct task_group_s *group = tcb->group;
|
||||||
|
|
||||||
@@ -578,7 +581,7 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define task_flushstreams(tcb)
|
# define nxtask_flushstreams(tcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -586,7 +589,7 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_exithook
|
* Name: nxtask_exithook
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function implements some of the internal logic of exit() and
|
* 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
|
* to-run list. The following logic is safe because we will not be
|
||||||
* returning from the exit() call.
|
* returning from the exit() call.
|
||||||
*
|
*
|
||||||
* When called from task_terminate() we are operating on a different thread;
|
* When called from nxtask_terminate() we are operating on a different
|
||||||
* on the thread that called task_delete(). In this case, task_delete
|
* thread; on the thread that called task_delete(). In this case,
|
||||||
* will have already removed the tcb from the ready-to-run list to prevent
|
* task_delete will have already removed the tcb from the ready-to-run
|
||||||
* any further action on this task.
|
* list to prevent any further action on this task.
|
||||||
*
|
*
|
||||||
* nonblocking will be set true only when we are called from task_terminate()
|
* nonblocking will be set true only when we are called from
|
||||||
* via _exit(). In that case, we must be careful to do nothing that can
|
* nxtask_terminate() via _exit(). In that case, we must be careful to do
|
||||||
* cause the cause the thread to block.
|
* 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
|
* 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..
|
* 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)
|
if (!nonblocking)
|
||||||
{
|
{
|
||||||
task_atexit(tcb);
|
nxtask_atexit(tcb);
|
||||||
|
|
||||||
/* Call any registered on_exit function(s) */
|
/* Call any registered on_exit function(s) */
|
||||||
|
|
||||||
task_onexit(tcb, status);
|
nxtask_onexit(tcb, status);
|
||||||
}
|
}
|
||||||
#endif
|
#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.
|
* state. Make some feeble effort to recover the state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
task_recover(tcb);
|
nxtask_recover(tcb);
|
||||||
|
|
||||||
/* Send the SIGCHILD signal to the parent task group */
|
/* 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 */
|
/* 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
|
/* If this is the last thread in the group, then flush all streams (File
|
||||||
* descriptors will be closed when the TCB is deallocated).
|
* 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)
|
if (!nonblocking)
|
||||||
{
|
{
|
||||||
task_flushstreams(tcb);
|
nxtask_flushstreams(tcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TASK_GROUP
|
#ifdef HAVE_TASK_GROUP
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* OK on success; ERROR on failure with errno set appropriately. (See
|
* 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
|
* caller is responsible for freeing the stack memory and for calling
|
||||||
* sched_releasetcb() to free the TCB (which could be in most any state).
|
* sched_releasetcb() to free the TCB (which could be in most any state).
|
||||||
*
|
*
|
||||||
@@ -129,7 +129,7 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
|
|||||||
|
|
||||||
/* Initialize the task control block */
|
/* Initialize the task control block */
|
||||||
|
|
||||||
ret = task_schedsetup(ttcb, priority, task_start, entry,
|
ret = nxtask_schedsetup(ttcb, priority, nxtask_start, entry,
|
||||||
TCB_FLAG_TTYPE_TASK);
|
TCB_FLAG_TTYPE_TASK);
|
||||||
if (ret < OK)
|
if (ret < OK)
|
||||||
{
|
{
|
||||||
@@ -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 */
|
/* 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 */
|
/* Now we have enough in place that we can join the group */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_posixspawn.c
|
* 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>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: posix_spawn_exec
|
* Name: nxposix_spawn_exec
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Execute the task from the file system.
|
* Execute the task from the file system.
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int posix_spawn_exec(FAR pid_t *pidp, FAR const char *path,
|
static int nxposix_spawn_exec(FAR pid_t *pidp, FAR const char *path,
|
||||||
FAR const posix_spawnattr_t *attr,
|
FAR const posix_spawnattr_t *attr,
|
||||||
FAR char * const argv[])
|
FAR char * const argv[])
|
||||||
{
|
{
|
||||||
@@ -153,18 +153,18 @@ errout:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: posix_spawn_proxy
|
* Name: nxposix_spawn_proxy
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform file_actions, then execute the task from the file system.
|
* Perform file_actions, then execute the task from the file system.
|
||||||
*
|
*
|
||||||
* Do we really need this proxy task? Isn't that wasteful?
|
* 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
|
* to perform these operations after the file is loaded from
|
||||||
* the file system?
|
* the file system?
|
||||||
* A: That existing task_starthook() implementation cannot be used in
|
* A: That existing nxtask_starthook() implementation cannot be used in
|
||||||
* this context; any of task_starthook() will also conflict with
|
* this context; any of nxtask_starthook() will also conflict with
|
||||||
* binfmt's use of the start hook to call C++ static initializers.
|
* binfmt's use of the start hook to call C++ static initializers.
|
||||||
* task_restart() would also be an issue.
|
* 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;
|
int ret;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ static int posix_spawn_proxy(int argc, FAR char *argv[])
|
|||||||
{
|
{
|
||||||
/* Start the task */
|
/* Start the task */
|
||||||
|
|
||||||
ret = posix_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.posix.path,
|
ret = nxposix_spawn_exec(g_spawn_parms.pid, g_spawn_parms.u.posix.path,
|
||||||
g_spawn_parms.attr, g_spawn_parms.argv);
|
g_spawn_parms.attr, g_spawn_parms.argv);
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||||
@@ -363,7 +363,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
|
|||||||
if (file_actions == NULL || *file_actions == NULL)
|
if (file_actions == NULL || *file_actions == NULL)
|
||||||
#endif
|
#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
|
/* 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
|
/* Disable pre-emption so that the proxy does not run until waitpid
|
||||||
* is called. This is probably unnecessary since the posix_spawn_proxy has
|
* is called. This is probably unnecessary since the nxposix_spawn_proxy
|
||||||
* the same priority as this thread; it should be schedule behind this
|
* has the same priority as this thread; it should be schedule behind
|
||||||
* task in the ready-to-run list.
|
* this task in the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_WAITPID
|
#ifdef CONFIG_SCHED_WAITPID
|
||||||
@@ -414,14 +414,14 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
|
|||||||
* task.
|
* task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
proxy = kthread_create("posix_spawn_proxy", param.sched_priority,
|
proxy = kthread_create("nxposix_spawn_proxy", param.sched_priority,
|
||||||
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
|
||||||
(main_t)posix_spawn_proxy,
|
(main_t)nxposix_spawn_proxy,
|
||||||
(FAR char * const *)NULL);
|
(FAR char * const *)NULL);
|
||||||
if (proxy < 0)
|
if (proxy < 0)
|
||||||
{
|
{
|
||||||
ret = -proxy;
|
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;
|
goto errout_with_lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: task_recover
|
* Name: nxtask_recover
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called when a task is deleted via task_delete() or
|
* 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. */
|
/* The task is being deleted. Cancel in pending timeout events. */
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ int task_restart(pid_t pid)
|
|||||||
|
|
||||||
/* Try to recover from any bad states */
|
/* 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 */
|
/* Kill any children of this thread */
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ int task_restart(pid_t pid)
|
|||||||
ret = task_activate((FAR struct tcb_s *)tcb);
|
ret = task_activate((FAR struct tcb_s *)tcb);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
(void)task_terminate(pid, true);
|
(void)nxtask_terminate(pid, true);
|
||||||
errcode = -ret;
|
errcode = -ret;
|
||||||
goto errout_with_lock;
|
goto errout_with_lock;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user