summaryrefslogtreecommitdiff
path: root/nuttx/binfmt/binfmt_loadmodule.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-17 20:25:27 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-17 20:25:27 +0000
commitd8ee4cfaf8afacfe8ff455900ed391af4f642888 (patch)
treed477c2d0bde57c71a78722de873a78b035357c75 /nuttx/binfmt/binfmt_loadmodule.c
parent7a34357c62dd8c1910f444d37f80ed18425b7fad (diff)
downloadnuttx-d8ee4cfaf8afacfe8ff455900ed391af4f642888.tar.gz
nuttx-d8ee4cfaf8afacfe8ff455900ed391af4f642888.tar.bz2
nuttx-d8ee4cfaf8afacfe8ff455900ed391af4f642888.zip
Add exec_module
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1895 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/binfmt_loadmodule.c')
-rw-r--r--nuttx/binfmt/binfmt_loadmodule.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c
index 37910ae7c..b73b6223e 100644
--- a/nuttx/binfmt/binfmt_loadmodule.c
+++ b/nuttx/binfmt/binfmt_loadmodule.c
@@ -64,17 +64,22 @@
* Private Functions
****************************************************************************/
-/***********************************************************************
+/****************************************************************************
* Public Functions
- ***********************************************************************/
+ ****************************************************************************/
-/***********************************************************************
+/****************************************************************************
* Name: load_module
*
* Description:
* Load a module into memory and prep it for execution.
*
- ***********************************************************************/
+ * Returned Value:
+ * This is an end-user function, so it follows the normal convention:
+ * Returns 0 (OK) on success. On failure, it returns -1 (ERROR) with
+ * errno set appropriately.
+ *
+ ****************************************************************************/
int load_module(const char *filename, FAR struct binary_s *bin)
{
@@ -120,8 +125,15 @@ int load_module(const char *filename, FAR struct binary_s *bin)
sched_unlock();
}
- if (ret < 0) bdbg("Returning %d\n", ret);
- return ret;
+ /* This is an end-user function. Return failures via errno */
+
+ if (ret < 0)
+ {
+ bdbg("Returning errno %d\n", -ret);
+ errno = -ret;
+ return ERROR;
+ }
+ return OK;
}