summaryrefslogtreecommitdiff
path: root/nuttx/binfmt/binfmt_exec.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-17 18:32:13 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-17 18:32:13 +0000
commit68453d683cb221e509258d71bddf207a330a1656 (patch)
tree677aa6a3af5241be04684f2d02eb0e719234b68c /nuttx/binfmt/binfmt_exec.c
parentd8d9cc8a96cdc2219af7bec8142e7633779fd685 (diff)
downloadpx4-nuttx-68453d683cb221e509258d71bddf207a330a1656.tar.gz
px4-nuttx-68453d683cb221e509258d71bddf207a330a1656.tar.bz2
px4-nuttx-68453d683cb221e509258d71bddf207a330a1656.zip
NSH will now run files from the file system; Add logic to unload and clean-up after running a task from a file system; Extensions to builtin apps from Mike Smith
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5529 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/binfmt_exec.c')
-rw-r--r--nuttx/binfmt/binfmt_exec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c
index 1cead4384..7f45fb841 100644
--- a/nuttx/binfmt/binfmt_exec.c
+++ b/nuttx/binfmt/binfmt_exec.c
@@ -43,6 +43,7 @@
#include <debug.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt_internal.h"
@@ -97,6 +98,7 @@ int exec(FAR const char *filename, FAR const char **argv,
#ifdef CONFIG_SCHED_ONEXIT
FAR struct binary_s *bin;
int errorcode;
+ int pid;
int ret;
/* Allocate the load information */
@@ -131,8 +133,8 @@ int exec(FAR const char *filename, FAR const char **argv,
/* Then start the module */
- ret = exec_module(bin);
- if (ret < 0)
+ pid = exec_module(bin);
+ if (pid < 0)
{
bdbg("ERROR: Failed to execute program '%s'\n", filename);
sched_unlock();
@@ -145,14 +147,14 @@ int exec(FAR const char *filename, FAR const char **argv,
* when the task exists.
*/
- ret = schedul_unload(ret, bin);
+ ret = schedule_unload(pid, bin);
if (ret < 0)
{
bdbg("ERROR: Failed to schedul unload '%s'\n", filename);
}
sched_unlock();
- return ret;
+ return pid;
#else
struct binary_s bin;
int ret;