diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-17 14:43:55 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-17 14:43:55 +0000 |
commit | d8d9cc8a96cdc2219af7bec8142e7633779fd685 (patch) | |
tree | d9cf39f88361f174a2350d354ffb5584d43e2fc4 /apps/builtin/exec_builtin.c | |
parent | 4f0e8b1249c1550bac83f9db61c67094bc6afc2d (diff) | |
download | px4-nuttx-d8d9cc8a96cdc2219af7bec8142e7633779fd685.tar.gz px4-nuttx-d8d9cc8a96cdc2219af7bec8142e7633779fd685.tar.bz2 px4-nuttx-d8d9cc8a96cdc2219af7bec8142e7633779fd685.zip |
Add logic to automatically unload module on exit; Several patches from Mike Smith
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5528 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/builtin/exec_builtin.c')
-rw-r--r-- | apps/builtin/exec_builtin.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 05648590d..d4431164c 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -142,8 +142,17 @@ static void bultin_semtake(FAR sem_t *sem) static int builtin_taskcreate(int index, FAR const char **argv) { + FAR const struct builtin_s *b; int ret; + b = builtin_for_index(index); + + if (b == NULL) + { + errno = ENOENT; + return ERROR; + } + /* Disable pre-emption. This means that although we start the builtin * application here, it will not actually run until pre-emption is * re-enabled below. @@ -153,8 +162,7 @@ static int builtin_taskcreate(int index, FAR const char **argv) /* Start the builtin application task */ - ret = TASK_CREATE(g_builtins[index].name, g_builtins[index].priority, - g_builtins[index].stacksize, g_builtins[index].main, + ret = TASK_CREATE(b->name, b->priority, b->stacksize, b->main, (argv) ? &argv[1] : (FAR const char **)NULL); /* If robin robin scheduling is enabled, then set the scheduling policy @@ -171,7 +179,7 @@ static int builtin_taskcreate(int index, FAR const char **argv) * new task cannot yet have changed from its initial value. */ - param.sched_priority = g_builtins[index].priority; + param.sched_priority = b->priority; (void)sched_setscheduler(ret, SCHED_RR, ¶m); } #endif @@ -293,8 +301,6 @@ static inline int builtin_startproxy(int index, FAR const char **argv, int errcode; int ret; - DEBUGASSERT(path); - svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n", index, argv, redirfile, oflags); |