Skip to content
Snippets Groups Projects
Commit 2a0167d0 authored by patacongo's avatar patacongo
Browse files

Patches for NSH disable background, and ARMv7M assembly from Freddie Chopin

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5398 42af7a65-404d-4744-a932-0658087f49c3
parent 2d8bb1d2
No related branches found
No related tags found
No related merge requests found
...@@ -122,13 +122,28 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, ...@@ -122,13 +122,28 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
ret = exec_namedapp(cmd, (FAR const char **)argv); ret = exec_namedapp(cmd, (FAR const char **)argv);
if (ret >= 0) if (ret >= 0)
{ {
/* The application was successfully started (but still blocked because the /* The application was successfully started (but still blocked because
* scheduler is locked). If the application was not backgrounded, then we * the scheduler is locked). If the application was not backgrounded,
* need to wait here for the application to exit. * then we need to wait here for the application to exit. These really
* only works works with the following options:
*
* - CONFIG_NSH_DISABLEBG - Do not run commands in background
* - CONFIG_SCHED_WAITPID - Required to run external commands in
* foreground
*
* These concepts do not apply cleanly to the external applications.
*/ */
#ifdef CONFIG_SCHED_WAITPID #ifdef CONFIG_SCHED_WAITPID
/* CONFIG_SCHED_WAITPID is selected, so we may run the command in
* foreground unless we were specifically requested to run the command
* in background (and running commands in background is enabled).
*/
# ifndef CONFIG_NSH_DISABLEBG
if (vtbl->np.np_bg == false) if (vtbl->np.np_bg == false)
# endif /* CONFIG_NSH_DISABLEBG */
{ {
int rc = 0; int rc = 0;
...@@ -155,8 +170,25 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, ...@@ -155,8 +170,25 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
*/ */
} }
} }
# ifndef CONFIG_NSH_DISABLEBG
else else
#endif # endif /* CONFIG_NSH_DISABLEBG */
#endif /* CONFIG_SCHED_WAITPID */
/* We get here if either:
*
* - CONFIG_SCHED_WAITPID is not selected meaning that all commands
* have to be run in background, or
* - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected, but the
* user requested to run the command in background.
*
* NOTE that the case of a) CONFIG_SCHED_WAITPID is not selected and
* b) CONFIG_NSH_DISABLEBG selected cannot be supported. In that event, all
* commands will have to run in background. The waitpid() API must be
* available to support running the command in foreground.
*/
#if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG)
{ {
struct sched_param param; struct sched_param param;
sched_getparam(0, &param); sched_getparam(0, &param);
...@@ -168,6 +200,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, ...@@ -168,6 +200,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
ret = OK; ret = OK;
} }
#endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */
} }
sched_unlock(); sched_unlock();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment