RTEMS  5.0.0
userenv.h
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2011.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * Modifications to support reference counting in the file system are
13  * Copyright (c) 2012 embedded brains GmbH.
14  *
15  * The license and distribution terms for this file may be
16  * found in the file LICENSE in this distribution or at
17  * http://www.rtems.org/license/LICENSE.
18  */
19 
20 #ifndef _RTEMS_USERENV_H
21 #define _RTEMS_USERENV_H
22 
23 /*
24  * According to IEEE Std 1003.1-2001,
25  * limits.h is supposed to provide _POSIX_LOGIN_NAME_MAX
26  * XXX: We do not rely on this.
27  */
28 #include <sys/param.h>
29 #include <limits.h>
30 
31 #include <rtems.h>
32 #include <rtems/fs.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
47 #ifndef LOGIN_NAME_MAX
48  #ifdef _POSIX_LOGIN_NAME_MAX
49  #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
50  #else
51  /* Fallback */
52  #define LOGIN_NAME_MAX 9
53  #endif
54 #endif
55 
59 typedef struct {
64 
69 
73  mode_t umask;
74 
78  uid_t uid;
79 
83  gid_t gid;
84 
88  uid_t euid;
89 
93  gid_t egid;
94 
98  char login_buffer[LOGIN_NAME_MAX];
99 
103  pid_t pgrp;
104 
108  size_t ngroups;
109 
113  gid_t groups[NGROUPS];
115 
116 extern rtems_user_env_t rtems_global_user_env;
117 
125 
126 #define rtems_current_user_env rtems_current_user_env_get()
127 
128 #define rtems_filesystem_current (rtems_current_user_env->current_directory)
129 #define rtems_filesystem_root (rtems_current_user_env->root_directory)
130 #define rtems_filesystem_umask (rtems_current_user_env->umask)
131 
132 #define _POSIX_types_Uid (rtems_current_user_env->uid)
133 #define _POSIX_types_Gid (rtems_current_user_env->gid)
134 #define _POSIX_types_Euid (rtems_current_user_env->euid)
135 #define _POSIX_types_Egid (rtems_current_user_env->egid)
136 #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)
137 
156 
164 void rtems_libio_use_global_env(void);
165 
174 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif
182 /* end of include file */
uid_t uid
The real user ID.
Definition: userenv.h:78
rtems_filesystem_global_location_t * root_directory
The anchor directory for absolute paths.
Definition: userenv.h:68
Definition: mount_prot.h:53
gid_t gid
The real group ID.
Definition: userenv.h:83
User environment.
Definition: userenv.h:59
rtems_status_code
Classic API Status.
Definition: status.h:43
rtems_status_code rtems_libio_set_private_env(void)
Creates a private environment.
Definition: privateenv.c:53
rtems_filesystem_global_location_t * current_directory
The anchor directory for relative paths.
Definition: userenv.h:63
uid_t euid
The effective user ID.
Definition: userenv.h:88
gid_t egid
The effective group ID.
Definition: userenv.h:93
mode_t umask
The file mode creation mask.
Definition: userenv.h:73
Basic Filesystem Types.
size_t ngroups
The count of supplementary group IDs.
Definition: userenv.h:108
rtems_user_env_t * rtems_current_user_env_get(void)
Fetch the pointer to the current user environment.
Definition: privateenv.c:32
void rtems_current_user_env_getgroups(void)
Gets the supplementary group IDs using the current user ID and updates the table of supplementary gro...
Definition: uenvgetgroups.c:25
Global file system location.
Definition: fs.h:81
void rtems_libio_use_global_env(void)
Use the global environment.
Definition: privateenv.c:102
pid_t pgrp
The process group ID.
Definition: userenv.h:103