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 getgrgid_r(gid_t gid, struct group *grp, char *buffer,
size_t bufsize, struct group **result);
#define _POSIX_SOURCE
#include <grp.h>
int __getgrgid1(gid_t gid, struct group *grp, char *buffer,
size_t bufsize, struct group **result);
The getgrgid_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 gid. 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 __getgrgid1() function is identical to getgrgid_r() except that it does not return the individual group member names. Element gr_mem of the group structure pointed to by grp will be set to NULL.
If successful, getgrgid_r() or __getgrgid1() returns 0.
If unsuccessful, getgrgid_r() or __getgrgid1() returns an error number and sets errno to one of the following values: