RTEMS 6.1-rc6
Loading...
Searching...
No Matches
userenv.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
10/*
11 * COPYRIGHT (c) 1989-2011.
12 * On-Line Applications Research Corporation (OAR).
13 *
14 * Modifications to support reference counting in the file system are
15 * Copyright (c) 2012 embedded brains GmbH & Co. KG
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _RTEMS_USERENV_H
40#define _RTEMS_USERENV_H
41
42/*
43 * According to IEEE Std 1003.1-2001,
44 * limits.h is supposed to provide _POSIX_LOGIN_NAME_MAX
45 * XXX: We do not rely on this.
46 */
47#include <sys/param.h>
48#include <limits.h>
49
50#include <rtems.h>
51#include <rtems/fs.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
66#ifndef LOGIN_NAME_MAX
67 #ifdef _POSIX_LOGIN_NAME_MAX
68 #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
69 #else
70 /* Fallback */
71 #define LOGIN_NAME_MAX 9
72 #endif
73#endif
74
76
85
90
94 mode_t umask;
95
99 uid_t uid;
100
104 gid_t gid;
105
109 uid_t euid;
110
114 gid_t egid;
115
119 char login_buffer[LOGIN_NAME_MAX];
120
124 pid_t pgrp;
125
129 size_t ngroups;
130
134 gid_t groups[NGROUPS];
135};
136
137extern rtems_user_env_t rtems_global_user_env;
138
146
147#define rtems_current_user_env rtems_current_user_env_get()
148
149#define rtems_filesystem_current (rtems_current_user_env->current_directory)
150#define rtems_filesystem_root (rtems_current_user_env->root_directory)
151#define rtems_filesystem_umask (rtems_current_user_env->umask)
152
153#define _POSIX_types_Uid (rtems_current_user_env->uid)
154#define _POSIX_types_Gid (rtems_current_user_env->gid)
155#define _POSIX_types_Euid (rtems_current_user_env->euid)
156#define _POSIX_types_Egid (rtems_current_user_env->egid)
157#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)
158
177
186
195
198#ifdef __cplusplus
199}
200#endif
201
202#endif
203/* end of include file */
rtems_status_code rtems_libio_set_private_env(void)
Creates a private environment.
Definition: privateenv.c:64
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:39
void rtems_libio_use_global_env(void)
Use the global environment.
Definition: privateenv.c:106
rtems_user_env_t * rtems_current_user_env_get(void)
Fetch the pointer to the current user environment.
Definition: __usrenv.c:271
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Basic Filesystem Types.
This header file defines the RTEMS Classic API.
Global file system location.
Definition: fs.h:100
User environment.
Definition: userenv.h:80
rtems_filesystem_global_location_t * current_directory
The anchor directory for relative paths.
Definition: userenv.h:84
char login_buffer[LOGIN_NAME_MAX]
The login buffer.
Definition: userenv.h:119
size_t ngroups
The count of supplementary group IDs.
Definition: userenv.h:129
mode_t umask
The file mode creation mask.
Definition: userenv.h:94
uid_t euid
The effective user ID.
Definition: userenv.h:109
rtems_filesystem_global_location_t * root_directory
The anchor directory for absolute paths.
Definition: userenv.h:89
uid_t uid
The real user ID.
Definition: userenv.h:99
pid_t pgrp
The process group ID.
Definition: userenv.h:124
gid_t groups[NGROUPS]
The list of supplementary group IDs.
Definition: userenv.h:134
gid_t gid
The real group ID.
Definition: userenv.h:104
gid_t egid
The effective group ID.
Definition: userenv.h:114