RTEMS  5.0.0
Files | Data Structures | Macros | Functions | Variables
User Environment

Provides a POSIX like user environment for tasks. More...

Files

file  userenv.h
 User Environment Support.
 
file  privateenv.c
 Instantiate a Private User Environment.
 

Data Structures

struct  rtems_user_env_t
 User environment. More...
 

Macros

#define LOGIN_NAME_MAX   9
 
#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)
 
#define rtems_filesystem_umask   (rtems_current_user_env->umask)
 
#define _POSIX_types_Uid   (rtems_current_user_env->uid)
 
#define _POSIX_types_Gid   (rtems_current_user_env->gid)
 
#define _POSIX_types_Euid   (rtems_current_user_env->euid)
 
#define _POSIX_types_Egid   (rtems_current_user_env->egid)
 
#define _POSIX_types_Getlogin_buffer   (rtems_current_user_env->login_buffer)
 

Functions

rtems_user_env_trtems_current_user_env_get (void)
 Fetch the pointer to the current user environment. More...
 
rtems_status_code rtems_libio_set_private_env (void)
 Creates a private environment. More...
 
void rtems_libio_use_global_env (void)
 Use the global environment. More...
 
void rtems_current_user_env_getgroups (void)
 Gets the supplementary group IDs using the current user ID and updates the table of supplementary group IDs in the current user environment. More...
 

Variables

rtems_user_env_t rtems_global_user_env
 

Detailed Description

Provides a POSIX like user environment for tasks.

Function Documentation

◆ rtems_current_user_env_get()

rtems_user_env_t* rtems_current_user_env_get ( void  )

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.

Instantiate a private user environment for the calling thread.

◆ rtems_current_user_env_getgroups()

void rtems_current_user_env_getgroups ( void  )

Gets the supplementary group IDs using the current user ID and updates the table of supplementary group IDs in the current user environment.

In case of an error, the count of supplementary group IDs is set to zero.

◆ rtems_libio_set_private_env()

rtems_status_code rtems_libio_set_private_env ( void  )

Creates a private environment.

If the task has already a private environment nothing will be changed. This 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.

Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_NO_MEMORYNot enough memory.
RTEMS_UNSATISFIEDCloning of the current environment failed.
RTEMS_TOO_MANYCannot register the private environment.

◆ rtems_libio_use_global_env()

void rtems_libio_use_global_env ( void  )

Use the global environment.

A private environment will be released. This function may be called from every thread context. Thread dispatching is disabled to protect the critical sections.