summaryrefslogtreecommitdiff
path: root/nuttx/binfmt/binfmt_exec.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-08 16:25:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-08 16:25:30 +0000
commit4c8b88b97559ddc6714fc17e9a281a13a65f88c0 (patch)
treebe370af4ffb6147bbbf103f66fcc69ed55bf5893 /nuttx/binfmt/binfmt_exec.c
parent2e5aef172a920610e3071325b4be95b71a83948a (diff)
downloadpx4-nuttx-4c8b88b97559ddc6714fc17e9a281a13a65f88c0.tar.gz
px4-nuttx-4c8b88b97559ddc6714fc17e9a281a13a65f88c0.tar.bz2
px4-nuttx-4c8b88b97559ddc6714fc17e9a281a13a65f88c0.zip
Add execv() and execl(); Move lm3s header files for compatibility
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5492 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/binfmt_exec.c')
-rw-r--r--nuttx/binfmt/binfmt_exec.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c
index 60e8d8efd..d5e274710 100644
--- a/nuttx/binfmt/binfmt_exec.c
+++ b/nuttx/binfmt/binfmt_exec.c
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/binfmt_exec.c
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -75,7 +75,8 @@
*
* Description:
* This is a convenience function that wraps load_ and exec_module into
- * one call.
+ * one call. The priority of the executed program is set to be the
+ * same as the priority of the calling thread.
*
* Input Parameter:
* filename - Fulll path to the binary to be loaded
@@ -94,8 +95,20 @@ int exec(FAR const char *filename, FAR const char **argv,
FAR const struct symtab_s *exports, int nexports)
{
struct binary_s bin;
+ struct sched_param param;
int ret;
+ /* Get the priority of this thread */
+
+ ret = sched_getparam(0, &param);
+ if (ret < 0)
+ {
+ bdbg("ERROR: sched_getparam failed: %d\n", errno);
+ return ERROR;
+ }
+
+ /* Load the module into memory */
+
memset(&bin, 0, sizeof(struct binary_s));
bin.filename = filename;
bin.exports = exports;
@@ -108,7 +121,9 @@ int exec(FAR const char *filename, FAR const char **argv,
return ERROR;
}
- ret = exec_module(&bin, 50);
+ /* Then start the module at the priority of this thread */
+
+ ret = exec_module(&bin, param.sched_priority);
if (ret < 0)
{
bdbg("ERROR: Failed to execute program '%s'\n", filename);