1fgetgrent(3)               Library Functions Manual               fgetgrent(3)
2
3
4

NAME

6       fgetgrent - get group file entry
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <stdio.h>
13       #include <sys/types.h>
14       #include <grp.h>
15
16       struct group *fgetgrent(FILE *stream);
17
18   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20       fgetgrent():
21           Since glibc 2.19:
22               _DEFAULT_SOURCE
23           glibc 2.19 and earlier:
24               _SVID_SOURCE
25

DESCRIPTION

27       The  fgetgrent()  function  returns a pointer to a structure containing
28       the group information from the file referred to by stream.   The  first
29       time  it  is  called it returns the first entry; thereafter, it returns
30       successive entries.  The file referred to by stream must have the  same
31       format as /etc/group (see group(5)).
32
33       The group structure is defined in <grp.h> as follows:
34
35           struct group {
36               char   *gr_name;        /* group name */
37               char   *gr_passwd;      /* group password */
38               gid_t   gr_gid;         /* group ID */
39               char  **gr_mem;         /* NULL-terminated array of pointers
40                                          to names of group members */
41           };
42

RETURN VALUE

44       The  fgetgrent()  function  returns  a pointer to a group structure, or
45       NULL if there are no more entries or an error occurs.  In the event  of
46       an error, errno is set to indicate the error.
47

ERRORS

49       ENOMEM Insufficient memory to allocate group structure.
50

ATTRIBUTES

52       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
53       tributes(7).
54
55       ┌───────────────────────────┬───────────────┬──────────────────────────┐
56Interface                  Attribute     Value                    
57       ├───────────────────────────┼───────────────┼──────────────────────────┤
58fgetgrent()                │ Thread safety │ MT-Unsafe race:fgetgrent │
59       └───────────────────────────┴───────────────┴──────────────────────────┘
60

STANDARDS

62       None.
63

HISTORY

65       SVr4.
66

SEE ALSO

68       endgrent(3),  fgetgrent_r(3),   fopen(3),   getgrent(3),   getgrgid(3),
69       getgrnam(3), putgrent(3), setgrent(3), group(5)
70
71
72
73Linux man-pages 6.05              2023-07-20                      fgetgrent(3)
Impressum