Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 8
Get information about the user with a given ID
#include <sys/types.h>
#include <pwd.h>
int getpwuid_r( uid_t uid,
struct passwd* pwd,
char* buffer,
size_t bufsize,
struct passwd** result );
- uid
- The userid whose entry you want to find.
- pwd
- A pointer to a passwd structure where the function
can store the entry.
- buffer
- A block of memory that the function can use to allocate storage
referenced by the passwd structure.
You can determine the maximum size needed for this buffer by calling
sysconf()
with an argument of _SC_GETPW_R_SIZE_MAX.
- bufsize
- The size of the block that buffer points to, in characters.
- result
- The address of a pointer to a passwd structure.
If getpwnam_r() finds the entry, it stores a
pointer to pwd in the location indicated by result;
otherwise the function stores a NULL pointer there.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The getpwuid_r() function is a reentrant version of
getpwuid().
It lets a process gain more knowledge about user with the given uid.
If _POSIX_THREAD_SAFE_FUNCTIONS is defined, the
getpwuid_r() function updates the passwd
structure pointed to by pwd and stores a pointer to that
structure at the location pointed by result. The structure
contains an entry from the user database with a matching
uid.
The function stores a NULL pointer at the location pointed by
result on error or if it can't find the requested entry.
Zero for success, or an error number.
- ERANGE
- Insufficient storage was supplied via buffer and
bufsize to contain the resulting passwd
structure.
The getpwuid_r() function uses the following functions, and as a
result,
errno
can be set to an error for any of these calls:
POSIX 1003.1 TSF
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
getlogin(),
getpwent(),
getpwent_r(),
getpwnam(),
getpwnam_r(),
getpwuid()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 185
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpwuid_r.html on line 185