diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-21 23:37:11 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-21 23:37:11 +0000 |
commit | 7406abbc5ac56892524846c8a19d2aabfc34eef4 (patch) | |
tree | 407cb38c04306722a9e3fb6136fa4e3058e22e5c /nuttx/sched | |
parent | 7fd81076443ca5685f38f02ecd926e8bda368c9b (diff) | |
download | px4-nuttx-7406abbc5ac56892524846c8a19d2aabfc34eef4.tar.gz px4-nuttx-7406abbc5ac56892524846c8a19d2aabfc34eef4.tar.bz2 px4-nuttx-7406abbc5ac56892524846c8a19d2aabfc34eef4.zip |
Corrections needed after further test of stack-based task arguments
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5771 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/os_start.c | 15 | ||||
-rw-r--r-- | nuttx/sched/sched_releasetcb.c | 6 | ||||
-rw-r--r-- | nuttx/sched/sig_deliver.c | 7 | ||||
-rw-r--r-- | nuttx/sched/task_setup.c | 2 |
4 files changed, 24 insertions, 6 deletions
diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index fbb3b7743..100c736b2 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -286,12 +286,27 @@ void os_start(void) g_idletcb.cmn.task_state = TSTATE_TASK_RUNNING; g_idletcb.cmn.entry.main = (main_t)os_start; + /* Set the IDLE task name */ + #if CONFIG_TASK_NAME_SIZE > 0 strncpy(g_idletcb.cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE-1); +#endif /* CONFIG_TASK_NAME_SIZE */ + + /* Configure the task name in the argument list. The IDLE task does + * not really have an argument list, but this name is still useful + * for things like the NSH PS command. + * + * In the kernel mode build, the arguments are saved on the task's stack + * and there is no support that yet. + */ + +#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) +#if CONFIG_TASK_NAME_SIZE > 0 g_idletcb.argv[0] = g_idletcb.cmn.name; #else g_idletcb.argv[0] = (char*)g_idlename; #endif /* CONFIG_TASK_NAME_SIZE */ +#endif /* CONFIG_CUSTOM_STACK || !CONFIG_NUTTX_KERNEL */ /* Then add the idle task's TCB to the head of the ready to run list */ diff --git a/nuttx/sched/sched_releasetcb.c b/nuttx/sched/sched_releasetcb.c index cbb58002d..aefc5264d 100644 --- a/nuttx/sched/sched_releasetcb.c +++ b/nuttx/sched/sched_releasetcb.c @@ -101,7 +101,9 @@ static void sched_releasepid(pid_t pid) int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) { int ret = OK; +#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) int i; +#endif if (tcb) { @@ -156,7 +158,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) } #endif -#if !defined(CONFIG_CUSTOM_STACK) && defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) /* Release command line arguments that were allocated for task * start/re-start. * @@ -176,7 +178,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) } } -#endif /* !CONFIG_CUSTOM_STACK && CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_CUSTOM_STACK || !CONFIG_NUTTX_KERNEL */ /* Release this thread's reference to the address environment */ diff --git a/nuttx/sched/sig_deliver.c b/nuttx/sched/sig_deliver.c index 9b1e8cebe..0b3dc9f4c 100644 --- a/nuttx/sched/sig_deliver.c +++ b/nuttx/sched/sig_deliver.c @@ -43,6 +43,7 @@ #include <signal.h> #include <unistd.h> #include <sched.h> +#include <string.h> #include <debug.h> #include <nuttx/arch.h> @@ -137,15 +138,15 @@ void sig_deliver(FAR struct tcb_s *stcb) if ((stcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) { /* The sigq_t pointed to by sigq resides in kernel space. So we - * cannot pass a reference to sigq->info to the user space. - * Instead, we will copy the siginfo_t structure onto that stack. + * cannot pass a reference to sigq->info to the user application. + * Instead, we will copy the siginfo_t structure onto the stack. * We are currently executing on the stack of the user thread * (albeit temporarily in kernel mode), so the copy of the * siginfo_t structure will be accessible by the user thread. */ siginfo_t info; - memcpy(&info, sigq->info, sizeof(siginfo_t)); + memcpy(&info, &sigq->info, sizeof(siginfo_t)); up_signal_handler(sigq->action.sighandler, sigq->info.si_signo, &info, NULL); diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index 85e828fd0..bed452759 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -545,7 +545,7 @@ static int task_stackargsetup(FAR struct task_tcb_s *tcb, { /* A NULL argument terminates the list */ - if (!tcb->argv[argc]) + if (!argv[argc]) { break; } |