From 5c0c0cf2a6a9e3fdbcd1ada3f79399c453b1fbd1 Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Thu, 27 Mar 2014 14:23:21 +0100 Subject: privateenv: Use POSIX keys instead of task variables. --- cpukit/include/rtems/userenv.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cpukit/include') diff --git a/cpukit/include/rtems/userenv.h b/cpukit/include/rtems/userenv.h index 8a9a4fcd32..631d773ae5 100644 --- a/cpukit/include/rtems/userenv.h +++ b/cpukit/include/rtems/userenv.h @@ -66,8 +66,17 @@ typedef struct { pid_t pgrp; /* process group id */ } rtems_user_env_t; -extern rtems_user_env_t * rtems_current_user_env; -extern rtems_user_env_t rtems_global_user_env; +extern rtems_user_env_t rtems_global_user_env; + +/** + * @brief Fetch the pointer to the current user environment. + * + * If the task has a private user environment the pointer to it will be + * returned. Otherwise the pointer to rtems_global_user_env will be returned. + */ +rtems_user_env_t * rtems_current_user_env_get(void); + +#define rtems_current_user_env rtems_current_user_env_get() #define rtems_filesystem_current (rtems_current_user_env->current_directory) #define rtems_filesystem_root (rtems_current_user_env->root_directory) @@ -86,6 +95,11 @@ extern rtems_user_env_t rtems_global_user_env; * function must be called from normal thread context and may block on a mutex. * Thread dispatching is disabled to protect some critical sections. * + * The private environment internally uses a POSIX key. The key is added to the + * configuration implicitly. But for each thread that uses a private environment + * a key value pair has to be configured by the application. If only the global + * environment is used there is no need to configure a key value pair. + * * @retval RTEMS_SUCCESSFUL Successful operation. * @retval RTEMS_NO_MEMORY Not enough memory. * @retval RTEMS_UNSATISFIED Cloning of the current environment failed. -- cgit v1.2.3