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

System Functions (f - i) getgrent_r(2)
NAME
getgrent_r - Gets group information from the group database (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <grp.h>]
#include <spthread.h>
struct group *getgrent_r (
struct group *grp,
char *buffer,
size_t buen
);
PARAMETERS
grp Points to a struct group structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for grp
data.
buflen Species the size of the buffer passed in bytes.
DESCRIPTION
The getgrent_r() function is the reentrent version of the getgrent() function.
The getgrent_r() function returns information about the next group in the database. This func-
tion can be called only by native processes.
The getgrent_r() function updates the group structure pointed to by grp. Storage referenced by
the group structure is allocated from the memory provided with the buffer parameter, which is
buen characters in size.
Database Structure
Traditional UNIX implementations access user and group information by sequentially reading
unstructured les. In contrast, an HP NonStop server stores user and group information in struc-
tured, key-sequenced, Enscribe les.
Group Structure
The group structure used by the getgrent_r() function is dened in the grp.h header le. The
structure contains the following elds:
gr_name The group name of the group.
gr_passwd This eld is not used by the system, so its value is meaningless.
gr_gid The group ID of the group.
gr_mem The members of the group.
Open System Services supports the following POSIX.1-compliant group declaration:
struct group {
char *gr_name;
char *gr_passwd;
gid_t gr_gid;
char **gr_mem;
};
527186-005 Hewlett-Packard Company 347