Open System Services System Calls Reference Manual (G06.28+)

System Functions (f - i) getpwnam_r(2)
NAME
getpwnam_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 getpwnam_r (
const char *name,
struct passwd *ret,
char *buffer,
size_t buen,
struct passwd **result
);
PARAMETERS
name Species the username 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 Species the size of the buffer passed in bytes.
result Points to the struct passwd that is returned.
DESCRIPTION
The getpwnam_r( ) function is the reentrant version of the getpwnam() function.
The getpwnam_r( ) function returns information about a user from the user authentication data-
base when the pw_name eld in the database entry matches the username specied by the name
parameter.
The getpwnam_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 paramter. The structure
contains an entry from the user database with a name that matches the value of the name parame-
ter. Storage referenced by the structure is allocated from the memory provided using the buffer
parameter, which is buen characters 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 getpwnam_r() function is dened in the pwd.h
header le. The structure contains the following elds:
pw_name The user login name.
pw_passwd The current user password (not returned).
pw_uid The user ID of the user.
527186-005 Hewlett-Packard Company 385