summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-29 10:45:44 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-29 10:45:44 -0600
commitdcae5bf2e30fb326db1dd1c8629d8b99ce29e948 (patch)
tree83fa2c66f269e96d31656644672a505105df0bfd /nuttx/arch
parent4696763abed8c67b273562bd887387d05eebb9f6 (diff)
downloadpx4-nuttx-dcae5bf2e30fb326db1dd1c8629d8b99ce29e948.tar.gz
px4-nuttx-dcae5bf2e30fb326db1dd1c8629d8b99ce29e948.tar.bz2
px4-nuttx-dcae5bf2e30fb326db1dd1c8629d8b99ce29e948.zip
Fix vfork(). Now that arguments are kept on the stack, the way that arguments are passed from parent to child in vfork() must change. This bug has always been present, but was not visible with the old strdup() way of passing arguments
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/common/up_vfork.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/nuttx/arch/arm/src/common/up_vfork.c b/nuttx/arch/arm/src/common/up_vfork.c
index 5d328a863..b578bd027 100644
--- a/nuttx/arch/arm/src/common/up_vfork.c
+++ b/nuttx/arch/arm/src/common/up_vfork.c
@@ -102,7 +102,7 @@
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
* - Configuration of environment variables
- * - Setup the intput parameters for the task.
+ * - Setup the input parameters for the task.
* - Initialization of the TCB (including call to up_initial_state()
* 4) up_vfork() provides any additional operating context. up_vfork must:
* - Allocate and initialize the stack
@@ -113,7 +113,7 @@
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
*
- * Input Paremeters:
+ * Input Parameters:
* context - Caller context information saved by vfork()
*
* Return:
@@ -147,15 +147,15 @@ pid_t up_vfork(const struct vfork_s *context)
child = task_vforksetup((start_t)(context->lr & ~1));
if (!child)
{
- sdbg("task_vforksetup failed\n");
+ sdbg("ERROR: task_vforksetup failed\n");
return (pid_t)ERROR;
}
- svdbg("Parent=%p Child=%p\n", parent, child);
+ svdbg("TCBs: Parent=%p Child=%p\n", parent, child);
/* Get the size of the parent task's stack. Due to alignment operations,
* the adjusted stack size may be smaller than the stack size originally
- * requrested.
+ * requested.
*/
stacksize = parent->adj_stack_size + CONFIG_STACK_ALIGNMENT - 1;
@@ -166,7 +166,7 @@ pid_t up_vfork(const struct vfork_s *context)
parent->flags & TCB_FLAG_TTYPE_MASK);
if (ret != OK)
{
- sdbg("up_create_stack failed: %d\n", ret);
+ sdbg("ERROR: up_create_stack failed: %d\n", ret);
task_vforkabort(child, -ret);
return (pid_t)ERROR;
}
@@ -180,9 +180,9 @@ pid_t up_vfork(const struct vfork_s *context)
DEBUGASSERT((uint32_t)parent->adj_stack_ptr > context->sp);
stackutil = (uint32_t)parent->adj_stack_ptr - context->sp;
- svdbg("stacksize:%d stackutil:%d\n", stacksize, stackutil);
+ svdbg("Parent: stacksize:%d stackutil:%d\n", stacksize, stackutil);
- /* Make some feeble effort to perserve the stack contents. This is
+ /* Make some feeble effort to preserve the stack contents. This is
* feeble because the stack surely contains invalid pointers and other
* content that will not work in the child context. However, if the
* user follows all of the caveats of vfork() usage, even this feeble
@@ -205,9 +205,9 @@ pid_t up_vfork(const struct vfork_s *context)
newfp = context->fp;
}
- svdbg("Old stack base:%08x SP:%08x FP:%08x\n",
+ svdbg("Parent: stack base:%08x SP:%08x FP:%08x\n",
parent->adj_stack_ptr, context->sp, context->fp);
- svdbg("New stack base:%08x SP:%08x FP:%08x\n",
+ svdbg("Child: stack base:%08x SP:%08x FP:%08x\n",
child->cmn.adj_stack_ptr, newsp, newfp);
/* Update the stack pointer, frame pointer, and volatile registers. When