source: rtems/cpukit/posix/src/types.c @ 232d6c1c

4.104.114.84.95
Last change on this file since 232d6c1c was 232d6c1c, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 8, 1997 at 3:50:17 AM

Removed getpid from this file and made it its own file. This lets it
get replaced as required.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <limits.h>
6#include <errno.h>
7#include <string.h>
8#include <sys/types.h>
9
10#include <rtems/system.h>
11#include <rtems/score/object.h>
12#include <rtems/posix/seterr.h>
13
14pid_t _POSIX_types_Ppid = 0;
15uid_t _POSIX_types_Uid = 0;
16uid_t _POSIX_types_Euid = 0;
17gid_t _POSIX_types_Gid = 0;
18gid_t _POSIX_types_Egid = 0;
19
20/*PAGE
21 *
22 *  4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
23 */
24
25pid_t getppid( void )
26{
27  return _POSIX_types_Ppid;
28}
29
30/*PAGE
31 *
32 *  4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
33 *        P1003.1b-1993, p. 84
34 */
35
36uid_t getuid( void )
37{
38  return _POSIX_types_Uid;
39}
40
41/*PAGE
42 *
43 *  4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
44 *        P1003.1b-1993, p. 84
45 */
46
47uid_t geteuid( void )
48{
49  return _POSIX_types_Euid;
50}
51
52/*PAGE
53 *
54 *  4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
55 *        P1003.1b-1993, p. 84
56 */
57
58gid_t getgid( void )
59{
60  return _POSIX_types_Gid;
61}
62
63/*PAGE
64 *
65 *  4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
66 *        P1003.1b-1993, p. 84
67 */
68
69gid_t getegid( void )
70{
71  return _POSIX_types_Egid;
72}
73
74/*PAGE
75 *
76 *  4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
77 */
78
79int setuid(
80  uid_t  uid
81)
82{
83  _POSIX_types_Uid = uid;
84  return 0;
85}
86
87/*PAGE
88 *
89 *  4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
90 */
91
92int setgid(
93  gid_t  gid
94)
95{
96  _POSIX_types_Gid = gid;
97  return 0;
98}
99
100/*PAGE
101 *
102 *  4.2.3 Get Supplementary IDs, P1003.1b-1993, p. 86
103 */
104
105int getgroups(
106  int    gidsetsize,
107  gid_t  grouplist[]
108)
109{
110  return 0;  /* no supplemental group ids */
111}
112
113/*PAGE
114 *
115 *  4.2.4 Get User Name, P1003.1b-1993, p. 87
116 *
117 *  NOTE:  P1003.1c/D10, p. 49 adds getlogin_r().
118 */
119
120static char _POSIX_types_Getlogin_buffer[ LOGIN_NAME_MAX ];
121
122char *getlogin( void )
123{
124  (void) getlogin_r( _POSIX_types_Getlogin_buffer, LOGIN_NAME_MAX );
125  return _POSIX_types_Getlogin_buffer;
126}
127
128/*PAGE
129 *
130 *  4.2.4 Get User Name, P1003.1b-1993, p. 87
131 *
132 *  NOTE:  P1003.1c/D10, p. 49 adds getlogin_r().
133 */
134
135int getlogin_r(
136  char   *name,
137  size_t  namesize
138)
139{
140  if ( namesize < LOGIN_NAME_MAX )
141    return ERANGE;
142
143  strcpy( name, "posixapp" );
144  return 0;
145}
146
147/*PAGE
148 *
149 *  4.3.1 Get Process Group IDs, P1003.1b-1993, p. 89
150 */
151
152pid_t getpgrp( void )
153{
154  /*
155   *  This always succeeds and returns the process group id.  For rtems,
156   *  this will always be the local node;
157   */
158
159  return _Objects_Local_node;
160}
161
162/*PAGE
163 *
164 *  4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88
165 */
166
167pid_t setsid( void )
168{
169  set_errno_and_return_minus_one( ENOSYS );
170}
171
172/*PAGE
173 *
174 *  4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89
175 */
176
177int setpgid(
178  pid_t  pid,
179  pid_t  pgid
180)
181{
182  set_errno_and_return_minus_one( ENOSYS );
183}
184
185/*
186 * TEMPORARY
187 */
188
189#include <assert.h>
190
191int POSIX_MP_NOT_IMPLEMENTED()
192{
193  assert( 0 );
194  return 0;
195}
196
197int POSIX_BOTTOM_REACHED()
198{
199  assert( 0 );
200  return 0;
201}
202
203int POSIX_NOT_IMPLEMENTED()
204{
205  assert( 0 );
206  return 0;
207}
208
209/*
210 * END OF TEMPORARY
211 */
212
Note: See TracBrowser for help on using the repository browser.