Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

getgrnam_r - get group file entry for group name (thread-safe)

&pagelevel(4)&pagelevel

Syntax

#include <sys/types.h>

#include <grp.h>

int getgrnam_r(const char * name, struct group * grp, char * buffer,

size_t bufsize, struct group ** result);

Description  The getgrnam_r() updates the group structure pointed to by grp and stores a pointer to

this structure at the address pointed to by result. The structure contains the entry from the
group file whose gr_name component matches the name.

The structure found in the group file is copied to the memory area of length bufsize passed
in the buffer parameter. The maximum size required for this buffer can be determined via
the sysconf() parameter {_SC_GETGR_R_SIZE_MAX}.

When an error occurs or when the desired entry could not be found, a null pointer is
returned in the data area pointed to by result.

Return val.

0

Error number

if successful.

if an error occurs. errno is set to indicate the error.

Errors

The getgrnam_r() function fails if:

ERANGE

The memory area pointed to by buffer of length bufsize is not large enough
to hold the data pointed to by the resulting group structure.

See also

getgrnam(), getgrgid_r(), grp.h, limits.h, sys/types.h,
manual "POSIX Basics" [1 (Related publications)].