diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-08 21:42:23 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-08 21:42:23 +0000 |
commit | 08650208d65dad8629ef44064f443dfbc2420f38 (patch) | |
tree | 276ac05e5d6d6f4a9b9c88a61ab784ece0c8180b /nuttx/sched | |
parent | 1603b1a112981f8054b69612a5ad0721eb865bbd (diff) | |
download | px4-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')
-rw-r--r-- | nuttx/sched/task_create.c | 6 | ||||
-rw-r--r-- | nuttx/sched/task_vfork.c | 27 |
2 files changed, 27 insertions, 6 deletions
diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c index 15bdebdb9..c160cb52c 100644 --- a/nuttx/sched/task_create.c +++ b/nuttx/sched/task_create.c @@ -135,7 +135,7 @@ static int thread_create(const char *name, uint8_t ttype, int priority, #if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 ret = group_setuptaskfiles(tcb); - if (ret != OK) + if (ret < OK) { errcode = -ret; goto errout_with_tcb; @@ -146,7 +146,7 @@ static int thread_create(const char *name, uint8_t ttype, int priority, #ifndef CONFIG_CUSTOM_STACK ret = up_create_stack((FAR struct tcb_s *)tcb, stack_size); - if (ret != OK) + if (ret < OK) { errcode = -ret; goto errout_with_tcb; @@ -184,7 +184,7 @@ static int thread_create(const char *name, uint8_t ttype, int priority, /* Activate the task */ ret = task_activate((FAR struct tcb_s *)tcb); - if (ret != OK) + if (ret < OK) { errcode = get_errno(); 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; |