diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-08 16:25:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-08 16:25:30 +0000 |
commit | 14f72f7a210648fe6eaaac3359ec76cab62c7278 (patch) | |
tree | be370af4ffb6147bbbf103f66fcc69ed55bf5893 /nuttx/binfmt | |
parent | 3d160e45b64485aa5f231179bf61cdea8fc5c141 (diff) | |
download | px4-firmware-14f72f7a210648fe6eaaac3359ec76cab62c7278.tar.gz px4-firmware-14f72f7a210648fe6eaaac3359ec76cab62c7278.tar.bz2 px4-firmware-14f72f7a210648fe6eaaac3359ec76cab62c7278.zip |
Add execv() and execl(); Move lm3s header files for compatibility
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5492 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r-- | nuttx/binfmt/binfmt_exec.c | 21 |
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, ¶m); + 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); |