Gets a group database entry for a group ID. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <types.h> #include <grp.h> int getgrgid_r (gid_t gid, struct group *grp, char *buffer, size_t bufsize, struct group **result);
1 – Arguments
gid The group ID of the group for which the group database entry is to be retrieved. grp Storage area to hold the retrieved group structure. buffer The working buffer that is able to hold the longest group entry in the database. bufsize The length, in characters, of buffer. result Upon successful return, result points to the retrieved group structure. Upon unsuccessful return, result is set to NULL.
2 – Description
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 argument, which is bufsize characters in size. The maximum size needed for this buffer can be determined with the _SC_GETGR_ R_SIZE_MAX parameter of the sysconf function. On error or if the requested entry is not found, a NULL pointer is returned at the location pointed to by result.
3 – Return Values
0 Successful completion. x On error, the function sets the return value to one of the following: o EACCES - The user process does not have appropriate privileges enabled to access the user authorization file. o EIO - An I/O error has occurred. o EINTR - A signal was intercepted during getgrgid. o EMFILE - OPEN_MAX file descriptors are currently open in the calling process. o ENFILE - The maximum allowable number of files is currently open in the system. o ERANGE - Insufficient storage was supplied through the buffer and bufsize arguments to contain the data to be referenced by the resulting group structure.