getgrent_r -- reentrantly get entry in group file


#include <grp.h>

int getgrent_r(struct group * gbuf, char * buf, size_t buflen, struct group * * gbufp);


The reentrant interface getgrent_r() shall function in the same way as the interface getgrent(), except that getgrent_r() shall return the group name, group password, and group members in buffers provided by the caller, rather than as a pointer to static storage.

The parameter gbuf contains the struct group that was read from the stream, if any.

The parameter buf contains additional strings, if any.

The parameter buflen specifies the size of buf.

The parameter *gbufp returns a pointer to the struct group in *gbuf.

Return Value

On success, getgrent_r() shall return 0, and *gbufp shall contain a pointer to the result.

On failure, *gbufp shall contain NULL, and getgrent_r() shall return an error as follows.



No more group entries.


Not enough buffer space. Specify a larger buffer and try again.