summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-02-18 11:50:32 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-02-18 11:50:32 -0600
commitb34a29bb2329477ff4ae77abc31f3bcadf17299e (patch)
tree3284800a53f2c206f6ea1420ec67e7fe675f74f3
parenta5ace7642fac95547c78bf5514f985e14564378f (diff)
downloadnuttx-b34a29bb2329477ff4ae77abc31f3bcadf17299e.tar.gz
nuttx-b34a29bb2329477ff4ae77abc31f3bcadf17299e.tar.bz2
nuttx-b34a29bb2329477ff4ae77abc31f3bcadf17299e.zip
sched/task_terminate always return an error because return value was not being set correctory. From Gosha
-rw-r--r--nuttx/ChangeLog2
-rw-r--r--nuttx/configs/samd20-xplained/README.txt4
-rw-r--r--nuttx/sched/sched_releasetcb.c1
-rw-r--r--nuttx/sched/task_exit.c7
-rw-r--r--nuttx/sched/task_terminate.c13
5 files changed, 14 insertions, 13 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 4aceaf6f0..4a8390ab8 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -6586,4 +6586,6 @@
connecting to a server (2014-2-15).
* The basic SAMD20 Xplained Pro port is complete but still untested
(2014-2-16).
+ * sched/task_terminate.c: Always returns an error because the
+ return value was not being set correctly. From Gosha (2014-2-18).
diff --git a/nuttx/configs/samd20-xplained/README.txt b/nuttx/configs/samd20-xplained/README.txt
index 6ca880932..81962e590 100644
--- a/nuttx/configs/samd20-xplained/README.txt
+++ b/nuttx/configs/samd20-xplained/README.txt
@@ -852,7 +852,7 @@ Configuration sub-directories
STATUS/ISSUES:
- 1. The FLASH waistates is set to 2 (see include/board.h). According to
+ 1. The FLASH waitstates is set to 2 (see include/board.h). According to
the data sheet, it should work at 1 but I sometimes see crashes when
the waitstates are set to one (about half of the time) (2014-2-18).
@@ -860,7 +860,7 @@ Configuration sub-directories
the time) or after a power cycle (less after a power cycle). I don't
understand the cause of of this but most of this can be eliminated by
simply holding the the reset button longer and releasing it cleanly
- (then it fails maybe 5-10% of the time, mabe because of button
+ (then it fails maybe 5-10% of the time, maybe because of button
chatter?) (2014-2-18).
- The garbage is not random: It is always the same.
diff --git a/nuttx/sched/sched_releasetcb.c b/nuttx/sched/sched_releasetcb.c
index b0605ef3b..26476ec98 100644
--- a/nuttx/sched/sched_releasetcb.c
+++ b/nuttx/sched/sched_releasetcb.c
@@ -198,4 +198,3 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
return ret;
}
-
diff --git a/nuttx/sched/task_exit.c b/nuttx/sched/task_exit.c
index 031b22ed8..9483f65fd 100644
--- a/nuttx/sched/task_exit.c
+++ b/nuttx/sched/task_exit.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/task_exit.c
*
- * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2012-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -105,6 +105,7 @@ int task_exit(void)
{
FAR struct tcb_s *dtcb = (FAR struct tcb_s*)g_readytorun.head;
FAR struct tcb_s *rtcb;
+ int ret;
/* Remove the TCB of the current task from the ready-to-run list. A context
* switch will definitely be necessary -- that must be done by the
@@ -136,7 +137,7 @@ int task_exit(void)
*/
sched_addblocked(dtcb, TSTATE_TASK_INACTIVE);
- task_terminate(dtcb->pid, true);
+ ret = task_terminate(dtcb->pid, true);
rtcb->task_state = TSTATE_TASK_RUNNING;
/* If there are any pending tasks, then add them to the ready-to-run
@@ -157,5 +158,5 @@ int task_exit(void)
*/
rtcb->lockcount--;
- return OK;
+ return ret;
}
diff --git a/nuttx/sched/task_terminate.c b/nuttx/sched/task_terminate.c
index af8915d33..9d034d719 100644
--- a/nuttx/sched/task_terminate.c
+++ b/nuttx/sched/task_terminate.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/task_terminate.c
*
- * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
#include <sys/types.h>
#include <assert.h>
#include <queue.h>
+#include <errno.h>
#include <nuttx/sched.h>
#include <arch/irq.h>
@@ -123,7 +124,6 @@ int task_terminate(pid_t pid, bool nonblocking)
{
FAR struct tcb_s *dtcb;
irqstate_t saved_state;
- int ret = ERROR;
/* Make sure the task does not become ready-to-run while we are futzing with
* its TCB by locking ourselves as the executing task.
@@ -131,15 +131,15 @@ int task_terminate(pid_t pid, bool nonblocking)
sched_lock();
- /* Find for the TCB associated with matching pid */
+ /* Find for the TCB associated with matching PID */
dtcb = sched_gettcb(pid);
if (!dtcb)
{
- /* This pid does not correspond to any known task */
+ /* This PID does not correspond to any known task */
sched_unlock();
- return ERROR;
+ return -ESRCH;
}
/* Verify our internal sanity */
@@ -184,6 +184,5 @@ int task_terminate(pid_t pid, bool nonblocking)
/* Deallocate its TCB */
- sched_releasetcb(dtcb, dtcb->flags & TCB_FLAG_TTYPE_MASK);
- return ret;
+ return sched_releasetcb(dtcb, dtcb->flags & TCB_FLAG_TTYPE_MASK);
}