1 | /* |
---|
2 | * Libio Internal Information |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #ifndef __rtems_userenv_h |
---|
15 | #define __rtems_userenv_h |
---|
16 | |
---|
17 | #include <rtems.h> |
---|
18 | #include <rtems/fs.h> |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | /* |
---|
25 | * External structures |
---|
26 | */ |
---|
27 | |
---|
28 | /* |
---|
29 | * According to IEEE Std 1003.1-2001, |
---|
30 | * limits.h is supposed to provide _POSIX_LOGIN_NAME_MAX |
---|
31 | * FIXME: We should not rely on this. |
---|
32 | */ |
---|
33 | #include <limits.h> |
---|
34 | |
---|
35 | #ifdef _POSIX_LOGIN_NAME_MAX |
---|
36 | #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX |
---|
37 | #else |
---|
38 | /* Fallback */ |
---|
39 | #define LOGIN_NAME_MAX 9 |
---|
40 | #endif |
---|
41 | |
---|
42 | typedef struct { |
---|
43 | rtems_id task_id; |
---|
44 | rtems_filesystem_location_info_t current_directory; |
---|
45 | rtems_filesystem_location_info_t root_directory; |
---|
46 | /* Default mode for all files. */ |
---|
47 | mode_t umask; |
---|
48 | nlink_t link_counts; |
---|
49 | /* _POSIX_types */ |
---|
50 | uid_t uid; |
---|
51 | gid_t gid; |
---|
52 | uid_t euid; |
---|
53 | gid_t egid; |
---|
54 | char login_buffer[LOGIN_NAME_MAX]; |
---|
55 | |
---|
56 | pid_t pgrp; /* process group id */ |
---|
57 | } rtems_user_env_t; |
---|
58 | |
---|
59 | extern rtems_user_env_t * rtems_current_user_env; |
---|
60 | extern rtems_user_env_t rtems_global_user_env; |
---|
61 | |
---|
62 | #define rtems_filesystem_current (rtems_current_user_env->current_directory) |
---|
63 | #define rtems_filesystem_root (rtems_current_user_env->root_directory) |
---|
64 | #define rtems_filesystem_link_counts (rtems_current_user_env->link_counts) |
---|
65 | #define rtems_filesystem_umask (rtems_current_user_env->umask) |
---|
66 | |
---|
67 | #define _POSIX_types_Uid (rtems_current_user_env->uid) |
---|
68 | #define _POSIX_types_Gid (rtems_current_user_env->gid) |
---|
69 | #define _POSIX_types_Euid (rtems_current_user_env->euid) |
---|
70 | #define _POSIX_types_Egid (rtems_current_user_env->egid) |
---|
71 | #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) |
---|
72 | |
---|
73 | |
---|
74 | /* |
---|
75 | * Instantiate a private copy of the per user information for the calling task. |
---|
76 | */ |
---|
77 | |
---|
78 | rtems_status_code rtems_libio_set_private_env(void); |
---|
79 | rtems_status_code rtems_libio_share_private_env(rtems_id task_id) ; |
---|
80 | |
---|
81 | #ifdef __cplusplus |
---|
82 | } |
---|
83 | #endif |
---|
84 | |
---|
85 | #endif |
---|
86 | /* end of include file */ |
---|