getgrent(3C)getgrent(3C)NAMEgetgrent(), getgrgid(), getgrgid_r(), getgrnam(), getgrnam_r(), set‐
grent(), endgrent(), fgetgrent() - get group file entry
and are used to obtain group entries, and return a pointer to an object
of structure. An entry may come from any of the sources for specified
in the file. See nsswitch.conf(4).
The structure is defined in and includes the following members:
When first called, returns a pointer to the first structure in the
group database; thereafter, it returns a pointer to
the next structure in the database. In this way,
successive calls can be used to search the entire
Has the effect of rewinding the group database to allow repeated
Can be called to indicate that group database processing is complete;
Searches from the beginning of the group database until a numeric group
matching gid is found, and returns a pointer to the
particular structure in which it was found;
Searches from the beginning of the group database until a group name
name is found, and returns a pointer to the partic‐
ular structure in which it was found;
Returns a pointer to the next
structure in the standard I/O stream stream, which
should be open for reading, and its contents should
match the format of
get group file entry.
and both update the group pointed to by and store a pointer to that
structure at the location pointed to by The structure shall contain an
entry from the group database with a matching or Storage referenced by
the group structure pointed to by shall be allocated from the memory
provided with the parameter, which is in size. The maximum size needed
for this buffer can be determined with the parameter. A NULL pointer
is returned at the location pointed to by on error or if the requested
entry is not found.
and return a NULL pointer if an end-of-file or error is encountered on
reading. Otherwise, the return value points to an internal static area
containing a valid structure.
and return zero upon success. Otherwise, an error number is returned
to indicate the error.
and fail if any of the following are true:
An I/O error has occurred.
OPEN_MAX file descriptors are currently open in the calling
The maximum allowable number of files is currently
open in the system.
The and functions will fail if:
Insufficient storage was supplied via
buffer and bufsize to contain the data to be refer‐
enced by the resulting group structure.
The value returned by and points to an area that is overwritten by each
call to any of the functions. It must be copied if it is to be saved.
Users of and should note that these interfaces now conform with
POSIX.1c. and are obsolescent interfaces. These interfaces and the
old prototypes of and are supported for compatibility with existing DCE
The interfaces and use the Dynamic Name Service Switch. (See nss‐
witch.conf(4).) An application that uses these interfaces cannot be
fully archive bound.
FILESSEE ALSOypcat(1), getgroups(2), getpwent(3C), stdio(3S), group(4),