summaryrefslogtreecommitdiff
path: root/nuttx/sched/task_vfork.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-08 21:42:23 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-08 21:42:23 +0000
commit08650208d65dad8629ef44064f443dfbc2420f38 (patch)
tree276ac05e5d6d6f4a9b9c88a61ab784ece0c8180b /nuttx/sched/task_vfork.c
parent1603b1a112981f8054b69612a5ad0721eb865bbd (diff)
downloadpx4-nuttx-08650208d65dad8629ef44064f443dfbc2420f38.tar.gz
px4-nuttx-08650208d65dad8629ef44064f443dfbc2420f38.tar.bz2
px4-nuttx-08650208d65dad8629ef44064f443dfbc2420f38.zip
Fixes to get STM32F3Discovery running
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5627 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_vfork.c')
-rw-r--r--nuttx/sched/task_vfork.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c
index 5ac368cbf..7008a016e 100644
--- a/nuttx/sched/task_vfork.c
+++ b/nuttx/sched/task_vfork.c
@@ -123,11 +123,21 @@ FAR struct task_tcb_s *task_vforksetup(start_t retaddr)
return NULL;
}
+ /* Allocate a new task group */
+
+#ifdef HAVE_TASK_GROUP
+ ret = group_allocate(child);
+ if (ret < 0)
+ {
+ goto errout_with_tcb;
+ }
+#endif
+
/* Associate file descriptors with the new task */
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
ret = group_setuptaskfiles(child);
- if (ret != OK)
+ if (ret < OK)
{
goto errout_with_tcb;
}
@@ -146,7 +156,7 @@ FAR struct task_tcb_s *task_vforksetup(start_t retaddr)
svdbg("Child priority=%d start=%p\n", priority, retaddr);
ret = task_schedsetup(child, priority, retaddr, parent->entry.main,
TCB_FLAG_TTYPE_TASK);
- if (ret != OK)
+ if (ret < OK)
{
goto errout_with_tcb;
}
@@ -228,6 +238,17 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
(void)task_argsetup(child, name, (FAR char * const *)NULL);
+ /* Now we have enough in place that we can join the group */
+
+#ifdef HAVE_TASK_GROUP
+ ret = group_initialize(child);
+ if (ret < 0)
+ {
+ task_vforkabort(child, -ret);
+ return ERROR;
+ }
+#endif
+
/* Get the assigned pid before we start the task */
pid = (int)child->cmn.pid;
@@ -235,7 +256,7 @@ pid_t task_vforkstart(FAR struct task_tcb_s *child)
/* Activate the task */
ret = task_activate((FAR struct tcb_s *)child);
- if (ret != OK)
+ if (ret < OK)
{
task_vforkabort(child, -ret);
return ERROR;