[dd2906e] | 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 |
---|
[09fd8ce5] | 9 | * http://www.rtems.com/license/LICENSE. |
---|
[dd2906e] | 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 | */ |
---|
[2d3c472b] | 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 | |
---|
[36e92589] | 35 | #ifndef LOGIN_NAME_MAX |
---|
[2d3c472b] | 36 | #ifdef _POSIX_LOGIN_NAME_MAX |
---|
[dd2906e] | 37 | #define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX |
---|
| 38 | #else |
---|
[2d3c472b] | 39 | /* Fallback */ |
---|
| 40 | #define LOGIN_NAME_MAX 9 |
---|
[dd2906e] | 41 | #endif |
---|
[36e92589] | 42 | #endif |
---|
[dd2906e] | 43 | |
---|
| 44 | typedef struct { |
---|
| 45 | rtems_id task_id; |
---|
| 46 | rtems_filesystem_location_info_t current_directory; |
---|
| 47 | rtems_filesystem_location_info_t root_directory; |
---|
| 48 | /* Default mode for all files. */ |
---|
| 49 | mode_t umask; |
---|
| 50 | nlink_t link_counts; |
---|
| 51 | /* _POSIX_types */ |
---|
| 52 | uid_t uid; |
---|
| 53 | gid_t gid; |
---|
| 54 | uid_t euid; |
---|
| 55 | gid_t egid; |
---|
| 56 | char login_buffer[LOGIN_NAME_MAX]; |
---|
| 57 | |
---|
| 58 | pid_t pgrp; /* process group id */ |
---|
| 59 | } rtems_user_env_t; |
---|
| 60 | |
---|
| 61 | extern rtems_user_env_t * rtems_current_user_env; |
---|
| 62 | extern rtems_user_env_t rtems_global_user_env; |
---|
| 63 | |
---|
| 64 | #define rtems_filesystem_current (rtems_current_user_env->current_directory) |
---|
| 65 | #define rtems_filesystem_root (rtems_current_user_env->root_directory) |
---|
| 66 | #define rtems_filesystem_link_counts (rtems_current_user_env->link_counts) |
---|
| 67 | #define rtems_filesystem_umask (rtems_current_user_env->umask) |
---|
| 68 | |
---|
| 69 | #define _POSIX_types_Uid (rtems_current_user_env->uid) |
---|
| 70 | #define _POSIX_types_Gid (rtems_current_user_env->gid) |
---|
| 71 | #define _POSIX_types_Euid (rtems_current_user_env->euid) |
---|
| 72 | #define _POSIX_types_Egid (rtems_current_user_env->egid) |
---|
| 73 | #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * Instantiate a private copy of the per user information for the calling task. |
---|
| 78 | */ |
---|
| 79 | |
---|
| 80 | rtems_status_code rtems_libio_set_private_env(void); |
---|
| 81 | rtems_status_code rtems_libio_share_private_env(rtems_id task_id) ; |
---|
| 82 | |
---|
| 83 | #ifdef __cplusplus |
---|
| 84 | } |
---|
| 85 | #endif |
---|
| 86 | |
---|
| 87 | #endif |
---|
| 88 | /* end of include file */ |
---|