1GETGRENT(3)                Linux Programmer's Manual               GETGRENT(3)
2
3
4

NAME

6       getgrent, setgrent, endgrent - get group file entry
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <grp.h>
11
12       struct group *getgrent(void);
13
14       void setgrent(void);
15
16       void endgrent(void);
17

DESCRIPTION

19       The getgrent() function returns a pointer to a structure containing the
20       broken-out fields of a record in the group database  (e.g.,  the  local
21       group  file /etc/group, NIS, and LDAP).  The first time it is called it
22       returns the first entry; thereafter, it returns successive entries.
23
24       The setgrent() function rewinds to the beginning of the group database,
25       to allow repeated scans.
26
27       The  endgrent()  function is used to close the group database after all
28       processing has been performed.
29
30       The group structure is defined in <grp.h> as follows:
31
32         struct group {
33             char   *gr_name;       /* group name */
34             char   *gr_passwd;     /* group password */
35             gid_t   gr_gid;        /* group ID */
36             char  **gr_mem;        /* group members */
37         };
38

RETURN VALUE

40       The getgrent() function returns a pointer to a group structure, or NULL
41       if there are no more entries or an error occurs.
42
43       Upon  error,  errno  may be set.  If one wants to check errno after the
44       call, it should be set to zero before the call.
45

ERRORS

47       EINTR  A signal was caught.
48
49       EIO    I/O error.
50
51       EMFILE The calling process already has too many open files.
52
53       ENFILE Too many open files in the system.
54
55       ENOMEM Insufficient memory to allocate group information structure.
56
57       ERANGE Insufficient buffer space supplied.
58

FILES

60       /etc/group
61              local group database file
62

CONFORMING TO

64       SVr4, 4.3BSD, POSIX.1-2001.
65

SEE ALSO

67       fgetgrent(3), getgrent_r(3), getgrgid(3), getgrnam(3), putgrent(3)
68
69
70
71                                  1993-04-04                       GETGRENT(3)
Impressum