Open System Services System Calls Reference Manual (G06.28+, H06.05+)
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 buflen
);
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 Specifies 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. Only native
processes can call this function.
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
buflen characters in size.
Database Structure
Traditional UNIX implementations access user and group information by sequentially reading
unstructured files. In contrast, an HP NonStop server stores user and group information in struc-
tured, key-sequenced, Enscribe files.
Group Structure
The group structure used by the getgrent_r() function is defined in the grp.h header file. The
structure contains the following fields:
gr_name The group name of the group.
gr_passwd The system does not use this field, so its value is meaningless.
gr_gid The group ID of the group.
gr_mem The members of the group.
OSS supports the following POSIX.1-compliant group declaration:
struct group {
char *gr_name;
char *gr_passwd;
gid_t gr_gid;
char **gr_mem;
};
527186-007 Hewlett-Packard Company 3−67