Open System Services System Calls Reference Manual (G06.28+, H06.05+)
getpwuid_r(2) OSS System Calls Reference Manual
NAME
getpwuid_r - Gets user attribute information from the user database (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/types.h>]
[#include <pwd.h>]
#include <spthread.h>
int getpwuid_r (
uid_t uid,
struct passwd *ret,
char *buffer,
size_t buflen,
struct passwd **result
);
PARAMETERS
uid Specifies the user ID of the user whose user attributes are to be returned.
ret Points to a struct passwd structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for
returned data.
buflen Specifies the size of the buffer passed in bytes.
result Points to the struct passwd that is returned.
DESCRIPTION
The getpwuid_r( ) function is the reentrant version of the getpwuid() function.
The getpwuid_r( ) function returns information about a user from the user authentication data-
base when the pw_uid field in the database entry matches the user ID specified by the uid param-
eter.
A user ID distinguishes a user on a Guardian system but does not distinguish an alias for that
user. Therefore, the getpwuid_r() function always returns the information for a user, not for an
alias of the user.
The getpwuid_r( ) function updates the passwd structure pointed to by the ret parameter and
stores a pointer to that structure at the location pointed to by the result parameter. The structure
contains an entry from the user database with a matching user ID. Storage referenced by the
structure is allocated from the memory provided using the buffer parameter, which is buflen char-
acters in size. A null pointer is returned at the location pointed to by the result parameter if an
error occurs or if the requested entry is not found.
User Structure
The user passwd structure returned by the getpwuid_r() function is defined in the pwd.h header
file. The structure contains the following fields:
pw_name The user login name.
pw_passwd The current user password (not returned).
3−108 Hewlett-Packard Company 527186-007