Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Single UNIX Specification, Version 2 |
both | OS/390 V2R8 |
#define _XOPEN_SOURCE 500
#include <sys/types.h>
#include <grp.h>
int getgrnam_r(const char *name, struct group *grp, char *buffer,
size_t bufsize, struct group **result);
#define _POSIX_SOURCE
#include <grp.h>
int __getgrnam1(const char *name, struct group *grp, char *buffer,
size_t bufsize, struct group **result);
The getgrnam_r() function updates the group structure pointed to by grp and stores a pointer to that structure at the location pointed to by result. The structure contains an entry from the group database with a matching name. Storage referenced by the group structure is allocated from the memory provided with the buffer parameter, which is bufsize bytes in size. A NULL pointer is returned at the location pointed to by result on error or if the requested entry is not found.
The __getgrnam1() function is identical to getgrnam_r() except that it does not return the individual group member names. Element gr_mem within the group structure pointed to by grp will be set to NULL.
If successful, getgrnam_r() or __getgrnam1() returns 0.
If unsuccessful, getgrnam_r() or _getgrnam1() returns an error number and sets errno to one of the following values: