RTEMS: cpukit/include/rtems/userenv.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
35extern "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
56typedef struct rtems_user_env_t rtems_user_env_t;
57
61 struct rtems_user_env_t {
65 rtems_filesystem_global_location_t *current_directory;
66
70 rtems_filesystem_global_location_t *root_directory;
71
75 mode_t umask;
76
80 uid_t uid;
81
85 gid_t gid;
86
90 uid_t euid;
91
95 gid_t egid;
96
100 char login_buffer[LOGIN_NAME_MAX];
101
105 pid_t pgrp;
106
110 size_t ngroups;
111
115 gid_t groups[NGROUPS];
116};
117
118extern rtems_user_env_t rtems_global_user_env;
119
126 rtems_user_env_t * rtems_current_user_env_get(void);
127
128#define rtems_current_user_env rtems_current_user_env_get()
129
130#define rtems_filesystem_current (rtems_current_user_env->current_directory)
131#define rtems_filesystem_root (rtems_current_user_env->root_directory)
132#define rtems_filesystem_umask (rtems_current_user_env->umask)
133
134#define _POSIX_types_Uid (rtems_current_user_env->uid)
135#define _POSIX_types_Gid (rtems_current_user_env->gid)
136#define _POSIX_types_Euid (rtems_current_user_env->euid)
137#define _POSIX_types_Egid (rtems_current_user_env->egid)
138#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)
139
157 rtems_status_code rtems_libio_set_private_env(void);
158
166void rtems_libio_use_global_env(void);
167
175void rtems_current_user_env_getgroups(void);
176
179#ifdef __cplusplus
180}
181#endif
182
183#endif
184/* end of include file */
rtems_status_code
rtems_status_code
Classic API Status.
Definition: status.h:43
rtems_libio_set_private_env
rtems_status_code rtems_libio_set_private_env(void)
Creates a private environment.
Definition: privateenv.c:45
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 gro...
Definition: uenvgetgroups.c:25
rtems_libio_use_global_env
void rtems_libio_use_global_env(void)
Use the global environment.
Definition: privateenv.c:87
rtems_current_user_env_get
rtems_user_env_t * rtems_current_user_env_get(void)
Fetch the pointer to the current user environment.
Definition: __usrenv.c:254
fs.h
Basic Filesystem Types.
rtems.h
groupnode
Definition: mount_prot.h:53
rtems_filesystem_global_location_t
Global file system location.
Definition: fs.h:81
rtems_user_env_t
User environment.
Definition: userenv.h:61
rtems_user_env_t::current_directory
rtems_filesystem_global_location_t * current_directory
The anchor directory for relative paths.
Definition: userenv.h:65
rtems_user_env_t::login_buffer
char login_buffer[LOGIN_NAME_MAX]
The login buffer.
Definition: userenv.h:100
rtems_user_env_t::ngroups
size_t ngroups
The count of supplementary group IDs.
Definition: userenv.h:110
rtems_user_env_t::umask
mode_t umask
The file mode creation mask.
Definition: userenv.h:75
rtems_user_env_t::euid
uid_t euid
The effective user ID.
Definition: userenv.h:90
rtems_user_env_t::root_directory
rtems_filesystem_global_location_t * root_directory
The anchor directory for absolute paths.
Definition: userenv.h:70
rtems_user_env_t::uid
uid_t uid
The real user ID.
Definition: userenv.h:80
rtems_user_env_t::pgrp
pid_t pgrp
The process group ID.
Definition: userenv.h:105
rtems_user_env_t::gid
gid_t gid
The real group ID.
Definition: userenv.h:85
rtems_user_env_t::egid
gid_t egid
The effective group ID.
Definition: userenv.h:95