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 - get group file entry for group name

&pagelevel(4)&pagelevel

Syntax

#include <grp.h>

Optional
#include <sys/types.h> (End)

struct group *getgrnam(const char *name); 

Description

The getgrnam() function searches the group file for an entry containing a gr_name
component that matches name (see also grp.h and the manual "POSIX Basics" [1 (Related publications)]).

getgrnam() is not thread-safe. Use the reentrant function getgrnam_r() when needed.

Return val.

Pointer to an object of the structure group (see grp.h



if successful.

 

Null pointer

if an error occurs or no entry with a gr_name component matching name is found. errno is set to indicate the error.

Errors

The getgrnam() function fails if:

EIO

EINTR

EMFILE

ENFILE

An I/O error occurred.

A signal was caught during the execution of getgrnam().

Too many file descriptors are currently open in the calling process.

The system file table is currently full.

Notes

The return value may point to a static area which may be overwritten by a subsequent call
to getgrgid() or getgrnam().

To check for error situations, errno should be set to 0 before calling getgrnam().

See also

getgrnam_r(), getgrgid(), grp.h, limits.h, sys/types.h.