Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (g - h) getgrent_r(3)
H06.21 and later H-series RVUs and J06.10 and later J-series RVUs
The group information is updated in the structure pointed to by the grp parameter and a pointer to
that structure is stored at the location pointed to by the result parameter. Storage referenced by
the grp structure is allocated from the memory provided with the buffer parameter, which is
buflen bytes in size. The maximum size needed for this buffer can be determined with the
_SC_GETGR_R_SIZE_MAX parameter of the sysconf( ) function. A NULL pointer is returned
at the location pointed to by the result parameter on error or if the requested entry is not found.
Standard POSIX Threads Library version of getpwent_r( )
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;
};
The gr_passwd field is provided for compatibility with some versions of UNIX, but it always
contains a null string.
NOTES
Use the functions getgrnam_r( ) and getgrgid_r( ) instead of this function to ensure portability
to future systems.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model Library or the Standard POSIX Threads Library for
threaded applications.
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, if you are |
NOT using the Standard POSIX Threads Library (this is not a threaded application or you are |
using the POSIX User Thread Model Library) you can use this function with 32-bit or 64-bit OSS |
applications.
If you are NOT using the Standard POSIX Threads Library (this is not a threaded application or
you are using the POSIX User Thread Model Library), you must:
527187-017 Hewlett-Packard Company 337