source: rtems/cpukit/posix/src/types.c @ 62bf651f

4.104.114.84.95
Last change on this file since 62bf651f was 05ce4e09, checked in by Joel Sherrill <joel.sherrill@…>, on 06/07/96 at 15:21:27

changed code which set errno and then returned -1 to use the macro
set_errno_and_return_minus_one.

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