summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/userenv.h
blob: d86abd7e3dfb812d8d224ff42e0e30f8f42b1c39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 *  Libio Internal Information
 *
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */

#ifndef __rtems_userenv_h
#define __rtems_userenv_h

#include <rtems.h>
#include <rtems/fs.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  External structures
 */
#if !defined(LOGIN_NAME_MAX)
#if defined(__linux__)
#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
#else
#error "don't know how to set LOGIN_NAME_MAX"
#endif
#endif

typedef struct {
 rtems_id                         task_id;	
 rtems_filesystem_location_info_t current_directory;
 rtems_filesystem_location_info_t root_directory;
 /* Default mode for all files. */
 mode_t                           umask;
 nlink_t                          link_counts;
 /* _POSIX_types */
 uid_t                            uid;
 gid_t                            gid;
 uid_t                            euid;
 gid_t                            egid;
 char      login_buffer[LOGIN_NAME_MAX];

 pid_t                            pgrp; /* process group id */
} rtems_user_env_t;

extern rtems_user_env_t * rtems_current_user_env; 
extern rtems_user_env_t   rtems_global_user_env; 

#define rtems_filesystem_current     (rtems_current_user_env->current_directory)
#define rtems_filesystem_root        (rtems_current_user_env->root_directory)
#define rtems_filesystem_link_counts (rtems_current_user_env->link_counts)
#define rtems_filesystem_umask       (rtems_current_user_env->umask)

#define _POSIX_types_Uid             (rtems_current_user_env->uid)
#define _POSIX_types_Gid             (rtems_current_user_env->gid)
#define _POSIX_types_Euid            (rtems_current_user_env->euid)
#define _POSIX_types_Egid            (rtems_current_user_env->egid)
#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)


/*
 *  Instantiate a private copy of the per user information for the calling task.
 */

rtems_status_code rtems_libio_set_private_env(void);
rtems_status_code rtems_libio_share_private_env(rtems_id task_id) ;
	
#ifdef __cplusplus
}
#endif

#endif
/* end of include file */