aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched/os_bringup.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-16 21:15:27 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-16 21:15:27 +0000
commit14a896b20509dfc4657778fa21246cffb2ec2b55 (patch)
tree966aa2197272d9b52e3e25177cd78cea2751ade2 /nuttx/sched/os_bringup.c
parent8fc05d82fc7e1258cff333dcdebfb718820d0d48 (diff)
downloadpx4-firmware-14a896b20509dfc4657778fa21246cffb2ec2b55.tar.gz
px4-firmware-14a896b20509dfc4657778fa21246cffb2ec2b55.tar.bz2
px4-firmware-14a896b20509dfc4657778fa21246cffb2ec2b55.zip
Add basic hooks to support a PATH variable (more is needed)
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5440 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/os_bringup.c')
-rw-r--r--nuttx/sched/os_bringup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c
index ec6152891..e0a236bbe 100644
--- a/nuttx/sched/os_bringup.c
+++ b/nuttx/sched/os_bringup.c
@@ -44,6 +44,7 @@
#include <nuttx/config.h>
#include <sched.h>
+#include <stdlib.h>
#include <debug.h>
#include <nuttx/init.h>
@@ -129,6 +130,17 @@ int os_bringup(void)
#endif
int init_taskid;
+ /* Setup up the initial environment for the idle task. At present, this
+ * may consist of only the initial PATH variable. The PATH variable is
+ * (probably) not used by the IDLE task. However, the environment
+ * containing the PATH variable will be inherited by all of the threads
+ * created by the IDLE task.
+ */
+
+#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_PATH_INITIAL)
+ (void)setenv("PATH", CONFIG_PATH_INITIAL, 1);
+#endif
+
/* Start the page fill worker kernel thread that will resolve page faults.
* This should always be the first thread started because it may have to
* resolve page faults in other threads
@@ -190,5 +202,12 @@ int os_bringup(void)
(main_t)CONFIG_USER_ENTRYPOINT, (const char **)NULL);
#endif
ASSERT(init_taskid != ERROR);
+
+ /* We an save a few bytes by discarding the IDLE thread's environment. */
+
+#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_PATH_INITIAL)
+ (void)clearenv();
+#endif
+
return OK;
}