4.104.114.84.95
Last change
on this file since 690861c was
c5f52e9,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/18/03 at 07:31:32
|
2003-08-18 Ralf Corsepius <corsepiu@…>
PR 449/rtems:
- src/getegid.c: New (Copied from ../posix/src).
- src/geteuid.c: New (Copied from ../posix/src).
- src/getgid.c: New (Copied from ../posix/src).
- src/getgroups.c: New (Copied from ../posix/src).
- src/getlogin.c: New (Copied from ../posix/src).
- src/getpgrp.c: New (Copied from ../posix/src).
- src/getpid.c: New (Copied from ../posix/src).
- src/getppid.c: New (Copied from ../posix/src).
- src/getuid.c: New (Copied from ../posix/src).
- src/setpgid.c: New (Copied from ../posix/src).
- src/setsid.c: New (Copied from ../posix/src).
- src/no_posix: Remove getpid and _getpid_r.
- Makefile.am: Reflect changes above.
|
-
Property mode set to
100644
|
File size:
1018 bytes
|
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #if HAVE_CONFIG_H |
---|
6 | #include "config.h" |
---|
7 | #endif |
---|
8 | |
---|
9 | #include <limits.h> |
---|
10 | #include <string.h> |
---|
11 | #include <sys/types.h> |
---|
12 | #include <errno.h> |
---|
13 | |
---|
14 | #include <rtems/system.h> |
---|
15 | #include <rtems/score/object.h> |
---|
16 | #include <rtems/seterr.h> |
---|
17 | #include <rtems/userenv.h> |
---|
18 | |
---|
19 | #include <unistd.h> |
---|
20 | #include <pwd.h> |
---|
21 | |
---|
22 | /*PAGE |
---|
23 | * |
---|
24 | * 4.2.4 Get User Name, P1003.1b-1993, p. 87 |
---|
25 | * |
---|
26 | * NOTE: P1003.1c/D10, p. 49 adds getlogin_r(). |
---|
27 | */ |
---|
28 | |
---|
29 | /* |
---|
30 | * MACRO in userenv.h |
---|
31 | * |
---|
32 | static char _POSIX_types_Getlogin_buffer[ LOGIN_NAME_MAX ]; |
---|
33 | */ |
---|
34 | |
---|
35 | char *getlogin( void ) |
---|
36 | { |
---|
37 | (void) getlogin_r( _POSIX_types_Getlogin_buffer, LOGIN_NAME_MAX ); |
---|
38 | return _POSIX_types_Getlogin_buffer; |
---|
39 | } |
---|
40 | |
---|
41 | /*PAGE |
---|
42 | * |
---|
43 | * 4.2.4 Get User Name, P1003.1b-1993, p. 87 |
---|
44 | * |
---|
45 | * NOTE: P1003.1c/D10, p. 49 adds getlogin_r(). |
---|
46 | */ |
---|
47 | |
---|
48 | int getlogin_r( |
---|
49 | char *name, |
---|
50 | size_t namesize |
---|
51 | ) |
---|
52 | { |
---|
53 | struct passwd *pw; |
---|
54 | if ( namesize < LOGIN_NAME_MAX ) |
---|
55 | return ERANGE; |
---|
56 | |
---|
57 | pw=getpwuid(getuid()); |
---|
58 | if (!pw) { |
---|
59 | strcpy(name,""); |
---|
60 | } else { |
---|
61 | strncpy(name,pw->pw_name,LOGIN_NAME_MAX); |
---|
62 | }; |
---|
63 | return 0; |
---|
64 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.