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
This commit is contained in:
patacongo
2013-01-08 16:25:30 +00:00
parent 69f428e2b9
commit c76795d32b
23 changed files with 669 additions and 123 deletions
+18 -3
View File
@@ -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);